Like a lot of people discovering programming in the early 2000s, PHP was the first programming language I learned. Long before great online resources existed, I had this dusty old thing called a book, littered with mystical lines of PHP that I only partially understood.
While usage has been declining, PHP is still the 7th most used language on Github, and we’ve heard your cries loud and clear - you need a PHP SDK.
Well, good news! Last week, I dusted off my old PHP book and got to work! 🎉
Just kidding, we generated a shiny new PHP SDK, just for you, because we love you. 😘
Mux PHP is a lightweight wrapper around Mux’s APIs, which make it easy to integrate Mux-powered video experiences into your PHP apps.
It’s super easy to ingest some content into your Mux account using Mux PHP - let’s take a look at a simple app which does just that!
<?php require_once 'vendor/autoload.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(["input" => $input, "playback_policy" => [MuxPhp\Models\PlaybackPolicy::PUBLIC_PLAYBACK_POLICY] ]); // Ingest $result = $assetsApi->createAsset($createAssetRequest); // Print URL print "Playback URL: https://stream.mux.com/" . $result->getData()->getPlaybackIds()->getId() . ".m3u8\n"
Mux PHP is, of course, the latest in the line of our SDKs generated from the OpenAPI definitions of our APIs. We wrote about how we’re building our code-generated SDKsand some of the challenges we’ve experienced on our blog. Check it out!
We’ll be releasing even more SDKs over the coming months, but if you have a burning desire for an SDK in a particular language, please get in touch so we work on what’s most important to you.
Create your free account to unlock your custom reading experience.