Skip to content
🍑 PHP library for accessing JW Platform API
PHP Dockerfile Makefile
Branch: master
Clone or download
Latest commit a8603d6 Nov 30, 2019

README.md

JW Platform API Client

The JWPlatform PHP library provides convenient access to the JW Platform Management API from applications written in the PHP language.

Visit JW Player Developer site for more information about JW Platform API.

Requirements

PHP 5.6.0 and later.

Install

Composer

You can install the bindings via Composer. Run the following command:

composer require jwplayer/jwplatform

To use the bindings, use Composer's autoload:

require_once('vendor/autoload.php');

Manual Installation

If you do not wish to use Composer, you can download the latest release. Then, to use the bindings, include the init.php file.

require_once('/path/to/jwplatform-php/init.php');

Dependencies

The bindings require the following extensions in order to work properly:

  • curl, although you can use your own non-cURL client if you prefer

If you use Composer, these dependencies should be handled automatically. If you install manually, you'll want to make sure that these extensions are available.

Usage

Example of getting video metadata:

$jwplatform_api = new Jwplayer\JwplatformAPI('INSERT API KEY', 'INSERT API SECRET');

$video_key = 'INSERT VIDEO KEY';
$response = $jwplatform_api->call('/videos/show', array('video_key'=>$video_key));

Example of uploading a file:

$jwplatform_api = new Jwplayer\JwplatformAPI('INSERT API KEY', 'INSERT API SECRET');

$target_file = 'examples/test.mp4';
$params = array();
$params['title'] = 'PHP API Test Upload';
$params['description'] = 'Video description here';

// Create video metadata
$create_response = json_encode($jwplatform_api->call('/videos/create', $params));
$decoded = json_decode(trim($create_response), TRUE);
$upload_link = $decoded['link'];

$upload_response = $jwplatform_api->upload($upload_link, $target_file);

print_r($upload_response);

Development

Get Composer. For example, on Mac OS:

brew install composer

Install dependencies:

composer install

License

JW Platform API library is distributed under the MIT license.

You can’t perform that action at this time.