8000 GitHub - thaivanan/Laravel-API-Server: Laravel 8 API CRUD and connected to a Mysql database and Api documentation Swagger 3.0
[go: up one dir, main page]

Skip to content

Laravel 8 API CRUD and connected to a Mysql database and Api documentation Swagger 3.0

Notifications You must be signed in to change notification settings

thaivanan/Laravel-API-Server

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
< 8000 a title="docker-compose" aria-label="docker-compose, (Directory)" class="Link--primary" href="/thaivanan/Laravel-API-Server/tree/master/docker-compose">docker-compose
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status Total Downloads Latest Stable Version License

Application made with Laravel 8 that consists of the creation of a CRUD of a games api that contains the following functionalities:

  • Relationships between different models with polymorphic tables.
  • Contains endpoints of type GET, POST, PUT and DELETE
  • Some endpoints contain the function of sending files and the files are stored locally.
  • Implementation of API Dropbox in the dropbox branch the difference with the master branch is that in the dropbox branch it is configured so that the files that are sent through the api are saved in a shared Dropbox directory instead of a local directory of the project.
  • Postman collection.json file to import and create use endpoints.
  • Resource file to show the values of some endpoints in a personalized way.
  • Requests validations.
  • Exception handling.
  • Migration file to create all the tables in the database.
  • File seeder with +50 games to insert the data into the database.
  • Seeders are in JSON format
  • It is compatible with PHP 8
  • Search filters of the games that are inserted in the database.
  • Documentation of all the api enpoints with the Laravel Swagger 3.0.
  • Users can be registered through the Api and it contains authentication by Sanctum to be able to carry out the action of some endpoints.
  • The Api is uploaded in heroku https://laravelapijuegos.herokuapp.com so that users can use the endpoints without having to download the project.
  • The project contains the files to deploy it in Docker.
  • Demonstration of a Laravel project on the client interface side using this api https://github.com/JAVI-CC/Laravel-API-Client.
  • Demonstration of a Quasar Framework project on the client interface side using this api https://github.com/JAVI-CC/Quasar-API-client.

Demo API

https://laravelapijuegos.herokuapp.com

Documentation API SWAGGER 3.0

http://laravelapijuegos.herokuapp.com/api/documentation

Laravel Api client interface

https://github.com/JAVI-CC/Laravel-API-Client

Quasar Framework Api client interface

https://github.com/JAVI-CC/Quasar-API-client

Headers

Key Value
Authorization {Token provided by Sanctum}
Accept application/json
Content-Type application/json

Setup

$ composer install && php artisan key:generate && php artisan migrate --seed

Endpoints Games:

Method Path Description Auth
GET /api/juegos Get all the games No
POST /api/juegos/ Add a game Yes
GET /api/juegos/{slug} Get a game No
PUT /api/juegos/edit Update game without uploading the image Yes
POST /api/juegos/edit Update a game with the included image Yes
DELETE /api/juegos/delete/{slug} Delete a game Yes
POST /api/juegos/filter/search Search games No
GET /api/juegos/desarrolladoras/{slug} Get games from a developer No
GET /api/juegos/generos/{slug} Get games from a genere No
GET /api/juegos/generos/show/all Get list all generes No
GET /api/juegos/paginate Get paginate games No
GET /api/juegos/random Get random games No

Endpoints User:

Method Path Description Auth
POST /api/auth/register Register a user No
POST /api/auth/login Login a user No
GET /api/auth/userinfo To view a user information Yes
POST /api/auth/logout Log out a user Yes

Deploy to Docker 🐳

Containers:

  • nginx:alpine - :8000->80/tcp
  • mariadb:latest - :3306
  • php:8.0.6-fpm - :9000

Containers structure:

├── laravel-api-server-app
├── laravel-api-server-web
└── laravel-api-server-db

Setup:

$ git clone https://github.com/JAVI-CC/Laravel-API-Server.git
$ cd Laravel-API-Server
$ cp .env.example .env
$ docker-compose up -d
$ docker-compose exec --user=root app chmod -R 777 /var/www/
$ docker-compose exec app composer install
$ docker-compose exec app php artisan key:generate
$ docker-compose exec app php artisan migrate --seed

Once you have the containers deployed, you can access the API at http://localhost:8000

About

Laravel 8 API CRUD and connected to a Mysql database and Api documentation Swagger 3.0

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 99.3%
  • Other 0.7%
0