dev-master
9999999-devLaravel PHP Facade/Wrapper for the Wikidata Data API
MIT
The Requires
The Development Requires
by Giorgi Chumburidze
laravel php wikidata nixler
Wallogit.com
2017 © Pedro Peláez
Laravel PHP Facade/Wrapper for the Wikidata Data API
, (*1)
Laravel PHP Facade/Wrapper for the Wikidata Data API, (*2)
Add nixler/wikidata to your composer.json., (*3)
"nixler/wikidata": "dev-master"
Run composer update to pull down the latest version of the package., (*4)
Next, you should add the WikidataServiceProvider to the providers array of your config/app.php configuration file:, (*5)
Nixler\Wikidata\WikidataServiceProvider::class,
After registering the Wikidata service provider, you should publish the Wikidata configuration using the vendor:publish Artisan command. This command will publish the wikidata.php configuration file to your config directory:, (*6)
php artisan vendor:publish --provider="Nixler\Wikidata\WikidataServiceProvider"
use Nixler\Wikidata\Wikidata; ... // Retrieving Entities By ID $laravel = (new Wikidata)->whereId('Q13634357')->first(); // or by array of IDs $companies = (new Wikidata)->whereId(['Q95', 'Q2283'])->get(); //Languages $laravel = (new Wikidata)->whereId('Q13634357')->languages('en', 'ru')->get(); //Select Clause $laravel = (new Wikidata)->select('id', 'label')->whereId('Q13634357')->first(); //available attributes id, label, description, wiki, type, aliases, sitelinks, claims, photos //Search By Query $search = (new Wikidata)->search('Adele')->get(); //Search By Prop $adele = (new Wikidata)->where('P345', 'nm2233157')->first();
for first there should be functionality to add just title, headline, type, wiki, photos, (*7)
Write Model has Enitable trait We make opperation $model->entity()->fetch('wikidata', 'Q1'); or $model->fetchDataFrom('lastfm', 'Adele'); or $model->fetchDataFrom('gbooks', 'Some book'); or $model->fetchDataFrom('tmdb', 'ID'); or $model->fetchDataFrom('imdb', 'ID'); or $model->fetchDataFrom('youtube', 'Some song or video'); entity if not exists it creates new and associates current external IDs Then system make update of entity, it fetches all relations and populates entity with data., (*8)
Read $model->getData([ 'info' => 'id,type,title,headline,wiki,entities', 'links' => 'facebook,twitter', 'photos' => 20, 'similars' => 5 ]);, (*9)
takes info (translated), links to profiles in social networks, similars, photos in entities it takes structured data such as ['date_of_birth' => 'timestamp'], (*10)
there should be write opperation file for each type of entity - person, music, book, album, country, (*11)
Search should be performed this way - entities('country')->where(''), (*12)
Laravel PHP Facade/Wrapper for the Wikidata Data API
MIT
laravel php wikidata nixler