Package Data | |
---|---|
Maintainer Username: | alissonphp |
Package Create Date: | 2017-08-10 |
Package Last Update: | 2017-11-21 |
Home Page: | https://alissonphp.me |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-12-15 15:13:27 |
Package Statistics | |
---|---|
Total Downloads: | 8 |
Monthly Downloads: | 0 |
Daily Downloads: | 0 |
Total Stars: | 21 |
Total Watchers: | 2 |
Total Forks: | 5 |
Total Open Issues: | 0 |
Basic structure for creating REST APIs using Lumen Framework and extra packages
$ 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).
$ 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
The application is architected in Modules. Each module has defined responsibility and Layers. The standard model of a module follows the following structure:
app
└───Modules
│ │ Controllers
│ │ Events
│ │ Listeners
│ │ Middlewares
│ │ Models
│ │ Supports
│ │ Tests
│ │ routes.php
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.
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.
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).
Run the tests using the command referencing the testsuite as 'unit' or 'integration':
$ phpunit --testsuite integration
$ phpunit --testsuite unit
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.