Recommend this page to a friend! |
Download .zip |
Info | Documentation | View files (27) | Download .zip | Reputation | Support forum | Blog | Links |
Last Updated | Ratings | Unique User Downloads | Download Rankings | |||||
2016-07-30 (2 months ago) | Not enough user ratings | Total: 138 This week: 1 | All time: 8,254 This week: 1,047 |
Version | License | PHP version | Categories | |||
silex-rest-api-multi 1.0 | GNU General Publi... | 5 | PHP 5, Libraries, Web services |
Collaborate with this project | Author | |||
silex-rest-api-multi-lazyload - github.com Description This package can be used to create REST APIs with module lazy loading. Innovation Award
|
This is a SILEX based Rest API with module lazy load, it uses micro services and has authentication. It uses token authentication and is useful for Angularjs Applications, it also uses Yandex service to translate strings for internationalization.
This api can be used for exposing different web services, that means that every service can have its own workspace and database configuration, it is built in a modular fashion, where removing any part won't affect the whole functionality.
https://secureaudit.co/api-docs
For multiple API interfaces, just create a new dir:
public2/
.htaccess
index.php
.htaccess file contents:
#Options -MultiViews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
index.php contents:
require_once __DIR__ . '/../vendor/autoload.php';
$app = App\Rest::run('prod2');
Create a prod2.php config file under ./config/
_About the Lazy Load._
This rest API uses lazy loading for services, it has a Factory pattern implemented so all naming conventions must be kept for controllers and services.
Do the following to run:
composer install
php -S 0:8001 -t public1/
Run tests:
vendor/bin/phpunit
Point to:
http://localhost:8001/api/v1/whatever
HTTP Request Headers:
'Content-Type: application/json'
'x-token: your-auth-token'
License see LICENSE file.
Authentication method:
curl -i -H "x-requested-with: CLFYf7yz1it9x16FX1b5rlDNp3qkXJWB" -H "Content-Type: application/json" -X-POST http://localhost:8001/api/v1/login -d '{
"login": { "email": "test@example.com", "pass": $apiPass //"04fbd445b467cf8679232accbcedf6192070d068"}
}'
How to generate passwords
$appKey = 'CLFYf7yz1it9x16FX1b5rlDNp3qkXJWB';
$pass = sha1('User123!*?'); //43e1eeda52d762652c2846badea1dd6a2a761d81
$apiPass = sha1($appKey.$pass); //04fbd445b467cf8679232accbcedf6192070d068
Login Headers, company token:
'x-requested-with: CLFYf7yz1it9x16FX1b5rlDNp3qkXJWB'
'Content-Type: application/json'
I owe you unit tests, sorry, test writers are welcome!!, any questions just contact me.
Files |
File | Role | Description | ||
---|---|---|---|---|
config (1 file) | ||||
db (1 file) | ||||
public1 (2 files) | ||||
src (1 directory) | ||||
.gitignore | Data | Auxiliary data | ||
composer.json | Data | Auxiliary data | ||
LICENSE | Lic. | License text | ||
phpunit.xml | Data | Auxiliary data | ||
README.md | Doc. | Documentation |
Files | / | public1 |
Files | / | src | / | App |
File | Role | Description | ||
---|---|---|---|---|
Services (1 directory) | ||||
Authorization.php | Class | Class source | ||
BaseRestApi.php | Class | Class source | ||
BaseService.php | Class | Class source | ||
Controller.php | Class | Class source | ||
Purifier.php | Class | Class source | ||
Rest.php | Class | Class source | ||
Route.php | Class | Class source | ||
Routing.php | Class | Class source |
Files | / | src | / | App | / | Services | / | Rest | / | Countries |
File | Role | Description |
---|---|---|
CountriesController.php | Class | Class source |
CountriesService.php | Class | Class source |
Files | / | src | / | App | / | Services | / | Rest | / | Customers |
File | Role | Description |
---|---|---|
CustomersController.php | Class | Class source |
CustomersService.php | Class | Class source |
Files | / | src | / | App | / | Services | / | Rest | / | Language |
File | Role | Description |
---|---|---|
LanguageController.php | Class | Class source |
LanguageService.php | Class | Class source |
Files | / | src | / | App | / | Services | / | Rest | / | Login |
File | Role | Description |
---|---|---|
LoginController.php | Class | Class source |
LoginService.php | Class | Class source |
Files | / | src | / | App | / | Services | / | Rest | / | Users |
File | Role | Description |
---|---|---|
UsersController.php | Class | Class source |
UsersService.php | Class | Class source |
silex-rest-api-multi-2016-07-30.zip 539KB | |
silex-rest-api-multi-2016-07-30.tar.gz 528KB | |
Install with Composer |
Version Control | Unique User Downloads | Download Rankings | |||||||||||||||
100% |
|
|
Applications that use this package |
If you know an application of this package, send a message to the author to add a link here.