# Add high-performance video to your PHP application

Use the official Mux SDK for PHP to call the Mux API from your server. The SDK handles authentication and wraps each API endpoint in native PHP code.

The Mux SDK for PHP wraps the Mux REST API in native PHP code. Use this SDK when you write your server application in PHP. You can create assets, manage live streams, and query Mux Data without manual HTTP requests.

## Installation

We publish Mux PHP to Packagist. You should depend on Mux PHP by adding us to your `composer.json` file.

```php
composer require muxinc/mux-php
```

## Quickstart

To start, you'll need a Mux access token. Once you've got that, you're off to the races!

```php
// Authentication Setup
$config = MuxPhp\Configuration::getDefaultConfiguration()
    ->setUsername(getenv('MUX_TOKEN_ID'))
    ->setPassword(getenv('MUX_TOKEN_SECRET'));

// API Client Initialization
$assetsApi = new MuxPhp\Api\AssetsApi(
    new GuzzleHttp\Client(),
    $config
);

// Create Asset Request
$input = new MuxPhp\Models\InputSettings(["url" => "https://storage.googleapis.com/muxdemofiles/mux-video-intro.mp4"]);
$createAssetRequest = new MuxPhp\Models\CreateAssetRequest(["inputs" => $input, "playback_policies" => [MuxPhp\Models\PlaybackPolicy::PUBLIC_PLAYBACK_POLICY] ]);

// Ingest
$result = $assetsApi->createAsset($createAssetRequest);

// Print URL
print "Playback URL: https://stream.mux.com/" . $result->getData()->getPlaybackIds()[0]->getId() . ".m3u8\n"
```

## Full documentation

Check out the [Mux PHP SDK docs](https://github.com/muxinc/mux-php) for more information.
