1. Go to this page and download the library: Download vaibhavpandeyvpz/dakiya 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/ */
vaibhavpandeyvpz / dakiya example snippets
use Dakiya\Client;
use Sandesh\RequestFactory;
use Sandesh\ResponseFactory;
// Create the client with a response factory
$client = new Client(new ResponseFactory());
// Create a request
$requestFactory = new RequestFactory();
$request = $requestFactory->createRequest('GET', 'https://api.example.com/users');
// Send the request
$response = $client->sendRequest($request);
// Check the response
if ($response->getStatusCode() === 200) {
$body = (string) $response->getBody();
$data = json_decode($body, true);
// Process the data...
}
use Dakiya\Client;
use Sandesh\RequestFactory;
use Sandesh\ResponseFactory;
$client = new Client(new ResponseFactory());
$requestFactory = new RequestFactory();
$request = $requestFactory->createRequest('GET', 'https://api.example.com/data');
$response = $client->sendRequest($request);
echo $response->getStatusCode(); // 200
echo (string) $response->getBody();
use Dakiya\Client;
use Sandesh\RequestFactory;
use Sandesh\ResponseFactory;
use Sandesh\StreamFactory;
$client = new Client(new ResponseFactory());
$requestFactory = new RequestFactory();
$streamFactory = new StreamFactory();
$body = json_encode(['name' => 'John Doe', 'email' => '[email protected]']);
$request = $requestFactory->createRequest('POST', 'https://api.example.com/users')
->withBody($streamFactory->createStream($body))
->withHeader('Content-Type', 'application/json');
$response = $client->sendRequest($request);