Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/javi-cc/laravel-api-crud-template
Laravel 10 API CRUD USERS TEMPLATE
https://github.com/javi-cc/laravel-api-crud-template
api cache-data docker email-sender excel-export factories laravel middleware multi-language observers pdf-export php8 phpunit policies postman sanctum seeders testing traits uuid
Last synced: about 2 months ago
JSON representation
Laravel 10 API CRUD USERS TEMPLATE
- Host: GitHub
- URL: https://github.com/javi-cc/laravel-api-crud-template
- Owner: JAVI-CC
- Created: 2023-11-22T15:36:25.000Z (about 1 year ago)
- Default Branch: master
- Last Pushed: 2024-07-27T13:20:15.000Z (6 months ago)
- Last Synced: 2024-10-31T04:22:51.927Z (3 months ago)
- Topics: api, cache-data, docker, email-sender, excel-export, factories, laravel, middleware, multi-language, observers, pdf-export, php8, phpunit, policies, postman, sanctum, seeders, testing, traits, uuid
- Language: PHP
- Homepage:
- Size: 236 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Application made with Laravel 10 that consists of the creation of a CRUD of a user and system authentication api that contains the following functionalities:
- Relationships between different models.
- Primary key format UUID.
- Contains endpoints of type GET, POST, PUT and DELETE
- Postman collection.json file to import and create use endpoints.
- Requests validations.
- Exception handling.
- Feature testing.
- Redis Cached data and Queues
- Email sending Notification to recovery password.
- Email sending notification to verify the user.
- Queues and Jobs.
- Factories.
- Enums.
- Traits.
- Middleware.
- Policies.
- Observers.
- Cached data.
- File Storage.
- Notifications with broadcast.
- Exports in Excel and PDF format.
- Blade Email Templates.
- Multi language support.
- Migration file to create all the tables in the database.
- Seeders are in JSON format.
- PHP 8.2.*
- Search filters of the games that are inserted in the database.
- Websockets with Pusher.
- Users contain different roles and permissions.
- The project contains the files to deploy it in Docker.
Headers
Key
Value
Authorization
{Token provided by Sanctum}
Accept
application/json
Content-Type
application/json
Accept-Language
['en', 'es']
Setup
$ composer install && php artisan key:generate && php artisan storage:link && php artisan migrate --seed && php artisan test
User admin credentials
User: [email protected]
Password: password
Endpoints Auth:
Method
Path
Description
Auth
Is Admin
POST
/api/auth/login
Login a user
No
No
GET
/api/auth/check
Check if user authenticated
Yes
No
GET
/api/auth/logout
Log out a user
Yes
No
POST
/api/auth/change/password
Change the password for the authenticated user
Yes
No
POST
/api/auth/recovery/password
An email is sent to reset the password
No
No
POST
/api/user/verification/email/notification
Sending an email to confirm the verification of the authenticated user
Yes
No
GET
/api/user/verification/email/{id}/{hash}
Verify authenticated user
Yes
No
Endpoints Users:
Method
Path
Description
Auth
Is Admin
GET
/api/user
Get all the users
Yes
Yes
GET
/api/user/{id}
Get a user
Yes
Yes
POST
/api/user
Add new user
Yes
Yes
PUT
/api/user/{id}
Update a user
Yes
Yes
DELETE
/api/user/{id}
Delete a user
Yes
Yes
GET
/api/user/export/excel
Export all users in Excel format
Yes
Yes
GET
/api/user/export/pdf
Export all users in Pdf format
Yes
Yes
Endpoints Roles:
Method
Path
Description
Auth
Is Admin
GET
/api/roles
Get all the roles
Yes
Yes
Configure values in the .env file
APP_URL="http://localhost:8000"
DB_CONNECTION=""
DB_HOST=""
DB_PORT=""
DB_DATABASE=""
DB_USERNAME=""
DB_PASSWORD=""
DB_TEST_CONNECTION=""
DB_TEST_HOST=""
DB_TEST_PORT=""
DB_TEST_DATABASE=""
DB_TEST_USERNAME=""
DB_TEST_PASSWORD=""
PUSHER_APP_ID=""
PUSHER_APP_KEY=""
PUSHER_APP_SECRET=""
PUSHER_APP_CLUSTER=""
QUEUE_CONNECTION=""
CACHE_DRIVER=""
MAIL_MAILER=""
MAIL_HOST=""
MAIL_PORT=""
MAIL_USERNAME=""
MAIL_PASSWORD=""
MAIL_FROM_ADDRESS=""
REDIS_CLIENT=""
REDIS_HOST=""
REDIS_PASSWORD=""
REDIS_PORT=""
DOMAIN_FRONTEND="http://localhost:9000"
Deploy to Docker 🐳
Docker repository: https://hub.docker.com/r/javi98/laravel-api-crud-template
Containers:
-
php:8.2.13-fpm -:9000
-
nginx:alpine -:8000->80/tcp
-
mariadb:11.2.2 -:3306
-
mailhog:v1.0.1 -:1025 # smtp server
:8025 # web ui
-
soketi:1.6-16-debian -:6001 # soketi port
:9601
-
redis:7.2.4 -:6379
-
phpmyadmin:5.2.1 -:8085->80/tcp
Containers structure:
├── laravel-api-crud-template-app
├── laravel-api-crud-template-web
├── laravel-api-crud-template-db
├── laravel-api-crud-template-smtp
├── laravel-api-crud-template-soketi
├── laravel-api-crud-template-redis
└── laravel-api-crud-template-phpmyadmin
Setup:
$ git clone https://github.com/JAVI-CC/Laravel-API-CRUD-Template.git
$ cd Laravel-API-CRUD-Template
$ cp .env.example .env
$ docker compose up -d
$ docker compose exec app chmod +x ./docker-config/run.sh
$ docker compose exec app ./docker-config/run.sh
In case you are using your IDE to develop the application and it odes not detect the files it contains within the vendor folder, you have to copy the files from the vendor folder of the container to the host machine with the following command.
$ docker compose cp app:/var/www/vendor .
Once you have the containers deployed, you can access the API at http://localhost:8000