1. Go to this page and download the library: Download zooxsmart/los-api-client library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
$client = new \Los\ApiClient\ApiClient('http://api.example.com');
/* @var \Los\ApiClient\ApiClient $client */
$client = new \Los\ApiClient\ApiClient('http://api.example.com');
/* @var \Los\ApiClient\Resource\ApiResource $ret */
$ret = $client->get('/album/1');
// $data is an array with all data and resources (_embedded) from the response
$data = $ret->getData();
/* @var \Los\ApiClient\ApiClient $client */
$client = new \Los\ApiClient\ApiClient('http://api.example.com');
/* @var \Los\ApiClient\Resource\ApiResource $ret */
$ret = $client->get('/album', [ 'query' => ['year' => 2018] ]);
// $data is an array with all data and resources (_embedded) from the response
$data = $ret->getData();
// $data is an array with the first album resource from the response
$data = $ret->getFirstResource('album');
// $data is an array with the all album resources from the response
$data = $ret->getResources('album');
// $data is an array with the all resources from the response
$data = $ret->getResources();
/* @var \Psr\SimpleCache\CacheInterface */
$cache = null; // Any PSR-16 cache service.
/* @var \Los\ApiClient\ApiClient $client */
$client = new \Los\ApiClient\ApiClient('http://api.example.com', $cache);
// The last param is a per item ttl, please make sure your cache service can handle it.
/* @var \Los\ApiClient\Resource\ApiResource $ret */
$ret = $client->getCached('/album', 'cached-key', [ 'query' => ['year' => 2018] ], null);
// $data is an array with all data and resources (_embedded) from the response
$data = $ret->getData();
// $data is an array with the first album resource from the response
$data = $ret->getFirstResource('album');
// $data is an array with the all album resources from the response
$data = $ret->getResources('album');
// $data is an array with the all resources from the response
$data = $ret->getResources();
$client = $this->getServiceLocator()->get('hermes');
$client->addRequestId(); // Auto generared
$client->addRequestId('123abc');
bash
php composer.phar
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.