PHP code example of fenix007 / apiwrapper
1. Go to this page and download the library: Download fenix007/apiwrapper 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/ */
fenix007 / apiwrapper example snippets
namespace Siqwell\Eagle;
class Methods
{
const TRANSLATIONS_GET_LIST = ['method' => 'GET', 'path' => '/streaming/translations.json'];
const TRANSLATION_GET_INFO = ['method' => 'GET', 'path' => '/streaming/translations/{id}.json'];
}
class RecordApi extends Fenix007\Wrapper\Api\AbstractApi
{
/**
* @param $id
* @throws \Exception
* @return \Siqwell\Eagle\Models\Record
* ID – идентификатор записи
*/
public function find($id) : ?Record
{
$parameters = [
'id' => $id
];
$result = $this->get(
Request::createFromMethod(Methods::RECORD_GET_INFO, $parameters),
RecordMapper::class
);
return $result;
}
}
namespace Siqwell\Eagle\Tests\Api;
class TestCase extends \Fenix007\Wrapper\Tests\Api\TestCase
{
const DYNAMIC_FIELDS = [
'current_screenshot',
'current_screenshot_small',
'screenshot',
'screenshot_small',
'view_count',
'updated_at'
];
protected $rootDir = ROOT_DIR;
protected $resourceDir = RESOURCES_DIR;
}
protected function setUp()
{
parent::setUp();
//TODO: change on real API
$this->translationApi = new TranslationApi($this->createFakeHttpClient());
}