dbfx / wikipedia
There is no license information available for the latest version (dev-master) of this package.
Laravel package to query Wikipedia
dev-master
2018-11-04 13:22 UTC
Requires
- php: >=5.4.0
This package is auto-updated.
Last update: 2024-11-05 03:40:43 UTC
README
Installation
Begin by installing this package through Composer.
{ "require": { "casinelli/wikipedia": "dev-master" } }
Usage
Retrieve page extract
$wikipedia = new \Casinelli\Wikipedia\Wikipedia; return $wikipedia->search("Rome")->getSentences(5);
Same with QueryBuilder
$qb = new \Casinelli\Wikipedia\QueryBuilder; $qb->setFormat("php"); $qb->setTitles("Singapore"); $qb->setExtractsSentences(3); $qb->setExtractsPlainText(true); $response = unserialize( $qb->fetch() ); $page = reset( $response["query"]["pages"] ); return $page["extract"];