2017 © Pedro PelΓ‘ez
 

project lumen-api-skeleton

Lumen API skeleton with JWT to manager tokens, Socialite to OAuth Providers, MongoDB driver and Predis to Redis cache storage.

image

alissonphp/lumen-api-skeleton

Lumen API skeleton with JWT to manager tokens, Socialite to OAuth Providers, MongoDB driver and Predis to Redis cache storage.

  • Tuesday, November 21, 2017
  • by alissonphp
  • Repository
  • 1 Watchers
  • 16 Stars
  • 1 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 7 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Rest API Lumen Skeleton

Basic structure for creating REST APIs using Lumen Framework and extra packages, (*1)

System requirements

  • PHP >= 5.6.4
  • OpenSSL PHP Extension
  • PDO PHP Extension
  • Mbstring PHP Extension
  • Mongo DB drive
  • PHPUnit
  • Redis Drive

Installation

$ git clone https://github.com/alissonphp/lumen-api-skeleton
$ cd lumen-api-skeleton/

IMPORTANT: configure .env (copy .env.example) at the root of the application with the development variables: connections with MySQL and MongoDB, APP Ids of the authentication services (google, facebook)., (*2)

$ composer install
$ php artisan jwt:secret
$ php artisan migrate
$ php artisan db:seed
$ php -S localhost:8000 -t public

Development server running in: http://localhost:8000, (*3)

Packages Used

  • Lumen Micro Framework [https://lumen.laravel.com/docs/5.4/]
  • Socialite [https://github.com/laravel/socialite]
  • JWT Auth [https://github.com/tymondesigns/jwt-auth/]
  • Laravel MongoDB [https://github.com/jenssegers/laravel-mongodb]
  • Predis [https://github.com/nrk/predis]

Modularization

The application is architected in Modules. Each module has defined responsibility and Β  Layers. The standard model of a module follows the following structure:, (*4)

app └───Modules β”‚ β”‚ Controllers β”‚ β”‚ Events β”‚ β”‚ Listeners β”‚ β”‚ Middlewares β”‚ β”‚ Models β”‚ β”‚ Supports β”‚ β”‚ Tests β”‚ β”‚ routes.php, (*5)

To enable / disable the functionality of a module simply inform the Namespace in the array of the config / modules.php file Important to verify interoperability between modules before deactivating it., (*6)

Routes

Routes are defined in the routes.php files within the root directory of each module. The RouteServiceProvider is responsible for loading the routes of each module defined in config / modules.php. No need to instantiate new calls., (*7)

Endpoints composition

  • Model : localhost:8000 + api version + module namespace + action + parameters, for example: http://localhost:8000/v1/oauth/login/google or http://localhost:8000/v1/oauth/login/google/callback

Tests

There are two types of tests: Integration and Unit. The default directory where the cases should be is /Tests within the module under development. For integration tests use the "test + type + Test" naming standard, for example: LoginIntegrationTest (test: Login, type: Integration)., (*8)

Run the tests using the command referencing the testsuite as 'unit' or 'integration':, (*9)

$ phpunit --testsuite integration
$ phpunit --testsuite unit

Contributions

The purpose of this repository is to create a fast model for implementing REST APIs using the Lumen Framework. We still have enough to get close to an "ideal" model: rules for accessing endpoints, improving standards, writing tests, translations, etc., (*10)

Fork, enjoy and join us in this project! Send yours pull requests, share to your friends.

The Versions

21/11 2017

dev-master

9999999-dev

Lumen API skeleton with JWT to manager tokens, Socialite to OAuth Providers, MongoDB driver and Predis to Redis cache storage.

  Sources   Download

MIT

The Requires

 

The Development Requires

mongodb api lumen oauth jwt socialite

31/08 2017

dev-1.0-dev

dev-1.0-dev

Lumen API skeleton with JWT to manager tokens, Socialite to OAuth Providers, MongoDB driver and Predis to Redis cache storage.

  Sources   Download

MIT

The Requires

 

The Development Requires

mongodb api lumen oauth jwt socialite