nggiahao / wordpress-rest-api-client
There is no license information available for the latest version (dev-master) of this package.
dev-master
2024-03-26 06:05 UTC
Requires
- php: ^7.4 || ^8.0
- psr/http-message: ^1.0 || ^2.0
Requires (Dev)
- codeception/assert-throws: ^1.0.3
- codeception/specify: ^2.0.0
- codeception/verify: ^2.0
- guzzlehttp/guzzle: ^6.5
- phpspec/prophecy: ^1.17.0
- phpspec/prophecy-phpunit: ^2.0
- phpunit/phpunit: ^9.5
- squizlabs/php_codesniffer: ^3.6
Suggests
- guzzlehttp/guzzle: ^6.5
This package is auto-updated.
Last update: 2024-09-26 07:22:26 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