nunocodex/wpapi

WordPress API Library

v1.3.0 2018-05-09 23:38 UTC

This package is not auto-updated.

Last update: 2024-09-29 04:37:15 UTC


README

This is library for access to WordPress API websites easy.

Installation

You can simply install with composer:

composer require nunocodex/wpapi

Readme is working progress

// GuzzleHttp options
$wpapiClientOptions = [
    'base_uri' => 'http://example.com/',
    'verify' => false,
    'auth' => [ 'user', 'pass' ]
];

// It's a GuzzleHttp extended class so you can bind
// the client with WpApiClientInterface for no change
// anything in this code.
$wpapiClient = new WpApiClient($wpapiClientOptions);

// WpApi object
$wpapi = new WpApi($wpapiClient);

$posts = $wpapi->posts()->embed()->filter([ 'order' => 'asc' ])->pagination(10)->get();