swancreative/laravel-wp-api

Laravel package for the Wordpress JSON REST API forked from threesquared
2,855 3
Install
composer require swancreative/laravel-wp-api
Latest Version:3.1
PHP:^7.0|^8.0
License:MIT
Last Updated:Feb 2, 2022
Links: GitHub  ·  Packagist
Maintainer: mattjwilding

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:

"mattwilding/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(
  Mattwilding\LaravelWpApi\LaravelWpApiServiceProvider::class
)

'aliases' => array(
  'WpApi' => Mattwilding\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 Mattwilding\LaravelWpApi\WpApi class.

Posts

WpApi::posts($page);

Pages

WpApi::pages($page);

Post

WpApi::post($slug);

WpApi::postId($id);

Categories

WpApi::categories();

Tags

WpApi::tags();

Category posts

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

Author posts

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

Tag posts

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

Search

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

Archive

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

Related Packages

threesquared/laravel-wp-api

Laravel package for the Wordpress JSON REST API

10,349 13
astritzeqiri/laravel-wp-api

Laravel package for the Wordpress JSON REST API

897 0
ejimba/laravel-wp-api

Laravel package for the Wordpress JSON REST API

556 4
pixelpeter/laravel5-woocommerce-api-client

Laravel 5 wrapper for the Woocommerce REST API

105,814 123
divdax/easybill

Laravel Package to use the easybill.de REST API

926 3