Back in 2014 I wrote a small collection of PHP libraries, releasing 2.0.0 of the base library in 2015 for interacting with MediaWiki and Wikibase. My goal back then was to create a stable base that PHP bot frameworks could be built on, while also experimenting with some framework like features in surrounding libraries.
And now, version 3.0.0 has been released, with a couple of new features, such as OAuth authentication, and lots of refactoring to make the libraries easier to work with and contribute to.
I find it pretty hard to figure out how many people actually use these libraries and if it is worth keeping them updated, but there are a few notable projects that make use of them, particularly
mediawiki-api-base which is a simple client wrapping Guzzle.
Packagist and Github metrics seem to hint that there is some usage. Though I suspect that the download numbers mainly come from usage in other projects CI setups.
|Package||Github Stars ⭐||Packagist downloads in last 30 days|
|mediawiki-api-base||33||1248 (41 a day)|
|mediawiki-api||36||745 (24 a day)|
|wikibase-api||20||103 (3 a day)|
And I can easily hunt out some notable usages (even if some are mine):
- wikisource/ws-search – A simple search tool for all Wikisources.
- wikimedia/CopyPatrol – The web interface for Plagiabot (authored by @eranroz)
- wikimedia/popularpages – Tool for generating popular page reports for WikiProjects
- samwilson/basildon – A static site generator.
- magnusmanske/quickstatements – The official repo for the QuickStatements PHP/HTML/JS interface
- UTRS2/utrs – Unblock Ticket Request System (v2) used on Wikimedia projects
- Archi-Strasbourg/mediawiki-mail-recentchanges – Send recent changes to every user of your wiki
- addshore/twitter-wikidatameter – A Twitter bot powered by Github Actions tweeting Wikidata milestones
So bring on a little refresh, in the form of version 3.0!
What’s changed for users?
The libraries now require PHP 7.4+ and have had typing added throughout.
All libraries have updated namespaces to follow PSR4. The base library uses the namespace
Addwiki\Mediawiki\Api and which is shared by
mediawiki-api which builds on top of it. The
wikibase-api library takes the names space
The base library saw some additions such as a
RestApi and OAuth authentication has been added to all APIs.
The simple username and password based auth has been replaced by an
AuthMethod interface. This interface has a few implementations including
OAuthOwnerConsumer. These can be used when creating an API service object to decide how to authenticate with it.
What’s changed for addwiki devs?
If you want to contribute to these libraries, you’ll now find that all development happens as part of a monorepo in addwiki/addwiki.
This should make contribution easier, as no complex inter library dependencies need to be thought of. This should also lead to making more releases as things are iteratively added or improved, as the release process is much simpiler.
For an overview of the workflows, make sure you read the README!