illuminated/wikipedia-grabber
Composer 安装命令:
composer require illuminated/wikipedia-grabber
包简介
Wikipedia/MediaWiki Grabber for Laravel.
README 文档
README
Laravel Wikipedia Grabber
Wikipedia/MediaWiki Grabber for Laravel.
| Laravel | Wikipedia Grabber |
|---|---|
| 12.x | 12.x |
| 11.x | 11.x |
| 10.x | 10.x |
| 9.x | 9.x |
| 8.x | 8.x |
| 7.x | 7.x |
| 6.x | 6.x |
| 5.8.* | 5.8.* |
| 5.7.* | 5.7.* |
| 5.6.* | 5.6.* |
| 5.5.* | 5.5.* |
Table of contents
Usage
-
Install the package via Composer:
composer require illuminated/wikipedia-grabber
-
Publish the config:
php artisan vendor:publish --provider="Illuminated\Wikipedia\WikipediaGrabberServiceProvider" -
Grab a full page or preview:
use Wikipedia; echo (new Wikipedia)->page('Michael Jackson'); echo (new Wikipedia)->preview('Michael Jackson'); // Or echo (new Wikipedia)->randomPage(); echo (new Wikipedia)->randomPreview();
Output formats
Here's the list of supported output formats:
plain(default)bootstrapbulma
Change the format in your config file, or specify it explicitly:
echo (new Wikipedia)->page('Michael Jackson')->bulma();
Available methods
When you call the page() or preview() method, you'll get an instance of the proper object.
There are numerous methods available on these objects, for example:
$page = (new Wikipedia)->page('Michael Jackson'); $page->isSuccess(); // true $page->isMissing(); // false $page->isInvalid(); // false $page->isDisambiguation(); // false echo $page->getId(); // 14995351 echo $page->getTitle(); // "Michael Jackson" echo $page->getBody(); // Same as `echo $page;`
Advanced
MediaWiki
Wikipedia uses the MediaWiki API under the hood.
Thus, you can grab pages from any MediaWiki website:
use MediaWiki; echo (new MediaWiki($url))->page('Michael Jackson');
Modify the grabbed page
Sometimes it might be useful to append additional sections to the grabbed page:
$page = (new Wikipedia)->page('Michael Jackson'); $page->append('Interesting Facts', 'He had two pet llamas on his ranch called Lola and Louis.');
Alternatively, you can get the sections collection and change it as needed:
$page = (new Wikipedia)->page('Michael Jackson'); $sections = $page->getSections(); $sections->push( new Section('Interesting Facts', 'He had two pet llamas on his ranch called Lola and Louis.', $level = 2) );
Sponsors
License
Laravel Wikipedia Grabber is open-sourced software licensed under the MIT license.
illuminated/wikipedia-grabber 适用场景与选型建议
illuminated/wikipedia-grabber 是一款 基于 HTML 开发的 Composer 扩展包,目前已累计 7.33k 次下载、GitHub Stars 达 47, 最近一次更新时间为 2018 年 01 月 18 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「parser」 「wiki」 「laravel」 「mediawiki」 「grabber」 「wikipedia」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 illuminated/wikipedia-grabber 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 illuminated/wikipedia-grabber 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 illuminated/wikipedia-grabber 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Texy converts plain text in easy to read Texy syntax into structurally valid (X)HTML. It supports adding of images, links, nested lists, tables and has full support for CSS. Texy supports hyphenation of long words (which reflects language rules), clickable emails and URL (emails are obfuscated again
Easy to use SDK with grabber for multiple platforms at once like YouTube, Dailymotion, Facebook and more.
Automatically logs-in users if they are already authenticated by a remote source. (e.g. environment variable REMOTE_USER)
An extension to Semantic MediaWiki allowing to build breadcrumb links from an attributive property filter
Adds the EDTF data type to Wikibase
An MT940 bank statement parser for PHP
统计信息
- 总下载量: 7.33k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 47
- 点击次数: 11
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-01-18




