vnn / wordpress-rest-api-client
Installs: 184 086
Dependents: 2
Suggesters: 0
Security: 0
Stars: 76
Watchers: 13
Forks: 65
Open Issues: 20
Requires
- php: ^7.0
- psr/http-message: ^1.0
Requires (Dev)
- guzzlehttp/guzzle: ^6.2
- peridot-php/leo: ^1.5
- peridot-php/peridot: ^1.18
- peridot-php/peridot-prophecy-plugin: ^1.1
- squizlabs/php_codesniffer: ^2.7
Suggests
- guzzlehttp/guzzle: ^6.2
This package is auto-updated.
Last update: 2024-11-20 01:04:51 UTC
README
A Wordpress REST API client for PHP
For when you need to make Wordpress REST API calls from some other PHP project, for some reason.
Installation
This library can be installed with Composer:
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.
To install Guzzle:
composer require guzzlehttp/guzzle
Usage
Example:
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