Fork from the deprecated "WP API laravel Lib" - threesquared/laravel-wp-api https://github.com/threesquared/laravel-wp-api.git
Go to file
2015-02-07 13:43:01 +00:00
public First commit 2015-01-28 19:11:56 +00:00
src Update for Laravel 5 2015-02-07 13:43:01 +00:00
tests First commit 2015-01-28 19:11:56 +00:00
.gitignore First commit 2015-01-28 19:11:56 +00:00
.travis.yml First commit 2015-01-28 19:11:56 +00:00
composer.json Update for Laravel 5 2015-02-07 13:43:01 +00:00
LICENSE First commit 2015-01-28 19:11:56 +00:00
phpunit.xml First commit 2015-01-28 19:11:56 +00:00
README.md Update for Laravel 5 2015-02-07 13:43:01 +00:00

laravel-wp-api

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": "dev-master"

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);

WpApi::search($query, $page);

Archive

WpApi::archive($year, $month, $page);