Download the PHP package maneuver/channel without Composer
On this page you can find all versions of the php package maneuver/channel. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package channel
PHP library for the Wordpress REST API
Currently only supports GET requests.
TABLE OF CONTENTS:
- Installation
- Authentication
- Basic Authentication
- API Token
- OAuth
- Usage
- Posts
- Pages
- Taxonomies & Terms
- Users
- Media
- Custom Post Types
- Slightly more advanced stuff
- Endpoints
- Guzzle
- Custom Classes
- Todo:
Installation
Install via composer:
And include the autoloader:
Happy times. 🤙
Authentication
Basic Authentication
Make sure the Basic Authentication plugin for Wordpress is installed and activated.
(should only be used for development purposes, as stated by the repository)
API Token
Make sure the Rooftop API Authentication plugin is installed and activated.
OAuth
Currently not implemented.
Usage
Posts
Retrieve a list of all posts (where post_type = 'post'):
Retrieve a post by ID:
Using Twig? Fear not:
Pages
Retrieve a list of all pages:
Retrieve a page by ID:
Taxonomies & Terms
Retrieve all existing taxonomies:
Retrieve one taxonomy by slug:
Or retrieve the terms in one call using the 'get' method:
Users
Get all users:
Media
Get all media:
Custom Post Types
When you define a custom post type in your Wordpress installation, make sure you set the option to . This exposes an endpoint in the REST API to retrieve the posts. Read the docs
Then use the general 'get' method:
Slightly more advanced stuff
Endpoints
You can actually call any endpoint using the 'get' method:
Read more about all endpoints in the REST API Handbook
Guzzle
You can pass in more requestOptions for Guzzle:
Read more about the Guzzle RequestOptions here.
Custom Classes
Every call returns an object (or array of objects) extending the '\Maneuver\Models\Base' class. You can define your own classes if needed.
NOTE: Don't extend the '\Maneuver\Models\Base' class directly, you'll lose some functionality.
Todo:
- More support for ACF fields
- Better support for images
- Add WP_Query-like parameters
- OAuth authentication