PHPackages                             madeitbelgium/wordpress-php-sdk - 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. [API Development](/categories/api)
4. /
5. madeitbelgium/wordpress-php-sdk

ActiveLibrary[API Development](/categories/api)

madeitbelgium/wordpress-php-sdk
===============================

WordPress Laravel PHP SDK

1.7.0(1y ago)4422.9k↓19%8[1 issues](https://github.com/madeITBelgium/WordPress-PHP-SDK/issues)1LGPL-3.0-or-laterPHPPHP &gt;=5.6CI failing

Since Mar 23Pushed 1y ago1 watchersCompare

[ Source](https://github.com/madeITBelgium/WordPress-PHP-SDK)[ Packagist](https://packagist.org/packages/madeitbelgium/wordpress-php-sdk)[ Docs](https://www.madeit.be)[ GitHub Sponsors](https://github.com/madeitbelgium)[ RSS](/packages/madeitbelgium-wordpress-php-sdk/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (8)Versions (12)Used By (1)

WordPress API PHP SDK
=====================

[](#wordpress-api-php-sdk)

[![Build Status](https://camo.githubusercontent.com/289c86f44e805fe11ead21cedc35fa1b0d639633f1ae8607a962a6397e312c35/68747470733a2f2f7472617669732d63692e6f72672f6d616465495442656c6769756d2f576f726450726573732d5048502d53444b2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/madeITBelgium/WordPress-PHP-SDK)[![Coverage Status](https://camo.githubusercontent.com/1b920d651e547943226a6495c8fea2b6920b2ec37af5887dde724f0bb17db1b8/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f6d616465495442656c6769756d2f576f726450726573732d5048502d53444b2f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/madeITBelgium/WordPress-PHP-SDK?branch=master)[![Latest Stable Version](https://camo.githubusercontent.com/3cfb2a6ca1e3ee56a46c4fa3eb2f5cc048ceb0ca788f4d79d0476f3e9daddc38/68747470733a2f2f706f7365722e707567782e6f72672f6d616465495442656c6769756d2f576f726450726573732d5048502d53444b2f762f737461626c652e737667)](https://packagist.org/packages/madeITBelgium/WordPress-PHP-SDK)[![Latest Unstable Version](https://camo.githubusercontent.com/bd090cd38cbcea5d01b65c80fb39a8b348d5d5ff51fbeac69d0b97540c22853a/68747470733a2f2f706f7365722e707567782e6f72672f6d616465495442656c6769756d2f576f726450726573732d5048502d53444b2f762f756e737461626c652e737667)](https://packagist.org/packages/madeITBelgium/WordPress-PHP-SDK)[![Total Downloads](https://camo.githubusercontent.com/5c8d1be07f121dfe622e085cbef1310e8be491e473e16cd4b1386b44bd495909/68747470733a2f2f706f7365722e707567782e6f72672f6d616465495442656c6769756d2f576f726450726573732d5048502d53444b2f642f746f74616c2e737667)](https://packagist.org/packages/madeITBelgium/WordPress-PHP-SDK)[![License](https://camo.githubusercontent.com/0ca2ecb91746dec557db944abc141b5fd5ab208ea8bc549d5921ca94574d1d9e/68747470733a2f2f706f7365722e707567782e6f72672f6d616465495442656c6769756d2f576f726450726573732d5048502d53444b2f6c6963656e73652e737667)](https://packagist.org/packages/madeITBelgium/WordPress-PHP-SDK)

Installation
============

[](#installation)

Require this package in your `composer.json` and update composer.

```
composer require madeitbelgium/wordpress-php-sdk
```

After updating composer, add the ServiceProvider to the providers array in `config/app.php`

```
MadeITBelgium\WordPress\WordPressServiceProvider::class,
```

You can use the facade for shorter code. Add this to your aliases:

```
'WP' => MadeITBelgium\WordPress\WordPressFacade::class,
```

Add the config files

```
php artisan vendor:publish --provider="MadeITBelgium\WordPress\WordPressServiceProvider"
```

Documentation
=============

[](#documentation)

Authentication
--------------

[](#authentication)

To use authenticated requests you have to sign in to the WordPress website to generate a JWT token. WordPress doesn't support this by default, you have to install a JWT compatible plugin. This package is tested with:

```
use MadeITBelgium\WordPress\WordPressFacade as WordPress;
$token = WordPress::login($request->get('email'), $request->get('password'));
// {'token': '...'}
```

Now you can save the `$token->token` to your database.

```
use MadeITBelgium\WordPress\WordPressFacade as WordPress;
WordPress::setAccessToken($token);

```

### Application Password

[](#application-password)

You can use the newly introduced Application Password (in WordPress 5.6).

```
$wp = WordPress::setServer('https://www.example.com')
    ->setUsername('username')
    ->setApplicationPassword('application password');

```

Interact with objects
---------------------

[](#interact-with-objects)

### User

[](#user)

WordPress Rest API documentation:

```
use MadeITBelgium\WordPress\WordPressFacade as WordPress;
$users = WordPress::user()->list();
$result = WordPress::user()->create($data);
$user = WordPress::user()->get($id);
$result = WordPress::user()->update($id, $data);
$result = WordPress::user()->delete($id);

```

### Post

[](#post)

WordPress Rest API documentation:

```
use MadeITBelgium\WordPress\WordPressFacade as WordPress;
$users = WordPress::post()->list();
$result = WordPress::post()->create($data);
$user = WordPress::post()->get($id);
$result = WordPress::post()->update($id, $data);
$result = WordPress::post()->delete($id);

```

### Post from custom post type

[](#post-from-custom-post-type)

WordPress Rest API documentation:

```
use MadeITBelgium\WordPress\WordPressFacade as WordPress;
$users = WordPress::customPost('custom_post_type')->list();
$result = WordPress::customPost('custom_post_type')->create($data);
$user = WordPress::customPost('custom_post_type')->get($id);
$result = WordPress::customPost('custom_post_type')->update($id, $data);
$result = WordPress::customPost('custom_post_type')->delete($id);

```

### Tags

[](#tags)

WordPress Rest API documentation:

```
use MadeITBelgium\WordPress\WordPressFacade as WordPress;
$users = WordPress::tag()->list();
$result = WordPress::tag()->create($data);
$user = WordPress::tag()->get($id);
$result = WordPress::tag()->update($id, $data);
$result = WordPress::tag()->delete($id);

```

### Create new post

[](#create-new-post)

```
$data = [
    'title' => 'title',
    'parent' => 0,
    'slug' => Str::slug('title', '-'),
    'content' => 'content',
];
$post = WordPress::post()->create($data);
// {'id': ...}

```

### Uploading media

[](#uploading-media)

```
use Illuminate\Support\Facades\Storage;
use MadeITBelgium\WordPress\WordPressFacade as WordPress;

$media = WordPress::postCall('/wp-json/wp/v2/media', [
    'multipart' => [
        [
            'name' => 'file',
            'contents' => Storage::disk('local')->get($fileLocation),
            'filename' => 'filename.jpg',
        ],
        [
            'name' => 'title',
            'contents' => 'Title of attachment',
        ],
        [
            'name' => 'alt_text',
            'contents' => 'Alt text',
        ],
    ],
]);

```

Execute any request
-------------------

[](#execute-any-request)

Read more about the WordPress rest API:

### Get

[](#get)

```
$url = "";
$result = WordPress::getCall('/wp-json'.$url);

```

### Put

[](#put)

```
$result = WordPress::putCall('/wp-json'.$url, $data);

```

### Post

[](#post-1)

```
$result = WordPress::postCall('/wp-json'.$url, $data);

```

### Delete

[](#delete)

```
$result = WordPress::deleteCall('/wp-json'.$url);

```

The complete documentation can be found at:

Support
=======

[](#support)

Support github or mail:

Contributing
============

[](#contributing)

Please try to follow the psr-2 coding style guide.

License
=======

[](#license)

This package is licensed under LGPL. You are free to use it in personal and commercial projects. The code can be forked and modified, but the original copyright author should always be included!

###  Health Score

44

—

FairBetter than 92% of packages

Maintenance48

Moderate activity, may be stable

Popularity40

Moderate usage in the ecosystem

Community16

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 95.2% 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 ~187 days

Total

11

Last Release

378d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/e3d01bc996f789c6362a12e51af7b19ad39ca580f77dc6ef4ff1754888391508?d=identicon)[MadeITBelgium](/maintainers/MadeITBelgium)

---

Top Contributors

[![madeITBelgium](https://avatars.githubusercontent.com/u/20304892?v=4)](https://github.com/madeITBelgium "madeITBelgium (40 commits)")[![marcodefelice](https://avatars.githubusercontent.com/u/10652966?v=4)](https://github.com/marcodefelice "marcodefelice (1 commits)")[![omaratpxt](https://avatars.githubusercontent.com/u/3249754?v=4)](https://github.com/omaratpxt "omaratpxt (1 commits)")

---

Tags

hacktoberfestlaravelphpphplaravelwordpress

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/madeitbelgium-wordpress-php-sdk/health.svg)

```
[![Health](https://phpackages.com/badges/madeitbelgium-wordpress-php-sdk/health.svg)](https://phpackages.com/packages/madeitbelgium-wordpress-php-sdk)
```

###  Alternatives

[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9682.1M97](/packages/roots-acorn)[josiasmontag/laravel-recaptchav3

Recaptcha V3 for Laravel package

2641.6M2](/packages/josiasmontag-laravel-recaptchav3)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)[dariusiii/tmdb-laravel

Laravel Package for TMDB ( The Movie Database ) API. Provides easy access to the wtfzdotnet/php-tmdb-api library.

1821.1k](/packages/dariusiii-tmdb-laravel)[gufy/whmcs

WHMCS API for Laravel 5

201.7k](/packages/gufy-whmcs)

PHPackages © 2026

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