PHPackages                             hstanleycrow/easyphptowordpress - 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. hstanleycrow/easyphptowordpress

ActiveLibrary[API Development](/categories/api)

hstanleycrow/easyphptowordpress
===============================

Free PHP Library to post from PHP to Wordpress

11PHP

Since May 3Pushed 3y ago1 watchersCompare

[ Source](https://github.com/hstanleycrow/EasyPHPToWordpress)[ Packagist](https://packagist.org/packages/hstanleycrow/easyphptowordpress)[ RSS](/packages/hstanleycrow-easyphptowordpress/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

 Easy PHP To Wordpress

==========================

[](#----easy-php-to-wordpress--)

#### Free PHP Library to post from PHP to Wordpress

[](#free-php-library-to-post-from-php-to-wordpress)

 [Key Features](#key-features) • [How To Use](#how-to-use) • [Download](#download) • [Credits](#credits) • [License](#license)

Key Features
------------

[](#key-features)

- Get Categories - Get a list of categories from Worpress site
- Get Tags - Get a list of tags from Worpress site
- Publish HTML content, including:
    - Featured Image
    - Category
    - Status: publish, draft, pending, etc
    - all images are uploaded to wordpress and the image URL is replaced by the Wordpress URL
    - You can include Youtube videos in the content
    - You can include Tweets in the content
- Wordpress URL Validator
- Wordpress credentials (user and application password) validator
- Easily handle errors

How To Use
----------

[](#how-to-use)

```
# Clone this repository
$ git clone https://github.com/hstanleycrow/EasyPHPToWordpress/

# install libraries
$ composer update

# or install using composer

$ composer require hstanleycrow/easyphptowordpress
```

```
# define credentials
# You need a Wordpress application password https://make.wordpress.org/core/2020/11/05/application-passwords-integration-guide/
#This examples are using [DotEnv](https://github.com/vlucas/phpdotenv) to configure the credentials, but you can setup it as you want.
$wpSiteURL = $_ENV["WP_SITE_URL"];
$wpUsername = $_ENV["WP_USERNAME"];
$wpApplicationPassword = $_ENV["WP_APPLICATION_PASSWORD"];

# configure in your PHP script the timezone to the Wordpress timezone. This is important.
date_default_timezone_set("America/El_Salvador");

# create an object
$obj = new WordpressAPI($wpSiteURL, $wpUsername, $wpApplicationPassword);
```

### Examples

[](#examples)

```
#Example to validate the URL

if ($obj->validateURL()) :
    echo "URL resolve 200";
else :
    echo $obj->errorMessage();
endif;

#Example how to get Wordpress Categories list

echo "";
if ($categories = $obj->categories()) :
    print_r($categories);
else :
    echo $obj->errorMessage();
endif;
echo "";

#Example how to get Wordpress Tags list

echo "";
if ($tags = $obj->tags()) :
    print_r($tags);
else :
    echo $obj->errorMessage();
endif;
echo "";

#Example how to validate credentials

echo "";
if ($obj->validateCredentials()) :
    echo "Valid Credentials" . PHP_EOL;
else :
    echo "Credentials not valid" . PHP_EOL;
    echo $obj->errorMessage() . PHP_EOL;
endif;
echo "";

#Example to publish into WP
$content = publishPost(
    "Title of the post",
    $content,
    $categories,
    $featureImagePath
)) :
    echo $url . PHP_EOL;
    if ($obj->hasImagesErrors()) :
        print_r($obj->imagesError());
    endif;
else :
    #echo "Credentials not valid" . PHP_EOL;
    echo $obj->errorMessage() . PHP_EOL;
endif;
echo "";
```

Limitations
-----------

[](#limitations)

- For now, you can't add tags to the post but it is considered for future versions.

Download
--------

[](#download)

You can [download](https://github.com/hstanleycrow/EasyPHPToWordpress/) the latest version here.

PHP Versions
------------

[](#php-versions)

I have tested this class only in this PHP versions. So, if you have an older version and do not work, let me know.

PHP VersionPHP 8.0PHP 8.1PHP 8.2Credits
-------

[](#credits)

This software uses the following open source packages:

- [PHP Simple HTML DOM Parser](https://simplehtmldom.sourceforge.io/docs/1.9/index.html)

Support
-------

[](#support)

[![Buy Me A Coffee](https://camo.githubusercontent.com/b32d80c4bde7464703f7dcbb8dd24902a7b2de6b0f52a872563f87293d4eb87a/68747470733a2f2f7777772e6275796d6561636f666665652e636f6d2f6173736574732f696d672f637573746f6d5f696d616765732f707572706c655f696d672e706e67)](https://www.buymeacoffee.com/haroldcrow)

License
-------

[](#license)

MIT

---

> [www.hablemosdeseo.net](https://www.hablemosdeseo.net) · GitHub [@hstanleycrow](https://github.com/hstanleycrow) · Twitter [@harold\_crow](https://twitter.com/harold_crow)

###  Health Score

14

—

LowBetter than 2% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity22

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/713da77764977a76a357f6b34361a7ab51bd55ea847b84112e3a38f5496af173?d=identicon)[hstanleycrow](/maintainers/hstanleycrow)

---

Top Contributors

[![hstanleycrow](https://avatars.githubusercontent.com/u/7930763?v=4)](https://github.com/hstanleycrow "hstanleycrow (8 commits)")

---

Tags

phpphp8wordpresswordpress-api

### Embed Badge

![Health badge](/badges/hstanleycrow-easyphptowordpress/health.svg)

```
[![Health](https://phpackages.com/badges/hstanleycrow-easyphptowordpress/health.svg)](https://phpackages.com/packages/hstanleycrow-easyphptowordpress)
```

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M480](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M272](/packages/twilio-sdk)[knplabs/github-api

GitHub API v3 client

2.2k15.8M187](/packages/knplabs-github-api)[facebook/php-business-sdk

PHP SDK for Facebook Business

90121.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

73813.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

263103.1M454](/packages/google-gax)

PHPackages © 2026

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