dev-master
9999999-devManage API queries to Parse.com cloud service.
The Requires
The Development Requires
by Cédric Dugat
v0.1
0.1.0.0Manage API queries to Parse.com cloud service.
The Requires
The Development Requires
by Cédric Dugat
Wallogit.com
2017 © Pedro PelĂĄez
Manage API queries to Parse.com cloud service.
Manage API queries to Parse.com cloud service., (*1)
Just add sly/parsecom-manager package to the requirements of your Composer JSON configuration file,
and run php composer.phar install to install it., (*3)
Clone this library from Git with git clone https://github.com/Ph3nol/ParseComManager.git., (*4)
Goto to the library directory, get Composer phar package and install vendors:, (*5)
curl -s https://getcomposer.org/installer | php php composer.phar install
You're ready to go., (*6)
``` php <?php, (*7)
require_once '/path/to/vendor/autoload.php';, (*8)
use Sly\ParseComManager\Manager\Manager; use Sly\ParseComManager\Query\Query;, (*9)
/** * Initialize the manager with your application ID and REST API key. */ $manager = new Manager(array( 'appID' => 'XXXXX', 'masterKey' => 'XXXXX', 'apiKey' => 'XXXXX', 'sessionToken' => null, // Optional session token ));, (*10)
/** * Initialize the query with 'login' API part parameters. * * Some API parameters are defined into the library: * Resources/config/api.yml * * You can add yours or overload base ones with declaring * your YAML file path as second argument: * $query = new Query('login', '/path/to/your/api.yml'); */ $query = new Query('login');, (*11)
/** * Add some properties, required by Parse.com REST API. */ $query->addProperties(array( 'username' => 'Chuck', 'password' => 'n0rr1s', ));, (*12)
// or/and $query->addProperty('specificProperty', 'propertyValue');, (*13)
/** * Get API JSON response. * * You can use 'client' second argument to get the client response. * Example: $clientResponse = $manager->execute($query, 'client'); */ $userFromApi = $manager->execute($query);, (*14)
## YAML API config file You can use your own YAML API config file. Here is an example: ``` yaml signup: method: post url: /login login: method: get url: /login retrieveUser: method: get url: /users/%userKey% # ...
Be careful: URLs are relative ones.
Base one is declared as Sly\ParseComManager\Query\Query::API_BASE_URL constant., (*15)
You can use keys into a URL, like retrieveUser '%userKey%' case. Just set a 'userKey' property to your query, as usual, it will be replaced in your URL., (*16)
This library is using Atoum for unit testing,
whose Composer package can be installed with dev mode:, (*17)
php composer install --dev ./atoum -d tests/units
Manage API queries to Parse.com cloud service.
Manage API queries to Parse.com cloud service.