2017 © Pedro Peláez
 

library wordpress-rest-api-client

image

vnn/wordpress-rest-api-client

  • Thursday, April 6, 2017
  • by mrkrstphr
  • Repository
  • 10 Watchers
  • 18 Stars
  • 10,277 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 13 Forks
  • 5 Open issues
  • 4 Versions
  • 32 % Grown

The README.md

wordpress-rest-api-client

A Wordpress REST API client for PHP, (*1)

Travis, (*2)

For when you need to make Wordpress REST API calls from some other PHP project, for some reason., (*3)

Installation

This library can be installed with Composer:, (*4)

composer require vnn/wordpress-rest-api-client

The library will require an Http library to run. Guzzle is supported by the library, but you can use any Http library of your choise, so long as your write an adapter for that library., (*5)

To install Guzzle:, (*6)

composer require guzzlehttp/guzzle

Usage

Example:, (*7)

use Vnn\WpApiClient\Auth\WpBasicAuth;
use Vnn\WpApiClient\Http\GuzzleAdapter;
use Vnn\WpApiClient\WpClient;

require 'vendor/autoload.php';

$client = new WpClient(new GuzzleAdapter(new GuzzleHttp\Client()), 'http://yourwordpress.com');
$client->setCredentials(new WpBasicAuth('user', 'securepassword'));

$user = $client->users()->get(2);

print_r($user);

Testing

composer install
vendor/bin/phpunit

The Versions