Skip to content

Px-Factor/wikipedia-api

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Zend Framework module to consume Wikipedia APIs

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%