Custom from Lumen
- PHP latest version
- MariaDB or MySQL latest version
- git
- composer
-
Clone this repository
-
User terminal or command line
-
Execute
cp .env.example .env -
Edit database connection
DB_HOST=127.0.0.1 DB_PORT=3306 DB_DATABASE=database_name DB_USERNAME=database_user DB_PASSWORD=database_password -
Execute
composer install -
Execute
php artisan migrate -
Execute
php artisan db:seed -
Execute
php artisan jwt:secret
php -S 0.0.0.0:8000 -t public
To reduce the number of line on controller in this project, bussines process is separated into Readers and Handlers.
-
Handlersis used to accomodate business process related tochangingdata into database. -
Readersis used to accomodate business process related togettingdata from database. -
On
Corefelder also added some files:Handler.phpis interface class as the parent class ofHandlerclasses.Reader.phpis interface class as the parent class ofReaderclasses.HasPaginate.phpis trait class as Pagination Helper.PagedList.phpis helper class as custom response pagination from LengthAwarePaginator, this changed relate with return on the controller.
-
ApiController.phpis a custom of the existingController, with added several helper methods to handle the standard response.
- app
- Core
- Handlers (directory)
- Readers (directory)
- Handler.php
- HasPaginate.php
- PagedList.php
- Reader.php
- Http
- Controllers
- ApiController.php
php artisan make:modelCreate a new Eloquent model classphp artisan jwt:secretSet the JWTAuth secret key used to sign the tokens