Skip to content

mauthi/wordpress-rest-api-client

 
 

Repository files navigation

wordpress-rest-api-client

A Wordpress REST API client for Laravel

Travis

For when you need to make Wordpress REST API calls from some other Laravel PHP project, for some reason.

Installation

This library can be installed with Composer:

composer require vnn/wordpress-rest-api-client

You need to set your wordpress url in your environment:

WP_REST_API_URL=http://yourwordpress.com

Authentication

For JWT authentication you need the following plugin enabeld in your wordpress installation: Plugin

If you get Authorization header was not found. you should try the following.

Usage

Example:

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

require 'vendor/autoload.php';

$client = new WpClient();

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

print_r($user);

Testing

composer install
vendor/bin/phpunit

About

A Wordpress API client for PHP

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%