PHP code example of litstack / wikipedia

1. Go to this page and download the library: Download litstack/wikipedia 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/ */

    

litstack / wikipedia example snippets


'fields' => [
    // ...
    'wikipedia' => [
        'cache_ttl' => 60 * 60 * 24,
    ],
],

$form->wikipedia('wiki');

// in your model
protected $casts = [
    'wiki' => 'json',
];

$form->wikipedia('wiki')->section(false)->chars(false);

// will output the first 'intro' section of the article
Wikipedia::load('https://en.wikipedia.org/wiki/PHP');

// will output the 'Mascot' section.
Wikipedia::load('https://en.wikipedia.org/wiki/PHP', 'Mascot');

// will output the first 100 chars of the 'Mascot' section.
Wikipedia::load('https://en.wikipedia.org/wiki/PHP', 'Mascot', 100);