Skip to content

Basic Library, using Guzzle, for interacting with the Mediawiki API, [READ-ONLY] split from https://github.com/addwiki/addwiki

License

Notifications You must be signed in to change notification settings

addwiki/mediawiki-api-base

Folders and files

NameName
Last commit message
Last commit date

Latest commit

author
addwiki-ci
Feb 16, 2021
d8eff31 · Feb 16, 2021
Feb 16, 2021
Feb 15, 2021
Feb 16, 2021
Feb 16, 2021
Apr 8, 2020
Feb 16, 2021
May 3, 2017
Feb 15, 2021
Apr 15, 2015
Feb 2, 2021
Feb 16, 2021
Feb 16, 2021
Feb 15, 2021
Jan 26, 2021

Repository files navigation

mediawiki-api-base

GitHub issue custom search in repo Latest Stable Version Download count

This library provides basic access to the MediaWiki Action API. This library features simple methods allowing you to login, logout and do both GET and POST requests. This library should work with most if not all MediaWiki versions due to its simplicity.

You can find the fill documentation at https://addwiki.github.io/mediawiki-api-base/

Example

A quick example can be found below:

use \Mediawiki\Api\MediawikiApi;

$api = MediawikiApi::newFromPage( 'https://en.wikipedia.org/wiki/Berlin' );
$api->login( new ApiUser( 'username', 'password' ) );
$purgeRequest = FluentRequest::factory()->setAction( 'purge' )->setParam( 'titles', 'Berlin' );
$api->postRequest( $purgeRequest );

Integration tests

Run the MediaWiki test site:

docker-compose -f docker-compose-ci.yml up -d

Run the tests:

composer phpunit-integration

Destroy the site that was used for testing:

docker-compose -f docker-compose-ci.yml down --volumes