Skip to content

obsnomad/laravel-wp-api

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

laravel-wp-api

Build Status Latest Stable Version

Laravel 5 package for the Wordpress JSON REST API

Install

Simply add the following line to your composer.json and run install/update:

"threesquared/laravel-wp-api": "~2.0"

Configuration

You will need to add the service provider and optionally the facade alias to your config/app.php:

'providers' => array(
  Threesquared\LaravelWpApi\LaravelWpApiServiceProvider::class
)

'aliases' => array(
  'WpApi' => Threesquared\LaravelWpApi\Facades\WpApi::class
),

And publish the package config files to configure the location of your Wordpress install:

php artisan vendor:publish

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 Threesquared\LaravelWpApi\WpApi class. The amount of items per page can be set as 'per_page' config parameter, a forth parameter of class constructor or as a parameter of class methods.

Posts

WpApi::posts($page, $per_page);

Pages

WpApi::pages($page, $per_page);

Post

WpApi::post($slug);

Categories

WpApi::categories();

Tags

WpApi::tags();

Category posts

WpApi::categoryPosts($slug, $page, $per_page);

Author posts

WpApi::authorPosts($slug, $page, $per_page);

Tag posts

WpApi::tagPosts($slug, $page, $per_page);

Search

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

Archive

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

About

Laravel package for the Wordpress JSON REST API

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%