visupedia / visupedia
Official Visupedia API library client for PHP
Requires
- ext-json: *
- guzzle/guzzle: 3.7.*
This package is not auto-updated.
Last update: 2024-05-07 04:45:26 UTC
README
Official Visupedia API library client for PHP
This library is generated by alpaca
Installation
Make sure you have composer installed.
Add the following to your composer.json
{ "require": { "visupedia/visupedia": "@dev" } }
Update your dependencies
$ php composer.phar update
This package follows the
PSR-0
convention names for its classes, which means you can easily integrate these classes loading in your own autoloader.
Versions
Works with [ 5.4 / 5.5 ]
Usage
<?php // This file is generated by Composer require_once 'vendor/autoload.php'; // Then we instantiate a client (as shown below)
Build a client
Without any authentication
$client = new Visupedia\Client(); // If you need to send options $client = new Visupedia\Client(array(), $clientOptions);
Client Options
The following options are available while instantiating a client:
- base: Base url for the api
- api_version: Default version of the api (to be used in url)
- user_agent: Default user-agent for all requests
- headers: Default headers for all requests
- request_type: Default format of the request body
Response information
All the callbacks provided to an api call will recieve the response as shown below
$response = $client->klass('args')->method('args', $methodOptions); $response->code; // >>> 200 $response->headers; // >>> array('x-server' => 'apache')
Method Options
The following options are available while calling a method of an api:
- api_version: Version of the api (to be used in url)
- headers: Headers for the request
- query: Query parameters for the url
- body: Body of the request
- request_type: Format of the request body
Request body information
Set request_type in options to modify the body accordingly
RAW request
When the value is set to raw, don't modify the body at all.
$body = 'username=pksunkara'; // >>> 'username=pksunkara'
Visu api
Returns an MyVisu api instance
The following arguments are required:
- key: The api key provided by Visupedia
$visu = $client->visu("53214f86e2ae54.93050075");
Query a Visu (GET /api?key=:key&id=:id&lang=:lang&version=:version)
Returns all information about the wanted Visu
The following arguments are required:
- id: The unique ID of the Visu
- lang: The language code wanted for the Visu
- version: Use a specific version of our API
$response = $visu->get("5396d8c752cfd8.93460735", "fr", "2", $options);
Contributors
Here is a list of Contributors
TODO
License
MIT
Bug Reports
Report here.
Contact
Gaël Gillard (dev@visupedia.net)