1. Go to this page and download the library: Download utopia-php/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/ */
utopia-php / client example snippets
use Utopia\Client;
use Utopia\Client\Adapter\Curl\Client as CurlAdapter;
use Utopia\Psr7\Method;
use Utopia\Psr7\Request;
, 'https://example.com/users', [
'name' => 'Ada',
]);
$response = $client->sendRequest($request);
echo $response->getStatusCode();
echo $response->json()['name'];
use Utopia\Psr7\ContentType;
use Utopia\Psr7\Header;
$client = $client
->withBaseUri('https://api.example.com/v1') // relative request URIs resolve against this
->withHeaders([
Header::ACCEPT => ContentType::JSON,
Header::USER_AGENT => 'Acme API Client',
])
->withBearerAuth('token'); // or ->withBasicAuth('user', 'pass')