1. Go to this page and download the library: Download anik/apiz 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/ */
anik / apiz example snippets
namespace App\Services;
use Apiz\AbstractApi;
class ReqResApiService extends AbstractApi
{
protected function setBaseUrl() {
return 'https://reqres.in';
}
}
namespace App\Services;
use Apiz\AbstractApi;
class ReqResApiService extends AbstractApi
{
protected function setBaseUrl() {
return 'https://reqres.in';
}
protected function setPrefix () {
return 'api';
}
}
namespace App\Services;
use Apiz\AbstractApi;
class ReqResApiService extends AbstractApi
{
protected function setBaseUrl()
{
return 'https://reqres.in';
}
protected function setPrefix () {
return 'api';
}
public function allUsers()
{
$users = $this/*->query(['page'=>2])*/->get('/users');
if ($users->getStatusCode() == 200) {
return $users->parseJson();
}
return null;
}
}
public function createUser(array $data)
{
$user = $this->formParams($data)
->post('/create');
if ($user->getStatusCode() == 201) {
return $user->parseJson();
}
return null;
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.