PHP code example of gautammkgarg / psr-for-wordpress
1. Go to this page and download the library: Download gautammkgarg/psr-for-wordpress 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/ */
gautammkgarg / psr-for-wordpress example snippets
use GautamMKGarg\PsrForWordPress\Http\Psr18Client;
use Nyholm\Psr7\Factory\Psr17Factory;
$client = new Psr18Client();
$factory = new Psr17Factory();
$request = $factory->createRequest('GET', 'https://api.example.com/endpoint');
$response = $client->sendRequest($request);
echo $response->getStatusCode(); // 200
echo (string) $response->getBody(); // JSON response body