PHPackages                             yipeecaiey/wordpress-xmlrpc-client - 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. yipeecaiey/wordpress-xmlrpc-client

ActiveLibrary[API Development](/categories/api)

yipeecaiey/wordpress-xmlrpc-client
==================================

A PHP client for Wordpress websites that closely implement the XML-RPC WordPress API with full test suite built in

3.0(7y ago)113MITPHPPHP &gt;=7.0.0

Since Mar 14Pushed 1y ago2 watchersCompare

[ Source](https://github.com/yipeecaiey/wordpress-xmlrpc-client-multisite)[ Packagist](https://packagist.org/packages/yipeecaiey/wordpress-xmlrpc-client)[ RSS](/packages/yipeecaiey-wordpress-xmlrpc-client/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (6)Versions (16)Used By (0)

Wordpress XML-RPC PHP Client
============================

[](#wordpress-xml-rpc-php-client)

[![Build Status](https://camo.githubusercontent.com/4666b02f07b7e5def1cddc10fd1cdf373f912a114046ffc8165dda03e9496681/68747470733a2f2f7472617669732d63692e6f72672f6c657472756e67686965752f776f726470726573732d786d6c7270632d636c69656e742e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/letrunghieu/wordpress-xmlrpc-client) [![Latest Stable Version](https://camo.githubusercontent.com/8f32539c88f383dcfe7e8c8d53f157acaf13afab3e8882ef7b7cb5d4534a7c41/68747470733a2f2f706f7365722e707567782e6f72672f686965752d6c652f776f726470726573732d786d6c7270632d636c69656e742f762f737461626c652e737667)](https://packagist.org/packages/hieu-le/wordpress-xmlrpc-client) [![Total Downloads](https://camo.githubusercontent.com/793203da2ea5df0105717fd21cab116cddadb654044b35e6b4ee8c6c451abf05/68747470733a2f2f706f7365722e707567782e6f72672f686965752d6c652f776f726470726573732d786d6c7270632d636c69656e742f646f776e6c6f6164732e737667)](https://packagist.org/packages/hieu-le/wordpress-xmlrpc-client) [![Latest Unstable Version](https://camo.githubusercontent.com/638a425febf64ee50bc749e03c5e949e08c98866a1bb0c1bf40dacc42478586f/68747470733a2f2f706f7365722e707567782e6f72672f686965752d6c652f776f726470726573732d786d6c7270632d636c69656e742f762f756e737461626c652e737667)](https://packagist.org/packages/hieu-le/wordpress-xmlrpc-client) [![License](https://camo.githubusercontent.com/0a4a96fa76216c350c5534147f8e592d02468c93a37e561c9af19b88be021c49/68747470733a2f2f706f7365722e707567782e6f72672f686965752d6c652f776f726470726573732d786d6c7270632d636c69656e742f6c6963656e73652e737667)](https://packagist.org/packages/hieu-le/wordpress-xmlrpc-client)

A PHP client for Wordpress websites that closely implement the [XML-RPC WordPress API](http://codex.Wordpress.org/XML-RPC_WordPress_API)

Created by [Hieu Le](http://www.hieule.info)

MIT licensed.

Current version: 2.4.2

All Important Features
----------------------

[](#all-important-features)

- Full test suit built in supporting testing using your own Wordpress site.
- Support error logging to files with Monolog library. Now, erros can be logged in a more felxible way via **error callbacks** (v 2.4.0)
- Support UTF-8 content.
- Closely implement the whole [XML-RPC WordPress API](http://codex.Wordpress.org/XML-RPC_WordPress_API).
- Detail exception will be thrown when errors occurs.
- (v2.2) Support proxy and http authentication.
- (v2.2.1) Allow value of `DateTime` class to be convert correctly to `datetime.iso8601` XML-RPC type,
- (v2.4.0) Support using custom User Agent string beside the default User Agent string.
- (v2.4.0) Support callbacks on **sending** and **error** events

Installation
------------

[](#installation)

You will need [Composer](https://getcomposer.org/) installed on your machine to use this library [Composer](https://getcomposer.org/) now is not required but recommended. Verify that composer is installed by typing this command

```
composer --version
```

Choose one of the following methods to install **Wordpress XML-RPC PHP Client**

### Your project has used composer:

[](#your-project-has-used-composer)

Add this dependency into your `composer.json` file

```
"hieu-le/wordpress-xmlrpc-client":"~2.0"
```

After that, run `composer update` to install this package.

### Your project does not use composer:

[](#your-project-does-not-use-composer)

Clone or download the archive of this package from [github](https://github.com/letrunghieu/Wordpress-xmlrpc-client/releases). Include all files in the `src` directory into your project and start using **Wordpress XML-RPC Client**. You have to update the code of this library manually if using it without Composer.

Required PHP extension is `xmlrpc` extension. The `curl` extension is optional but recommended.

Usage
-----

[](#usage)

All API call will be executed via an instance of the `WordpressClient` class. Since version 2.4.0, there is no mandatory parameters in the contructor. `endPoint`, `username`, and `password` can be updated anytime by calling `setCredentials` method. The last parameter in previous version contructor (which is an instance of `\Illuminate\Log\Writer` class) is deprecated and will be removed in the next major release. Below is an example of using this library:

```
# Your Wordpress website is at: http://wp-website.com
$endpoint = "http://wp-website.com/xmlrpc.php";

# The Monolog logger instance
$wpLog = new Monolog\Logger('wp-xmlrpc');

# Create client instance
$wpClient = new \HieuLe\WordpressXmlrpcClient\WordpressClient();
# Log error
$wpClient->onError(function($error, $event) use ($wpLog){
    $wpLog->addError($error, $event);
});

# Set the credentials for the next requests
$wpClient->setCredentials($endpoint, 'username', 'password');
```

If you have used logging feture of previous version of this library, you should update your code to use the new way of loggin as above, the Monolog instance can be replaced by any kinds of logging tool that you have.

To use date time value, you must use an instance of `DateTime` class instead of a string.

There will be 2 types of exception may be thrown from this library:

- `XmlrpcException`: this kind of exception will be thrown if there is an error when the server executing your request
- `NetworkException`: this kind of exception will be thrown if there is an error when transfer your request to server or when getting the response.

For API reference, visit [Wordpress documentation](http://codex.Wordpress.org/XML-RPC_WordPress_API) or [Library API documentation](http://letrunghieu.github.io/wordpress-xmlrpc-client/api/index.html)

User Agent (since 2.4.0)
------------------------

[](#user-agent-since-240)

The library use the default User Agent when contacting with Wordpress blogs. If you want to use onother one, pass your custom User Agent string into the `setUserAgent` method. If you passed a *falsy* value (`null`, `false`, ...) the default one will be used (thank @WarrenMoore)

Callbacks and events (since 2.4.0)
----------------------------------

[](#callbacks-and-events-since-240)

The library allow developers to listen on two events `Sending` and `Error`. You can add new closure as a callback for each events by calling `on` method with the closure as parameter (see the `onError` example above).

### `onSending($event)`

[](#onsendingevent)

This event is fired before each request is send to Wordpress blogs. `$event` is an array:

- `event`: the name of the event, here is `sending`
- `endpoint`: URL of the current endpoint
- `username`: current username
- `password`: current password
- `method`: current XML-RPC method
- `params`: parameters passed to the current method
- `request`: the body of the current request which will be sent
- `proxy`: current proxy config
- `auth`: current http auth config

### `onError($errorMessage, $event)`

[](#onerrorerrormessage-event)

This event is fired when the library run into errors, before any exception thrown. `$errorMessage` is a string. `$event` is an array:

- `event`: the name of the event, here is `sending`
- `endpoint`: URL of the current endpoint
- `request`: the body of the current request
- `proxy`: current proxy config
- `auth`: current http auth config

Unit testing
------------

[](#unit-testing)

By default, the project use recorded data as the default data for test suite. However, if you want to test with your own Wordpress installation, there are available options inside the `./tests/xmlrpc.yml` file:

- `endpoint`: the url of your Wordpress XML-RPC endpoint
- `admin_login`: the email or username of a user with the *Administrator* role
- `admin_password`: the password of the admin user
- `guest_login`: the email or username of a user with the *Subscriber* role
- `guest_password`: the password of the guest user

After update the `./tests/xmlrpc.yml` file, run your test again.

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance29

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity66

Established project with proven stability

 Bus Factor1

Top contributor holds 83.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 ~175 days

Recently: every ~471 days

Total

15

Last Release

1982d ago

Major Versions

1.0 → 2.02014-04-18

2.5.0 → 3.02018-06-16

1.2 → 2.6.02020-12-03

PHP version history (2 changes)1.0PHP &gt;=5.3.0

3.0PHP &gt;=7.0.0

### Community

Maintainers

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

---

Top Contributors

[![letrunghieu](https://avatars.githubusercontent.com/u/1145335?v=4)](https://github.com/letrunghieu "letrunghieu (134 commits)")[![yipeecaiey](https://avatars.githubusercontent.com/u/215854?v=4)](https://github.com/yipeecaiey "yipeecaiey (22 commits)")[![Abdukhaligov](https://avatars.githubusercontent.com/u/23464168?v=4)](https://github.com/Abdukhaligov "Abdukhaligov (2 commits)")[![khanhicetea](https://avatars.githubusercontent.com/u/4528223?v=4)](https://github.com/khanhicetea "khanhicetea (1 commits)")[![lracicot](https://avatars.githubusercontent.com/u/362115?v=4)](https://github.com/lracicot "lracicot (1 commits)")[![mohit7610](https://avatars.githubusercontent.com/u/72218213?v=4)](https://github.com/mohit7610 "mohit7610 (1 commits)")

---

Tags

apiclientwordpressremotemultisitexmlrpc

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/yipeecaiey-wordpress-xmlrpc-client/health.svg)

```
[![Health](https://phpackages.com/badges/yipeecaiey-wordpress-xmlrpc-client/health.svg)](https://phpackages.com/packages/yipeecaiey-wordpress-xmlrpc-client)
```

###  Alternatives

[hieu-le/wordpress-xmlrpc-client

A PHP client for Wordpress websites that closely implement the XML-RPC WordPress API with full test suite built in

118158.5k2](/packages/hieu-le-wordpress-xmlrpc-client)[deepseek-php/deepseek-php-client

deepseek PHP client is a robust and community-driven PHP client library for seamless integration with the Deepseek API, offering efficient access to advanced AI and data processing capabilities.

47073.9k5](/packages/deepseek-php-deepseek-php-client)[skeeks/yii2-google-api

Component for work with google api based on google/apiclient

1243.1k1](/packages/skeeks-yii2-google-api)

PHPackages © 2026

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