Zend Framework module to consume Wikipedia APIs
PHP
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
config
src
tests
.gitignore
.travis.yml
LICENSE
README.md
composer.json
composer.lock
phpunit.xml.dist

README.md

Wikipedia API Client

Build Status License

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

Links