Public Premium Media Script Files
Switch branches/tags
Nothing to show
Clone or download
Latest commit 535b129 May 29, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
API Added asJSON Feb 8, 2018
README.md Update README.md May 29, 2018
sample.php Create sample.php Feb 8, 2018

README.md

Premium Media Script

Help Contribute

Send us pull requests and help improve the code.

Premium Media Script PHP API Wrapper

The official API wrapper for Premium Media Script

Your first integration

The example below shows how to set it up. You need to get your API key from the settings page of the admin control panel

/**
 * Include the main class
 */
include("API/Media.php");

$media = new kbrmedia\Media();

$media->setURL("http://media.site/api");
$media->setKey("APIKEY");

Single Media

Get data for a single media by sending the unique ID of the media

/**
 * View Endpoint
 * Get data for one media
 * @param string Unique Media ID
 */

$media->media("UNIQUEMEDIAID")->asObject();

Search Media

Search media by sending filters & a keyword

/**
 * Search Endpoint
 * Get data for searched media
 * @param integer Limits (optional)
 * @param string Order: date, votes, views (optional)
 * @param integer currentpage (optional)
 * @param string keyword
 */

$media->setLimit("10")->setOrder("date")->setPage("1")->search("Keyword")->asObject();

User's uploads

Get user's uploads by sending filters & the user

/**
 * User's upload
 * @param integer Limits (optional)
 * @param string Order: date, votes, views (optional)
 * @param integer currentpage (optional)
 * @param string username
 */
$media->setLimit("10")->setOrder("date")->setPage("1")->user("admin")->asObject();

asArray()

If you wish to work with an array of data instead of object, use asArray.

/**
 * View Endpoint as Array
 * Get data for one media
 * @param string Unique Media ID
 */

$media->media("UNIQUEMEDIAID")->asArray();

asJSON()

If you wish to work with a JSON instead of object, use asJSON.

/**
 * View Endpoint as JSON
 * Get data for one media
 * @param string Unique Media ID
 */

$media->media("UNIQUEMEDIAID")->asJSON();