2017 © Pedro Peláez
 

library wikipedia-grabber

Grab Wikipedia (or another MediaWiki) page in Laravel.

image

illuminated/wikipedia-grabber

Grab Wikipedia (or another MediaWiki) page in Laravel.

  • Tuesday, July 24, 2018
  • by dmitry-ivanov
  • Repository
  • 3 Watchers
  • 6 Stars
  • 230 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 13 Versions
  • 125 % Grown

The README.md

Wikipedia/MediaWiki Grabber for Laravel, (*1)

Laravel Wikipedia Grabber

Buy me a coffee, (*2)

StyleCI Build Status Coverage Status, (*3)

Packagist Version Packagist Stars Packagist Downloads Packagist License, (*4)

Wikipedia/MediaWiki Grabber for Laravel., (*5)

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.*

Laravel Wikipedia Grabber - Demo, (*6)

Table of contents

Usage

  1. Install the package via Composer:, (*7)

    shell script composer require illuminated/wikipedia-grabber, (*8)

  2. Publish the config:, (*9)

    shell script php artisan vendor:publish --provider="Illuminated\Wikipedia\WikipediaGrabberServiceProvider", (*10)

  3. Grab a full page or preview:, (*11)

    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:, (*12)

  • plain (default)
  • bootstrap
  • bulma

Change the format in your config file, or specify it explicitly:, (*13)

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., (*14)

There are numerous methods available on these objects, for example:, (*15)

$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., (*16)

Thus, you can grab pages from any MediaWiki website:, (*17)

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:, (*18)

$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:, (*19)

$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

Laravel Idea
Material Theme UI Plugin
, (*20)

License

Laravel Wikipedia Grabber is open-sourced software licensed under the MIT license., (*21)

Buy me a coffee , (*22)

The Versions

24/07 2018

5.6.x-dev

5.6.9999999.9999999-dev

Grab Wikipedia (or another MediaWiki) page in Laravel.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dmitry Ivanov

laravel parser mediawiki wiki wikipedia grabber

24/07 2018

dev-master

9999999-dev

Grab Wikipedia (or another MediaWiki) page in Laravel.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dmitry Ivanov

laravel parser mediawiki wiki wikipedia grabber

24/07 2018

5.6.4

5.6.4.0

Grab Wikipedia (or another MediaWiki) page in Laravel.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dmitry Ivanov

laravel parser mediawiki wiki wikipedia grabber

24/07 2018

5.6.3

5.6.3.0

Grab Wikipedia (or another MediaWiki) page in Laravel.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dmitry Ivanov

laravel parser mediawiki wiki wikipedia grabber

23/07 2018

5.5.x-dev

5.5.9999999.9999999-dev

Grab Wikipedia (or another MediaWiki) page in Laravel.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dmitry Ivanov

laravel parser mediawiki wiki wikipedia grabber

23/07 2018

5.6.2

5.6.2.0

Grab Wikipedia (or another MediaWiki) page in Laravel.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dmitry Ivanov

laravel parser mediawiki wiki wikipedia grabber

20/07 2018

5.6.1

5.6.1.0

Grab Wikipedia (or another MediaWiki) page in Laravel.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dmitry Ivanov

laravel parser mediawiki wiki wikipedia grabber

16/07 2018

5.6.0

5.6.0.0

Grab Wikipedia (or another MediaWiki) page in Laravel.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dmitry Ivanov

laravel parser mediawiki wiki wikipedia grabber

16/07 2018

5.5.3

5.5.3.0

Grab Wikipedia (or another MediaWiki) page in Laravel.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dmitry Ivanov

laravel parser mediawiki wiki wikipedia grabber

14/07 2018

5.5.2

5.5.2.0

A convenient way to grab Wikipedia (or another MediaWiki) page.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dmitry Ivanov

laravel parser mediawiki wiki wikipedia grabber

14/07 2018

5.5.1

5.5.1.0

A convenient way to grab Wikipedia (or another MediaWiki) page.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dmitry Ivanov

laravel parser mediawiki wiki wikipedia grabber

13/07 2018

5.5.0

5.5.0.0

Provides a convenient way to grab Wikipedia (or another MediaWiki) page.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dmitry Ivanov

laravel parser mediawiki wiki wikipedia grabber

30/05 2018

dev-images

dev-images

Provides convenient way to grab Wikipedia (or another MediaWiki) page.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dmitry Ivanov

laravel parser mediawiki wiki wikipedia grabber