PHPackages                             williamsdb/php2micropost - 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. williamsdb/php2micropost

ActiveLibrary

williamsdb/php2micropost
========================

A library that makes posting to Wordpress Microposts from PHP simple.

v1.0.1(1mo ago)01↑2900%GPL-3.0-or-laterPHPPHP ^8.0

Since Mar 21Pushed 1mo agoCompare

[ Source](https://github.com/williamsdb/php2Micropost)[ Packagist](https://packagist.org/packages/williamsdb/php2micropost)[ Docs](https://spokenlikeageek.com/microposts)[ RSS](/packages/williamsdb-php2micropost/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (2)Used By (0)

### php2Micropost

[](#php2micropost)

 A simple library that allows posting to WordPress Microposts via the API.

 Table of Contents1. [About The Project](#about-the-project)
    - [Built With](#built-with)
2. [Getting Started](#getting-started)
    - [Prerequisites](#prerequisites)
    - [Installation](#installation)
3. [Usage](#usage)
4. [Roadmap](#roadmap)
5. [Contributing](#contributing)
6. [License](#license)
7. [Contact](#contact)
8. [Acknowledgments](#acknowledgments)

About The Project
-----------------

[](#about-the-project)

I have accounts on plenty of microblogging sites (Twitter, Mastodon, Bluesky and even Threads) but they are all owned and controlled by someone else. I decided that I wanted something that I could use and manage, and a quick search came up with [Michael Gbadebo](https://mothcloud.com/introducing-microposts-microblogging-for-wordpress/)'s WordPress plugin called [Microposts](https://wordpress.org/plugins/microposts/).

I installed this and after playing around for a while, I decided that it was just what I was looking for. However, it was quite cumbersome to make a post from a mobile device when I was out and about. What I wanted was a simple page from which I could post including an image so I built this connector.

Very much inspired by my [php2Micropost](https://github.com/williamsdb/php2Micropost/) project this package will allow you to easily integrate creating Microposts from your own code.

[![Buy Me a Coffee at ko-fi.com](https://camo.githubusercontent.com/8d3dd9481705944be1335f13e318f077e8447744c3a30dea623345e711906720/68747470733a2f2f73746f726167652e6b6f2d66692e636f6d2f63646e2f6b6f6669352e706e673f763d36)](https://ko-fi.com/Y8Y0POEES)

([back to top](#readme-top))

### Built With

[](#built-with)

- [PHP](https://php.net)
- [WordPress API](https://developer.wordpress.com/docs/api/)
- [Microposts plugin by Michael Gbadebo](https://wordpress.org/plugins/microposts/)

([back to top](#readme-top))

Getting Started
---------------

[](#getting-started)

Running the script is very straightforward:

1. install [composer](https://getcomposer.org/)
2. add php2Micropost

> composer.phar require williamsdb/php2micropost

You can read more about how this all works in [these blog posts](https://www.spokenlikeageek.com/tag/microposts/).

### Prerequisites

[](#prerequisites)

Requirements are very simple; it requires the following:

1. PHP (I tested on v8.1.13)
2. WordPress (I tested on 6.9.4)
3. Michael Gbadebo's [Micropost plugin](https://wordpress.org/plugins/microposts/)
4. a WordPress blog and an Application Password (see [this post](https://www.spokenlikeageek.com/2023/08/02/exporting-all-wordpress-posts-to-pdf/) for details of how to do that).

### Installation

[](#installation)

1. As above

([back to top](#readme-top))

Usage
-----

[](#usage)

Here's a few examples to get you started.

Note: connection to the Bluesky API is made via Clark Rasmussen's [BlueskyApi](https://github.com/cjrasmussen/BlueskyApi) which this makes a connection to Bluesky and manages tokens etc. See [here](https://github.com/cjrasmussen/BlueskyApi) for more details.

### Setup and connect to WordPress

[](#setup-and-connect-to-wordpress)

```
require __DIR__ . '/vendor/autoload.php';

use williamsdb\php2micropost\php2Micropost;

$base_url = 'https://www.your-domain.com/wp-json/wp/v2';
$username = 'WordPress username with write permissions';
$password = 'Your 24-character Application Password';

$php2Micropost = new php2Micropost($base_url, $username, $password);
$connection = $php2Micropost->wordpress_connect();
```

### Sending post with only text

[](#sending-post-with-only-text)

```
$text = "This is a test post from php2Micropost. " . date('Y-m-d H:i:s');

// post with text and nothing else
$response = $php2Micropost->post_to_wordpress(
    connection: $connection,
    text: $text,
    title: '',
    media: '',
);
```

### Uploading a post with a single image

[](#uploading-a-post-with-a-single-image)

```
$image = "/Users/neilthompson/Downloads/IMG_9547.jpeg";

$text = "This is a test post from php2Micropost. " . date('Y-m-d H:i:s');

// post with text and nothing else
$response = $php2Micropost->post_to_wordpress(
    connection: $connection,
    text: $text,
    title: '',
    media: $image,
);
```

([back to top](#readme-top))

Known Issues
------------

[](#known-issues)

See the [open issues](https://github.com/williamsdb/php2Micropost/issues) for a full list of proposed features (and known issues).

([back to top](#readme-top))

Contributing
------------

[](#contributing)

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are **greatly appreciated**.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

1. Fork the Project
2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)
3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)
4. Push to the Branch (`git push origin feature/AmazingFeature`)
5. Open a Pull Request

([back to top](#readme-top))

License
-------

[](#license)

Distributed under the GNU General Public License v3.0. See `LICENSE` for more information.

([back to top](#readme-top))

Contact
-------

[](#contact)

Bluesky - [@spokenlikeageek.com](https://bsky.app/profile/spokenlikeageek.com)

Mastodon - [@spokenlikeageek](https://techhub.social/@spokenlikeageek)

X - [@spokenlikeageek](https://x.com/spokenlikeageek)

Website - [https://spokenlikeageek.com](https://www.spokenlikeageek.com/tag/microposts/)

Project link - [Github](https://github.com/williamsdb/php2Micropost)

([back to top](#readme-top))

Acknowledgments
---------------

[](#acknowledgments)

- [WordPress Microposts](https://wordpress.org/plugins/microposts/)

([back to top](#readme-top))

[![](https://github.com/williamsdb/php2Micropost/graphs/contributors)](https://img.shields.io/github/contributors/williamsdb/php2Micropost.svg?style=for-the-badge)

[![](https://camo.githubusercontent.com/891c4c3ca9c4b5e257513460e71e970438ca91c87c46566b4cba61950b8f33db/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f636f6e7472696275746f72732f77696c6c69616d7364622f706870324d6963726f706f73742e7376673f7374796c653d666f722d7468652d6261646765)](https://camo.githubusercontent.com/891c4c3ca9c4b5e257513460e71e970438ca91c87c46566b4cba61950b8f33db/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f636f6e7472696275746f72732f77696c6c69616d7364622f706870324d6963726f706f73742e7376673f7374796c653d666f722d7468652d6261646765)[![](https://camo.githubusercontent.com/989859064ec803277461c169c8074ee45ee7ab49db9228dec17f0c8d63091109/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f666f726b732f77696c6c69616d7364622f706870324d6963726f706f73742e7376673f7374796c653d666f722d7468652d6261646765)](https://camo.githubusercontent.com/989859064ec803277461c169c8074ee45ee7ab49db9228dec17f0c8d63091109/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f666f726b732f77696c6c69616d7364622f706870324d6963726f706f73742e7376673f7374796c653d666f722d7468652d6261646765)[![](https://camo.githubusercontent.com/228549c879f3d29f15d3abcc6665426b94dd8316766387b12d48eb71cd7590b6/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f77696c6c69616d7364622f706870324d6963726f706f73742e7376673f7374796c653d666f722d7468652d6261646765)](https://camo.githubusercontent.com/228549c879f3d29f15d3abcc6665426b94dd8316766387b12d48eb71cd7590b6/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f77696c6c69616d7364622f706870324d6963726f706f73742e7376673f7374796c653d666f722d7468652d6261646765)[![](https://camo.githubusercontent.com/5c0a258c572a668a02d0f3a348ad28fb10434a36457e59344d4629ccd1488861/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732f77696c6c69616d7364622f706870324d6963726f706f73742e7376673f7374796c653d666f722d7468652d6261646765)](https://camo.githubusercontent.com/5c0a258c572a668a02d0f3a348ad28fb10434a36457e59344d4629ccd1488861/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732f77696c6c69616d7364622f706870324d6963726f706f73742e7376673f7374796c653d666f722d7468652d6261646765)

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance97

Actively maintained with recent releases

Popularity2

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity38

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.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

49d ago

### Community

Maintainers

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

---

Top Contributors

[![williamsdb](https://avatars.githubusercontent.com/u/8099483?v=4)](https://github.com/williamsdb "williamsdb (6 commits)")

---

Tags

phpwordpressMicroposts

### Embed Badge

![Health badge](/badges/williamsdb-php2micropost/health.svg)

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

###  Alternatives

[friedolinfoerder/wp-activerecord

An ActiveRecord implementation for WordPress

237.2k](/packages/friedolinfoerder-wp-activerecord)[alleyinteractive/pest-plugin-wordpress

WordPress Pest Integration

263.7k1](/packages/alleyinteractive-pest-plugin-wordpress)

PHPackages © 2026

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