Allows users to fetch random quotes from an external API, save their favorites, and manage them via CRUD operations with proper authentication.
- PHP 8.4.3
- Laravel Framework 12.2.0
- Composer 2.8.6
- MySQL (Port 8889) Ver 8.0.40 for macos12.7 on arm64 (Source distribution)
- MAMP Pro
-
Clone this repository to your local machine:
git clone https://github.com/sereitepy/laravel-quote-management.git cd quote-management
-
My
.env
file: according to what my MAMP settings are.DB_CONNECTION=mysql DB_HOST=127.0.0.1 DB_PORT=8889 DB_DATABASE=quote-management DB_USERNAME=root DB_PASSWORD= DB_SOCKET=/Applications/MAMP/tmp/mysql/mysql.sock
-
Run database migrations:
php artisan migrate
-
Start the development server:
php artisan serve
- Set Headers
Accept: application/json
for ALL requests - For authenticated endpoints, set Headers
Authorization: Bearer {your_token}
after logging in - The random quotes endpoint may take around 5 seconds to respond as it fetches 10 quotes from an API that fetches 1 quote at a time. 'https://zenquotes.io/api/random'

{
"name": "animalLover",
"email": "[email protected]",
"password": "password123"
}

- The database should include the user that has been registered. In this image, it should include:
{ "user": { "name": "animalLover", "email": "[email protected]", "updated_at": "2025-03-15T04:59:09.000000Z", "created_at": "2025-03-15T04:59:09.000000Z", "id": 4 }, "token": "3|U6vPECcKOb6l4q1lFInB3txz1NWWP2UVDkvVuIQw7c65ff5a" }

{
"email": "[email protected]",
"password": "password123"
}
Important: Save the token returned as it's required for all authenticated requests!
- Note: This request takes around 5 seconds as it fetches 10 quotes

{
"content": "We think too much and feel too little.",
"author": "Charlie Chaplin"
}

- The database should contain the saved quote


- The saved quote id is: 3

- Inside the database, the 'Quotes', should be empty.

app/Http/Controllers/
- Contains all the controllersapp/Models/
- Database modelsdatabase/migrations/
- Database migrationsroutes/api.php
- API route definitions
- User registration and authentication using Laravel Sanctum
- Integration with ZenQuotes API to fetch random quotes 'https://zenquotes.io/api/random'
- CRUD operations for managing favorite quotes
- Form validation and error handling
- Token-based API authentication
This project implements:
- Password hashing using Laravel's built-in mechanisms
- Protected API routes using Sanctum middleware
- Input validation for all endpoints
- Protection against common vulnerabilities (CSRF, XSS, SQL Injection)
The Laravel framework is open-sourced software licensed under the MIT license.