ekendra / wikipedia
There is no license information available for the latest version (2.0) of this package.
Laravel package to query Wikipedia
2.0
2020-12-10 04:42 UTC
Requires
- php: >=8.0
- illuminate/support: ^8.0
This package is auto-updated.
Last update: 2025-04-16 15:09:24 UTC
README
Installation
Begin by installing this package through Composer.
{ "require": { "ekendra/wikipedia": "dev-master" } }
Usage
Retrieve page extract
$wikipedia = new \Ekendra\Wikipedia\Wikipedia; return $wikipedia->search("Rome")->getSentences(5);
Same with QueryBuilder
$qb = new \Ekendra\Wikipedia\QueryBuilder; $qb->setFormat("php"); $qb->setTitles("Nepal"); $qb->setExtractsSentences(3); $qb->setExtractsPlainText(true); $response = unserialize( $qb->fetch() ); $page = reset( $response["query"]["pages"] ); return $page["extract"];