PHP code example of illuminated / wikipedia-grabber

1. Go to this page and download the library: Download illuminated/wikipedia-grabber library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

illuminated / wikipedia-grabber example snippets


    use Wikipedia;

    echo (new Wikipedia)->page('Michael Jackson');
    echo (new Wikipedia)->preview('Michael Jackson');

    // Or

    echo (new Wikipedia)->randomPage();
    echo (new Wikipedia)->randomPreview();
    

echo (new Wikipedia)->page('Michael Jackson')->bulma();

$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;`

use MediaWiki;

echo (new MediaWiki($url))->page('Michael Jackson');

$page = (new Wikipedia)->page('Michael Jackson');

$page->append('Interesting Facts', 'He had two pet llamas on his ranch called Lola and Louis.');

$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)
);
shell script
    php artisan vendor:publish --provider="Illuminated\Wikipedia\WikipediaGrabberServiceProvider"