casinelli / wikipedia
Laravel package to query Wikipedia
Installs: 10 077
Dependents: 0
Suggesters: 0
Security: 0
Stars: 12
Watchers: 2
Forks: 11
Open Issues: 1
Requires
- php: >=5.4.0
- illuminate/support: ~5.0
This package is not auto-updated.
Last update: 2024-11-14 19:10:10 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"];