2017 © Pedro PelĂĄez
 

library php-api

A library to connect on S.M.A.R.T platform that can integrate webpages with smart data

image

smartapps/php-api

A library to connect on S.M.A.R.T platform that can integrate webpages with smart data

  • Wednesday, October 29, 2014
  • by josewilker
  • Repository
  • 1 Watchers
  • 0 Stars
  • 0 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

SMARTAPPS API Client PHP

This library can help developers create webpages integrated with S.M.A.R.T platform (www.smartapps.com.br), (*1)

Requirements

- Composer
- cUrl Library
- PHP >= 5.3

Source

You can found the source of library in the src folder., (*2)

Install examples with composer

1. First step, Install composer :)

To do it, you need run composer install or php compose.phar install., (*3)

2. Install library

You need install this library using Composer. So, add package name smartapps/php-api on the dev-master version in your composer.json. If you want do it using CLI, run the command: composer require "smartapps/php-api:dev-master"., (*4)

3. Run example :D

On the main folder, you can run the file opening into your browser or you can run the example with CLI: php examples/basic_data.php, (*5)

Examples

Basic data (basic_data.php)

This example show how to get data from a application, (*6)

Exec method (exec_method.php)

This example show how to execute a method on a application, (*7)

Post simple (exec_method_post_simple.php)

This example show to send a simple block of data., (*8)

Post massive data (exec_method_post_massive.php)

This example show how to send a array of data to any method on a application, (*9)

View forms

This example show how you can see forms avaiables on a application., (*10)

View schemas

This example show how you can see data schemas to a application., (*11)

Note: if you liked the examples and you want more, feel free and help us. let's go change the world using the web., (*12)

Library methods

Below you can see methods avaiable for this library., (*13)

connect($app, $api_user=false, $api_key=false)

You need use this method to connect on S.M.A.R.T, (*14)

Params
$app        : Application that you want connect.
$api_user   : API USER :P, You can found yours, on 'API Tool' in the option 'registered keys' on your enviroment.
$api_key    : API KEY :P, You can found it on 'API Tool' in your environment.
connectionClose()

You need use this method to disconnect of S.M.A.R.T, (*15)

method($conn, $schema, $method, $args=false, $return="json", $app=false)

You can use this method to do a GET request directly using a method as reference., (*16)

Params
$conn       : Connection object reference, found it on return of method connect
$schema     : Schema of data
$method     : Method name
$args       : Array of arguments that method need.
$return     : Type of request return
$app        : Subscribe application when execute this method.
methodPost($conn, $schema, $method, $postVars, $args=false, $return="json", $app=false)

You can use this method to do a POST request directly using a method as reference., (*17)

Params
$conn       : Connection object reference, found it on return of method connect
$schema     : Schema of data
$method     : Method name
$args       : Array of arguments that method need.
$return     : Type of request return
$app        : A way to subscribe application after connected.
getSchemas($conn)

You can use this method to see which schemas avaiable on a app., (*18)

Params
$conn       : Connection object reference, found it on return of method connect.
getForms($conn, $schema)

You can use this method to see forms., (*19)

Params
$conn       : Connection object reference, found it on return of method connect.
$schema     : Schema of data.
getData($conn, $schema, $form)

You can use this method to get data., (*20)

Params
$conn       : Connection object reference, found it on return of method connect.
$schema     : Schema of data.
$form       : Form name.
getFile($conn, $file, $mime, $date)

You can use this method to get a filepath., (*21)

Params
$conn       : Connection object reference, found it on return of method connect.
$file       : File name.
$mime       : Mimetype of the file.
$date       : Date file registry.
sendExec($conn, $app, $schema, $form, $postVars, $return="json")

You can use this method to send data to a form., (*22)

Params
$conn       : Connection object reference, found it on return of method connect.
$app        : Application.
$schema     : Schema of data.
$form       : Form name.
$postVars   : Array data for send.
$return     : Return of request.
sendTo($conn, $schema, $form, $postVars=false, $app=false)

You can use this method to send data to a form directly., (*23)

Params
$conn       : Connection object reference, found it on return of method connect.
$app        : Application.
$schema     : Schema of data.
$form       : Form name.
$postVars   : Array data for send.
$app        : A way to subscribe application after connected.

If you want more details about API Tool of S.M.A.R.T Platform, see API Docs on Smartapps web site (www.smartapps.com.br)., (*24)

@author José Wilker jose.wilker@smartapps.com.br, (*25)

The Versions

29/10 2014

dev-master

9999999-dev

A library to connect on S.M.A.R.T platform that can integrate webpages with smart data

  Sources   Download

The Requires

  • php >=5.3.0

 

by José Wilker