cyberduck / laravel-wp-api
Laravel package for the Wordpress JSON REST API
Installs: 1 520
Dependents: 0
Suggesters: 0
Security: 0
Stars: 129
Watchers: 20
Forks: 51
Open Issues: 2
Requires
- php: >=5.4.0
- guzzlehttp/guzzle: ~5.0
- illuminate/support: ~5.0|~5.1
This package is not auto-updated.
Last update: 2022-02-01 12:44:06 UTC
README
Laravel 5 package for the Wordpress JSON REST API
Install
Simply add the following line to your composer.json
and run install/update:
"cyberduck/laravel-wp-api": "~1.0"
Configuration
Publish the package config files to configure the location of your Wordpress install:
php artisan vendor:publish
You will also need to add the service provider and optionally the facade alias to your app/config/app.php
:
'providers' => array( 'Cyberduck\LaravelWpApi\LaravelWpApiServiceProvider' ) 'aliases' => array( 'WpApi' => 'Cyberduck\LaravelWpApi\Facades\WpApi' ),
Usage
The package provides a simplified interface to some of the existing api methods documented here. You can either use the Facade provided or inject the WpApi class.
Posts
WpApi::posts($page);
Pages
WpApi::pages($page);
Post
WpApi::post($slug);
Categories
WpApi::categories();
Tags
WpApi::tags();
Category posts
WpApi::category_posts($slug, $page);
Search
WpApi::search($query, $page);
Archive
WpApi::archive($year, $month, $page);