Download the PHP package mikespub/survos-wikidata without Composer
On this page you can find all versions of the php package mikespub/survos-wikidata. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download mikespub/survos-wikidata
More information about mikespub/survos-wikidata
Files in mikespub/survos-wikidata
Package survos-wikidata
Short Description A PHP client for working with Wikidata API.
License MIT
Homepage https://github.com/mikespub-org/survos-wikidata
Informations about the package survos-wikidata
Wikidata
Wikidata provides a API for searching and retrieving data from wikidata.org.
Fork of https://github.com/freearhey/wikidata @todo: consider https://github.com/freearhey/wikidata/compare/master...JamesFrost:wikidata:master
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.
All versions of survos-wikidata with dependencies
illuminate/collections Version ^10.0|^11.0
symfony/http-client Version ^6.4||^7.0