PHP code example of addwiki / wikibase-query

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

    

addwiki / wikibase-query example snippets


use Addwiki\Wikibase\Query\WikibaseQueryFactory;
use Addwiki\Wikibase\Query\PrefixSets;

$factory = new WikibaseQueryFactory(
    "https://query.wikidata.org/sparql",
    PrefixSets::WIKIDATA
);

$r = $factory->newSimpleQueryService()->query(["P31:Q1"]);