Add video to your personal homepage with Mux PHP
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.
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. 😘
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!
// Authentication Setup
$config = MuxPhp\Configuration::getDefaultConfiguration()
// API Client Initialization
$assetsApi = new MuxPhp\Api\AssetsApi(
// 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] ]);
$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 SDKs
and 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.
We’re really excited to see what you build using Mux PHP
- show us your cool projects via Twitter at @MuxHQ
Subscribe to get your daily round-up of top tech stories!