firelike / wikipedia-api
Zend Framework module to consume Wikipedia APIs
v1.0.0
2017-01-01 22:25 UTC
Requires
- php: ^5.6 || ^7.0
- guzzlehttp/guzzle-services: ^1.0
- zendframework/zend-log: ^2.9
- zendframework/zend-mvc-console: ^1.1
Requires (Dev)
- phpunit/phpunit: ^5.7
This package is not auto-updated.
Last update: 2024-11-09 21:17:05 UTC
README
Introduction
Zend Framework module to consume Wikipedia API
Installation
Install the module using Composer into your application's vendor directory. Add the following line to your
composer.json
.
{ "require": { "firelike/wikipedia-api": "^1.0" } }
Configuration
Enable the module in your application.config.php
file.
return array( 'modules' => array( 'Firelike\Wikipedia' ) );
Copy and paste the wikipedia.local.php.dist
file to your config/autoload
folder and customize it with your credentials and
other configuration settings. Make sure to remove .dist
from your file.Your wikipedia.local.php
might look something like the following:
<?php return [ 'wikipedia_service' => [ 'log'=>[ 'enable'=>false, 'message_formats'=>[ '{method} {uri} HTTP/{version} {req_body}', 'RESPONSE: {code} - {res_body}', ], 'logger'=>[ 'stream' => 'php://output', ] ] ] ];
Usage
Calling from your code:
use Firelike\Wikipedia\Request\QueryAction as QueryActionRequest; use Firelike\Wikipedia\Service\WikipediaService; $request = new QueryActionRequest(); $request->setTitles('HarperCollins') ->setProp('extracts'); $service = new WikipediaService(); $result = $service->query($request); $pages= $result->toArray()['query']['pages']; var_dump($pages);
Using the console:
php public/index.php wikipedia query --titles=HarperCollins -v
Implemented Service Methods:
- query