This project is a simple RESTful API built using the Lumen micro-framework by Laravel. The project allows the management of profiles with full CRUD (Create, Read, Update, Delete) functionality, including associated attributes for each profile. Security is ensured through Bearer token authentication for all requests other than GET.
- PHP 8.1
- Lumen 8.x
- MySQL 8.0
- Docker
- Composer
- PHPUnit for testing
- Docker and Docker Compose installed on your machine
- Git
Copy the .env.dist file to .env and the .env.testing.dist file to .env.testing.
cp .env.dist .env
cp .env.testing.dist .env.testing
Make sure Docker is running. Then, run the following command to build and start the containers.
docker compose up --build -d
Once the containers are running, execute the migrations to set up the database.
bin/docker/artisan migrate
bin/docker/artisan migrate --env=testing
The repository includes a LumenAPI.postman_collection.json file that can be imported into Postman to easily test the APIs. Import this file into your Postman.
bin/docker/phpunit
You can now interact with the APIs using Postman or any other HTTP client. Make sure to include the Bearer token for requests.
- GET /api/profiles - Retrieve all profiles
- POST /api/profiles - Create a new profile
- GET /api/profiles/{id} - Retrieve a specific profile
- PUT /api/profiles/{id} - Update a specific profile
- DELETE /api/profiles/{id} - Delete a specific profile
- Log Middleware: Logs every request to a log file.
- Auth Middleware: Verifies the presence of a Bearer token for all requests.
For every CRUD operation, an event is fired which writes a log entry to the app/storage/logs/access.log file.
- Name: Gabriele Boni
- Email: [email protected]