This project is a simple RESTful API for managing a to-do list. It is built using pure PHP and follows basic API development principles. The API provides functionality to create, read, update, and delete tasks.
- Create a new to-do item
- Get a list of all to-do items
- Update a specific to-do item
- Delete a specific to-do item
- PHP 8.3
- MySQL or any other database
- Web server (Apache/Nginx)
Clone the repository:
git clone https://github.com/Asrez/php-todo-list-api.git
Navigate to the project directory:
cd php-todo-list-api
Configure the database connection by updating the database settings in config.php.
Import the todo_list.sql
file into your database to set up the table structure.
- List All Tasks
URL: /tasks
Method: GET
Response: List of all tasks in JSON format.
- Get a Single Task
URL: /task/{id}
Method: GET
Response: JSON object of the task with the specified id.
- Create a Task
URL: /task
Method: POST
Parameters:
- title: (string) Task title.
- description: (string) Task description.
- Response: JSON object of the created task.
- Update a Task
URL: /task/{id}
Method: PUT
Parameters:
- title: (string) Task title.
- description: (string) Task description.
Response: JSON object of the updated task.
- Delete a Task
URL: /task/{id}
Method: DELETE
Response: Success message in JSON format.
Copyright 2024, asrez team