PHP code example of divineomega / wikipedia-info-box-parser

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

    

divineomega / wikipedia-info-box-parser example snippets


use JordJD\WikipediaInfoBoxParser\WikipediaInfoBoxParser;

$parser = (new WikipediaInfoBoxParser())
    ->setArticle('PHP');

$infobox = $parser->parse();

echo $infobox['designer'];
print_r($infobox['_categories']);
print_r($infobox['_links']);
echo $parser->getResolvedTitle();
echo $parser->getPageId();

use JordJD\WikipediaInfoBoxParser\Enums\Format;

$infobox = $parser
    ->setFormat(Format::HTML)
    ->parse();

$infobox = (new WikipediaInfoBoxParser())
    ->setEndpoint('https://de.wikipedia.org/w/api.php')
    ->setTemplateName('Infobox Programmiersprache')
    ->setArticle('PHP')
    ->parse();

$parser = (new WikipediaInfoBoxParser($yourPsr6Cache))
    ->setCacheTtl(3600);

$uncached = (new WikipediaInfoBoxParser())
    ->disableCache();