We’re happy to announce that for PHP developers, it’s now even easier to convert your files with the Zamzar API. The new PHP SDK allows you to easily interact with our API without having to use all the typical boilerplate code for interacting with a HTTP web service and interrogating the results.
Before the PHP SDK, the typical approach for converting a file involved three separate steps to submit a job, wait for the job the complete, and then download the converted file. This could be confusing if you’re not a CURL expert or looking for minimal code to add to your own codebase.
The PHP SDK vastly simplifies file conversion into just a few lines of code, and supports easy installation via Composer:
// Initialise the Client $zamzar = new \Zamzar\ZamzarClient('apikey'); // Submit, Wait, Download $job = $zamzar ->jobs ->submit([ 'source_file' => 'path/to/example.gif', 'target_format' => 'png' ]) ->waitForCompletion([ 'timeout' => 120 ]) ->downloadTargetFiles([ 'download_path' => 'path/to/local/folder' ]);
Each step of the above can of course be broken out into it’s component parts, depending on how you need to integrate each step into your workflow. It’s also easier to work with the results using objects, properties and methods which closely map to the API, plus PSR-3 compatible logging if you need it.
Head over to the SDK Documentation for instructions on how to install and use the SDK, including a wealth of code samples to get your started. We’ve also provided a rich sample application for inspiration.
We’ll be adding more languages in the near future which we’ll announce on this blog.
The Zamzar Team.
[Cover photo by Ben Griffiths]