PHPackages                             mainstreamct/laravel-wp-api - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [HTTP &amp; Networking](/categories/http)
4. /
5. mainstreamct/laravel-wp-api

ActiveLibrary[HTTP &amp; Networking](/categories/http)

mainstreamct/laravel-wp-api
===========================

Laravel package for the Wordpress JSON REST API forked from threesquared then forked from mattwilding, adding support for WP Multisite configs.

2.2.1(4y ago)0241MITPHPPHP ^7.0

Since May 31Pushed 4y agoCompare

[ Source](https://github.com/MainstreamCT/laravel-wp-api)[ Packagist](https://packagist.org/packages/mainstreamct/laravel-wp-api)[ RSS](/packages/mainstreamct-laravel-wp-api/feed)WikiDiscussions master Synced yesterday

READMEChangelog (1)Dependencies (2)Versions (13)Used By (0)

laravel-wp-api
==============

[](#laravel-wp-api)

[![Latest Stable Version](https://camo.githubusercontent.com/2e047833b7d132b7f43c20f4faaba12b01efb53ca80f1dee5026b28bbf836a15/68747470733a2f2f706f7365722e707567782e6f72672f7468726565737175617265642f6c61726176656c2d77702d6170692f762f737461626c65)](https://packagist.org/packages/mainstreamct/laravel-wp-api)

*Forked originally from [mattwilding/laravel-wp-api](https://github.com/mattwilding/laravel-wp-api)*

Laravel 6+ package for the [Wordpress JSON REST API](https://github.com/WP-API/WP-API), with support for MultiSite tenant management automation. Uses [multisite-json-api](https://github.com/remkade/multisite-json-api) on the WordPress side of things.

Install
-------

[](#install)

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

```
"mainstreamct/laravel-wp-api": "~2.0"

```

Configuration
-------------

[](#configuration)

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

```
'providers' => array(
  MainstreamCT\WordPressAPI\WordPressAPIServiceProvider::class
)

'aliases' => array(
  'WordPressAPI' => MainstreamCT\WordPressAPI\Facades\WordPressAPI::class
),
```

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

```
php artisan vendor:publish

```

Provide the following in your `.env` file:

```
  WP_API_ENDPOINT=your_site_name
  WP_API_USERNAME=your_site_admin_username
  WP_API_PASSWORD=your_site_admin_password
```

Don't forget to re-cache your configuration!

```
php artisan config:cache

```

Usage
-----

[](#usage)

The package provides a simplified interface to some of the existing api methods documented [here](http://wp-api.org/). You can either use the Facade provided or inject the `MainstreamCT\WordPressAPI\WordPressAPI` class.

### Getters

[](#getters)

#### Posts

[](#posts)

```
WordPressAPI::getPosts($page);
```

#### Pages

[](#pages)

```
WordPressAPI::getPages($page);
```

#### Post

[](#post)

```
WordPressAPI::getPostBySlug($slug);
```

```
WordPressAPI::getPostByID($id);
```

#### Categories

[](#categories)

```
WordPressAPI::getCategories();
```

#### Tags

[](#tags)

```
WordPressAPI::getTags();
```

#### Category posts

[](#category-posts)

```
WordPressAPI::getPostsByCategory($slug, $page);
```

#### Author posts

[](#author-posts)

```
WordPressAPI::getPostsByAuthor($slug, $page);
```

#### Tag posts

[](#tag-posts)

```
WordPressAPI::getPostsByTags($tags, $page);
```

#### Search

[](#search)

```
WordPressAPI::searchPosts($query, $page);
```

#### Archive

[](#archive)

```
WordPressAPI::getPostsByDate($year, $month, $page);
```

### Other methods

[](#other-methods)

#### Deploy Multisite tenant

[](#deploy-multisite-tenant)

```
WordPressAPI::deploy($site_name, $blog_title, $email, $password);
```

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 61.1% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~137 days

Recently: every ~151 days

Total

12

Last Release

1760d ago

Major Versions

1.4 → 2.02021-03-10

PHP version history (2 changes)1.0.0PHP &gt;=5.5.0

1.4PHP ^7.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/5104d3b090447f16e8f3bb356823286c1bf67cec55d4be4c7217f7cfd26490b6?d=identicon)[mainstreamct](/maintainers/mainstreamct)

---

Top Contributors

[![mattwilding](https://avatars.githubusercontent.com/u/4983089?v=4)](https://github.com/mattwilding "mattwilding (11 commits)")[![layetri](https://avatars.githubusercontent.com/u/8854301?v=4)](https://github.com/layetri "layetri (5 commits)")[![swancreative](https://avatars.githubusercontent.com/u/33896081?v=4)](https://github.com/swancreative "swancreative (2 commits)")

---

Tags

laravelmainstreamctwordpressapilaravelwordpressrestpackage

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/mainstreamct-laravel-wp-api/health.svg)

```
[![Health](https://phpackages.com/badges/mainstreamct-laravel-wp-api/health.svg)](https://phpackages.com/packages/mainstreamct-laravel-wp-api)
```

###  Alternatives

[pixelpeter/laravel5-woocommerce-api-client

Laravel 5 wrapper for the Woocommerce REST API

125103.4k](/packages/pixelpeter-laravel5-woocommerce-api-client)[threesquared/laravel-wp-api

Laravel package for the Wordpress JSON REST API

1310.3k](/packages/threesquared-laravel-wp-api)[cybercog/youtrack-rest-php

YouTrack REST API PHP Client.

37149.2k3](/packages/cybercog-youtrack-rest-php)[dreamfactory/df-core

DreamFactory(tm) Core Components

1651.7k20](/packages/dreamfactory-df-core)[laragear/api-manager

Manage multiple REST servers to make requests in few lines and fluently.

161.8k](/packages/laragear-api-manager)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
