Ratings | | Unique User Downloads | | Download Rankings |
 35% | | Total: 964 | | All time: 3,746 This week: 206 |
|
Description | | Author |
This package can build a REST server API from custom classes.
It can register classes that will handle API calls under given server URI.
The main class can handle the requests to the API server and call the respective handler classes.
Optionally a custom class can validate the key value that clients may be required to pass as authorized clients to access the API. | |
|
Recommendations
Example
<?php
/*
Exemple of REST API for generate random number
*/
class SampleKeyValidator extends ApiKeyValidatorBase {
function isValid($key) {
/* Validade here using MySQL, etc... */
return ($key == "75f42660c4109c3dc81101d3a45fa174");
}
}
registerClass("Test_v1", "1");
/*
This class is Public (extends ApiCommandBase), don´t need Key for acess
*/
class Test_v1 extends ApiCommandBase {
function _getURIName() {
return "random";
}
function getNumber() {
return rand(0,100);
}
}
registerClass("Test_v2", "2");
/**
* TESTE This is a doc_comment.
* (see doc.php for view API Doc)
*/
class Test_v2 extends Test_v1 {
function getNumber() {
return rand(101,1000);
}
/**
* (en) Return number between <i>min</i> and <i>max</i>
* (pt-br) Retorna um número entre <i>min</i> e <i>max</i>
*/
function getNumberRange($min = 0, $max = 100) {
return rand($min,$max);
}
}
registerClass("Test_v3", "2");
/*
This class is Private (extends ApiComamndKeyed), need Key for acess
*/
class Test_v3 extends ApiComamndKeyed {
function getSecureString() {
return "string protected by Key";
}
function _getURIName() {
return "text";
}
}
?>
|
Details
APIBuilder - PHP REST API Builder
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This framework make easy the developmente of an REST Api for others developers can acsses information on your system.
Este framework torna fácil o desenvolvimento de uma REST API para que outros desenvolvedores podssam acessar informações de seus sistema.
This package can build a REST server API from custom classes.
It can register classes that will handle API calls under given server URI.
The main class can handle the requests to the API server and call the respective handler classes.
Optionally a custom class can validate the key value that clients may be required to pass as authorized clients to access the API.
Ajuda/HELP
~~~~~~~~~~
Any Help is welcome!
Toda Ajuda é bem vinda!
O que é REST API (REpresentational State Transfer (REST)) ?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Sobre REST http://pt.wikipedia.org/wiki/REST
Primerios Passos / First Steps
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- includes:
include('apibuilder/core/ApiApp.php');
include('apibuilder/language/pt-br.php');
include('apibuilder/formats/all_formats.php');
- Criar uma classe que extende de ApiCommandBase
- Implementar _getURIName()
- Implmentar os métodos públicos que estarão disponÃveis para o usuário
- Registrar a nova classe usando: registerClass()
- Instanciar APIApp
- Parametrizar
- executar run()
|
|
Applications that use this package |
|
No pages of applications that use this class were specified.
If you know an application of this package, send a message to the author to add a link here.