A simple API-based application for managing to-do lists built with Laravel 11, and utilizing Laravel Sanctum for secure authentication.
- User Registration and Authentication via Laravel Sanctum
- CRUD operations for User
- CRUD operation for ToDos
- User specific ToDo lists
- ToDo Completion (Marking a ToDo item as Completed)
- Clone the repository
- Run
composer install - Set up the database connection in
.envfile - Run
php artisan migrate --seed - Start the server with
php artisan serve
- Register a new User:
POST /api/register - Login:
POST /api/login - Get current User info:
GET /api/me - Logout:
POST /api/logout
- Read all User:
GET /api/users - Read User by ID:
GET /api/users/{user} - Update User:
PUT /api/users/{user} - Change password:
PUT /api/change-password - Delete User:
DELETE /api/users/{user}
- Get ToDo items:
GET /api/user/todos - Get ToDo item by ID:
GET /api/user/todos/{todo}
- Create new Todo item
POST /api/todos - Read all ToDo item:
GET /api/todos - Read Todo item by ID:
GET /api/todos/{todo} - Update ToDo item by ID:
PUT /api/todos/{todo} - Update ToDo item's status:
PUT /api/todos/{todo}/completed - Delete ToDo item:
DELETE api/todos/{todo}
- Attributes:
username,email,password - Relationships:
todos
- Attributes:
title,description,status - Relationships:
users
AuthController: Handles authentication endpointsUserController: Handles User-related endpointsTodoController: Handles ToDo-related endpointsTodoUserController: Handles ToDo-User relationship endpoints
- Implement proper authentication and authorization checks using Laravel Sanctum
- Validate input data on both client-side and server-side
- Use HTTPS for all API communications
- Implement rate limiting to prevent abuse
Run php artisan test to execute the PHPUnit tests.
Contributions are welcome! Feel free to open an issue or submit a pull request.
This project is open-sourced software licensed under the MIT license.