This is another MediaWiki API handler in PHP. Now with +98% of vegan spaghetti MediaWiki/Wikibase/Wikimedia abstraction.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.

README.md

boz-mw

This is another MediaWiki API handler in PHP.

Tools

See the tools.

API showcase

Here some usage examples:

<?php
// autoload classes
require 'boz-mw/autoload.php';

// enable verbose messages
\cli\Log::$DEBUG = true;

echo "Simple Italian Wikipedia API query:\n";
$w = \wm\WikipediaIt::getInstance();
$response = $w->fetch( [
	'action' => 'query',
	'prop'   => 'info',
	'titles' => [
		'Pagina principale'
	]
] );
print_r( $response );

echo "Simple Italian Wikipedia API query with continuation support:\n";
$members = \wm\WikipediaIt::getInstance()->createQuery( [
	'action' => 'query',
	'list'   => 'categorymembers',
	'cmtitle' => 'Categoria:Software con licenza GNU GPL',
] );
foreach( $members->getGenerator() as $response ) {
	print_r( $response );
}

echo "Simple POST request:\n";
\mw\API::$DEFAULT_USERNAME = 'My username';
\mw\API::$DEFAULT_PASSWORD = 'My bot password';
$w = \wm\WikipediaIt::getInstance()->login();
$response = $w->edit( [
	'title'   => 'Special:Nothing',
	'text'    => 'My wikitext',
	'summary' => 'My edit summary',
] );
print_r( $response );

Known usage