PHPackages                             mam4dali/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. mam4dali/laravel-wp-api

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

mam4dali/laravel-wp-api
=======================

Laravel package for the Wordpress JSON REST API

4.0.6(5y ago)09MITPHPPHP ^7.4|^8.0

Since Jul 7Pushed 3y agoCompare

[ Source](https://github.com/mam4dali/laravel-wp-api)[ Packagist](https://packagist.org/packages/mam4dali/laravel-wp-api)[ RSS](/packages/mam4dali-laravel-wp-api/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (3)Versions (22)Used By (0)

This is a fork of threesquared/laravel-wp-api

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

[](#laravel-wp-api)

Laravel 9 package for the [Wordpress JSON REST API](https://github.com/WP-API/WP-API)

Install
-------

[](#install)

Run: `composer require mam4dali/laravel-wp-api`

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

[](#configuration)

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

```
'providers' => array(

mam4dali\LaravelWpApi\ServiceProvider::class

)

'aliases' => Facade::defaultAliases()->merge([

'WpApi' => mam4dali\LaravelWpApi\Facade::class,

])->toArray(),
```

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

php artisan vendor:publish

### Usage

[](#usage)

You need to install the following plugin in WordPress:

Example:

```
$wp_api = new WpApi('http://localhost/wp/wp-json/wp/v2/', new \GuzzleHttp\Client(), null);

$jwt_token = $wp_api->jwtTokenGenerate('username', 'password');

$wp_api->SetJwtToken($jwt_token['token']);

$get_post = $wp_api->postId(1);
```

\*\*Important: No need to continuously generate tokens. Each token can work up to 7 days. you can save token for 7 days

\*\*

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 `AstritZeqiri\LaravelWpApi\WpApi` class.

#### Posts

[](#posts)

```
$wp_api->posts($page);

```

#### Pages

[](#pages)

```
$wp_api->pages($page);

```

#### Post

[](#post)

```
$wp_api->post($slug);

```

```
$wp_api->postId($id);

```

#### Categories

[](#categories)

```
$wp_api->categories();

```

#### Tags

[](#tags)

```
$wp_api->tags();

```

#### Category posts

[](#category-posts)

```
$wp_api->categoryPosts($slug, $page);

```

#### Author posts

[](#author-posts)

```
$wp_api->authorPosts($slug, $page);

```

#### Tag posts

[](#tag-posts)

```
$wp_api->tagPosts($slug, $page);

```

#### Search

[](#search)

```
$wp_api->search($query, $page);

```

#### Archive

[](#archive)

```
$wp_api->archive($year, $month, $page);

```

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity77

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

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 ~104 days

Recently: every ~0 days

Total

21

Last Release

1873d ago

Major Versions

1.1.0 → 2.02016-01-22

2.1.3 → 3.0.02017-06-02

3.0.5 → 4.0.02021-03-24

PHP version history (3 changes)1.0.0PHP &gt;=5.4.0

2.1.0PHP &gt;=5.5.0

4.0.0PHP ^7.4|^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/90089dd97cad849f33b44ecc17d6fa999f986e96c8a62526d47e01b8736c3331?d=identicon)[mam4dali](/maintainers/mam4dali)

---

Top Contributors

[![mam4dali](https://avatars.githubusercontent.com/u/13052531?v=4)](https://github.com/mam4dali "mam4dali (16 commits)")[![jwatkin423](https://avatars.githubusercontent.com/u/7553398?v=4)](https://github.com/jwatkin423 "jwatkin423 (8 commits)")[![threesquared](https://avatars.githubusercontent.com/u/892142?v=4)](https://github.com/threesquared "threesquared (7 commits)")[![astritzeqiri](https://avatars.githubusercontent.com/u/8720176?v=4)](https://github.com/astritzeqiri "astritzeqiri (6 commits)")[![AndrewFeeney](https://avatars.githubusercontent.com/u/13425337?v=4)](https://github.com/AndrewFeeney "AndrewFeeney (1 commits)")[![rafaelcneves](https://avatars.githubusercontent.com/u/421754?v=4)](https://github.com/rafaelcneves "rafaelcneves (1 commits)")[![yousan](https://avatars.githubusercontent.com/u/561613?v=4)](https://github.com/yousan "yousan (1 commits)")

---

Tags

apilaravelwordpressrestpackage

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[threesquared/laravel-wp-api

Laravel package for the Wordpress JSON REST API

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

Laravel 5 wrapper for the Woocommerce REST API

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

API Platform support for Laravel

59126.4k6](/packages/api-platform-laravel)[cybercog/youtrack-rest-php

YouTrack REST API PHP Client.

37149.2k3](/packages/cybercog-youtrack-rest-php)[illuminatech/data-provider

Allows easy build for DB queries from API requests

4413.3k](/packages/illuminatech-data-provider)[dreamfactory/df-core

DreamFactory(tm) Core Components

1651.7k20](/packages/dreamfactory-df-core)

PHPackages © 2026

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