Laravel package for the Wordpress JSON REST API
Laravel 5 package for the Wordpress JSON REST API
Simply add the following line to your
composer.jsonand run install/update:
"cyberduck/laravel-wp-api": "~1.0"
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' ),
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.
WpApi::posts($page);
WpApi::pages($page);
WpApi::post($slug);
WpApi::categories();
WpApi::tags();
WpApi::category_posts($slug, $page);
WpApi::search($query, $page);
WpApi::archive($year, $month, $page);