Download the PHP package menoci/wikidata without Composer
On this page you can find all versions of the php package menoci/wikidata. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download menoci/wikidata
More information about menoci/wikidata
Files in menoci/wikidata
Package wikidata
Short Description A PHP client for working with Wikidata API.
License MIT
Homepage https://github.com/menociGoettingen/wikidata
Informations about the package wikidata
Wikidata
Wikidata provides a API for searching and retrieving data from wikidata.org.
Installation
Usage
First we need to create an instance of Wikidata
class and save it to some variable, like this:
after that we can use one of the available methods to access the Wikidata database.
Available Methods
search()
The search()
method give you a way to find Wikidata entity by it label.
Arguments:
$query
: term to search (required)$lang
: specify the results language (default: 'en')$limit
: set a custom limit (default: 10)
Example:
The search()
method always returns Illuminate\Support\Collection
class with results. This means you can use all the methods available in Laravel's Collections.
searchBy()
The searchBy
help you to find Wikidata entities by it properties value.
Arguments:
$propId
: id of the property by which to search (required)$entityId
: id of the entity (required)$lang
: specify the results language (default: 'en')$limit
: set a custom limit (default: 10)
Example:
The searchBy()
method always returns Illuminate\Support\Collection
class with results. This means you can use all the methods available in Laravel's Collections.
get()
The get()
returns Wikidata entity by specified ID.
Arguments:
$entityId
: id of the entity (required)$lang
: specify the results language (default: 'en')
Example:
Upgrade Guide
Upgrade to 3.2. from 3.1.
The main changes in the new version have occurred in the way property values are stored. Now each property can have more than one value. In this regard, the attribute value
in the Property
object was replaced with the attribute values
.
Also, values are now presented not as a string, but as an Value
object. This allowed us to save along with each value not only its string representation but also a list of its qualifiers
. Detailed information on what qualifiers
is can be found here.
Testing
Contribution
If you find a bug or want to contribute to the code or documentation, you can help by submitting an issue or a pull request.
License
Wikidata is licensed under the MIT license.