CartoDB SQL API v2 Client for PHP by Simbiotica
About
A easy to use PHP client for CartoDB's SQL API v2, using OAuth or API key authentication., (*1)
Installation
There are two versions of the library: OAuth or API Key. When installing,
you have to choose which to use., (*2)
This library requires composer, a package manager for PHP.
To use the OAuth version, add the following to your composer.json:, (*3)
{
"require": {
"simbiotica/cartodbclient-php": "dev-master"
}
}
Or, if you prefer the API key version, use the following:, (*4)
{
"require": {
"simbiotica/cartodbclient-php": "dev-api-key"
}
}
After, install it using the command:, (*5)
bash
$ php composer.phar update simbiotica/cartodbclient-php
, (*6)
This will install not only this library, but the required dependencies., (*7)
Usage - OAuth
Currently two types of connections are supported: PrivateConnection and PublicConnection.
Public connections are a subset of Private ones, as they can be established
to any public table, with reduced privileges and configuration requirements, (*8)
Additionally, TokenStorageInterface implementation is required to presist the OAuth Token
across requests. We provide SessionStorage and FileStorage, but feel free to
implement your own., (*9)
For reference, check the Connection class, where you'll find all the handy functions
you'll need. There's also a runSql() function for everything that's not covered
by existing functions., (*10)
All reponses are wrapped as a Payload object, which holds the formated answer,
request metadata and a couple of utilities to handle the result., (*11)
No actual demo is provided, but you can view a sort-of-example inside the /tests
folder. Remember to fill in your data before trying it., (*12)
Usage - API Key
Usage with just API key is less secure, but equaly functional and easier to setup., (*13)
All connections are supported by the Connection class, which accepts your domain
and, optionally, you API key. If you don't provide it, you will have limited access
to the tables., (*14)
For reference, check the Connection class, where you'll find all the handy functions
you'll need. There's also a runSql() function for everything that's not covered
by existing functions., (*15)
All reponses are wrapped as a Payload object, which holds the formated answer,
request metadata and a couple of utilities to handle the result., (*16)
No actual demo is provided, but you can view a sort-of-example inside the /tests
folder. Remember to fill in your data before trying it., (*17)