PHP code example of somecoding / wp-api-wrapper

1. Go to this page and download the library: Download somecoding/wp-api-wrapper 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/ */

    

somecoding / wp-api-wrapper example snippets



namespace Somecoding\WordpressApiWrapper;


use GuzzleHttp\Client;
use Somecoding\WordpressApiWrapper\Model\Post;
use Somecoding\WordpressApiWrapper\Service\ApiService;
use Somecoding\WordpressApiWrapper\Service\Main\PostService;
use Symfony\Component\Cache\Simple\RedisCache;
use Zend\Config\Config;
use Zend\Hydrator\ClassMethodsHydrator;


 'https://example.com', $cacheInterface);
$categoriesService = new CategoriesService($api);
$mediaService = new MediaService($api);
$pageService = new PageService($api);
$postService = new PostService($api);
$searchService = new SearchService($api);
$userService = new UserService($api);

$availableRoutes  = $api->getAllRoutes();