{"id":17797430,"url":"https://github.com/edsonmsouza/php-api-to-do-list","last_synced_at":"2025-03-17T04:31:28.501Z","repository":{"id":37620947,"uuid":"412892040","full_name":"EdsonMSouza/php-api-to-do-list","owner":"EdsonMSouza","description":"This API provides functionality for creating and maintaining users to control a simple To-Do-List application. The following shows the API structure for users and tasks resources.","archived":false,"fork":false,"pushed_at":"2023-05-11T04:06:46.000Z","size":20483,"stargazers_count":12,"open_issues_count":0,"forks_count":11,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-27T17:44:18.081Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"cc-by-sa-4.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/EdsonMSouza.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-10-02T19:22:56.000Z","updated_at":"2024-05-28T21:32:58.000Z","dependencies_parsed_at":"2024-10-27T12:13:42.974Z","dependency_job_id":null,"html_url":"https://github.com/EdsonMSouza/php-api-to-do-list","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EdsonMSouza%2Fphp-api-to-do-list","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EdsonMSouza%2Fphp-api-to-do-list/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EdsonMSouza%2Fphp-api-to-do-list/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EdsonMSouza%2Fphp-api-to-do-list/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/EdsonMSouza","download_url":"https://codeload.github.com/EdsonMSouza/php-api-to-do-list/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243841210,"owners_count":20356443,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-27T11:55:52.664Z","updated_at":"2025-03-17T04:31:28.493Z","avatar_url":"https://github.com/EdsonMSouza.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PHP API TO-DO-LIST v.2.0\n\n\u003ccode\u003e\u003cimg height=\"50\" src=\"https://raw.githubusercontent.com/github/explore/80688e429a7d4ef2fca1e82350fe8e3517d3494d/topics/php/php.png\"\u003e\u003c/code\u003e\n\u003ccode\u003e\u003cimg height=\"50\" src=\"https://raw.githubusercontent.com/github/explore/80688e429a7d4ef2fca1e82350fe8e3517d3494d/topics/mysql/mysql.png\"\u003e\u003c/code\u003e\n\nThis API aims to present a brief to consume an API resources, mainly for students in the early years of Computer Science courses and the like. For this reason, it has few EndPoints to use, and can be expanded according to the need.\n\nThe API have two features: \"**USER**\" and \"**TASK**\". The aim is that a user can register their to-do list, performing basic data manipulation on both resources. As a bonus, the API allows, after creating the user, sending an image to the user's profile.\n\nAs it is an instructional project, **it is not recommended** that it be applied in a production environment, as safety routines and tests have not been implemented. These resources must be researched and implemented, following the current rules, in addition to good practices. Built in **PHP 7** (see below), it allows the beginner to understand the mechanisms of access to the resources of an API.\n\n```html\nPHP 7.4.3 (cli) (built: Jul  5 2021 15:13:35) ( NTS )\nCopyright (c) The PHP Group Zend Engine v3.4.0, \nCopyright (c) Zend Technologies with Zend OPcache v7.4.3, \nCopyright (c), by Zend Technologies\n```\n\n## How to use this content?\n\nThis content has _free license for use_ (CC BY-SA 4.0).\n\nIf you want to collaborate in this repository with any improvements you have made. To do this, just make a Fork and send Pull Requests.\n\n## Composer\n\nChanges should be updated via \u003ccode\u003ecomposer dump-autoload -o\u003c/code\u003e on your local machine.\n\n## Documentation\n\nThis API provides functionality for creating and maintaining users to control a simple To-Do-List application. The following shows the API structure for **users** and **tasks** resources.\n\n## API Structure\n\n```text\n+---api\n    \\task\\\n        ---delete\n        ---edit\n        ---new\n        ---search\n        ---update\n    \\user\\\n        ---new\n        ---login\n        ---update\n        ---updateuserpass\n        ---delete\n+---src\n    \\---Database\n    \\---Helpers\n    \\---Task\n    \\---User\n\\---vendor\n    \\---composer\n```\n\n## Database\n\nThe development uses the MySQL 5, which can be changed at any time according to the need for use. The database should be\nconfigured in \u003ccode\u003eDatabase\\Database.php\u003c/code\u003e\n\n### Scripts SQL\n\n```sql\nCREATE DATABASE name;\n```\n\n```sql\nCREATE TABLE users\n(\n    id       INT(3)         NOT NULL PRIMARY KEY AUTO_INCREMENT,\n    name     VARCHAR(50)    NOT NULL,\n    email    VARCHAR(50)    NOT NULL,\n    username VARCHAR(32)    NOT NULL,\n    password VARCHAR(32)    NOT NULL,\n    token    VARCHAR(20)    NOT NULL,\n    picture  TEXT           DEFAULT NULL\n);\n```\n\n```sql\nCREATE TABLE tasks\n(\n    id       INT(3)         NOT NULL PRIMARY KEY AUTO_INCREMENT,\n    userId   INT(3)         NOT NULL,\n    name     VARCHAR(50)    NOT NULL,\n    date     date           NOT NULL,\n    realized INT(1)         NOT NULL\n);\n```\n\nAttention: in order to delete corresponding tasks to user you need to do a ```ALTER TABLE``` adding a ```FOREIGN KEY``` and ```ON DELETE CASCADE``` option.\n\n```sql\nALTER TABLE tasks\nADD CONSTRAINT pk_user\nFOREIGN KEY (userId)\nREFERENCES users(id)\nON DELETE CASCADE;\n```\n\n## Token\n\nTo use this API, a user must first be created with resource below.\n\nA TOKEN will be returned that should be used in all subsequent requests for both user and task data manipulation.\n\n## Domain\n\nThe `domain` variable must be filled with the address where the API will be made available like: (\u003ccode\u003ehttps://**domain**/api/{resource}/{parameter}\u003c/code\u003e)\n\n# __User__ resources\n\n## **NEW**\n\n* parameter: **user/new**/\n* method: **post**\n* payload\n\n  ```json\n  {\n    \"name\": \"name\",\n    \"email\": \"email\",\n    \"username\": \"username\",\n    \"password\": \"password\"\n  }\n  ```\n\n* header\n\n  ```json\n  {\"content-type\": \"application/json\"}\n  ```\n\n* success\n\n  ```json\n  {\n    \"message\": \"User Successfully Added\",\n    \"id\": \"user_id\",\n    \"token\": \"YOUR_TOKEN\"\n  }\n  ```\n\n* warnings\n\n  ```json\n  {\"message\": \"Invalid Arguments Number (Expected Four)\"}\n  {\"message\": \"Could Not Add User\"}\n  {\"message\": \"Missing data in one or more fields\"}\n  {\"message\": \"User Already Exists\"}\n  ```\n\n## **LOGIN**\n\n* parameter: **user/login**/\n* method: **post**\n* payload\n\n  ```json\n  {\n    \"username\": \"username\",\n    \"password\": \"password\"\n  }\n  ```\n\n* header\n\n  ```json\n  {\"content-type\": \"application/json\"}\n  ```\n\n* success\n\n  ```json\n  {\n    \"id\": 1,\n    \"name\": \"John Doe\",\n    \"email\": \"john.doe@domain.com\",\n    \"token\": \"YOUR_TOKEN\",\n    \"picture\": \"BASE64_STRING\"\n  }\n  ```\n\n* warnings\n\n  ```json\n  {\"message\": \"Invalid Arguments Number (Expected Two)\"}\n  {\"message\": \"Incorrect username and/or password\"}\n  ```\n  \n## **UPDATE**\n\n* parameter: **user/update/**\n* method: **put**\n* payload\n\n  ```json\n  {\n    \"name\": \"name\",\n    \"email\": \"email\",\n    \"username\": \"username\",\n    \"password\": \"password\",\n    \"picture\": \"BASE64_STRING\" or \"\"\n  }\n  ```\n\n* header\n\n  ```json\n  {\n    \"content-type\": \"application/json\",\n    \"Authorization\": \"YOUR_TOKEN\"\n  }\n  ```\n\n* success\n\n  ```json\n  {\"message\": \"User Successfully Updated\"}\n  ```\n\n* warnings\n\n  ```json\n  {\"message\": \"Invalid Arguments Number (Expected Five)\"}\n  {\"message\": \"Incorrect username and/or password\"}\n  {\"message\": \"Could Not Update User\"}\n  ```\n\n## **UPDATE USERNAME/PASSWORD**\n\n* parameter: **user/updateuserpass/**\n* method: **put**\n* payload\n\n  ```json\n  {\n    \"username\": \"username\",\n    \"password\": \"password\",\n    \"new_username\": \"new_username\",\n    \"new_password\": \"new_password\"  \n  }\n  ```\n\n* header\n\n  ```json\n  {\n    \"content-type\": \"application/json\",\n    \"Authorization\": \"YOUR_TOKEN\"\n  }\n  ```\n\n* success\n\n  ```json\n  {\"message\": \"User/password Successfully Updated\"}\n  ```\n\n* warnings\n\n  ```json\n  {\"message\": \"Invalid Arguments Number (Expected Four)\"}\n  {\"message\": \"Incorrect username and/or password\"}\n  {\"message\": \"Could Not Update Username/password\"}\n  ```\n\n## **DELETE**\n\n* parameter: **user/delete/**\n* method: **delete**\n* payload\n\n  ```json\n  {\n    \"username\": \"username\",\n    \"password\": \"password\"\n  }\n  ```\n\n* header\n\n  ```json\n  {\n    \"content-type\": \"application/json\",\n    \"Authorization\": \"YOUR_TOKEN\"\n  }\n  ```\n\n* success\n\n  ```json\n  {\"message\": \"User Successfully Deleted\"}\n  ```\n\n* warnings\n\n  ```json\n  {\"message\": \"Invalid Arguments Number (Expected Two)\"}\n  {\"message\": \"Incorrect username and/or password\"}\n  {\"message\": \"Could Not Delete User\"}\n  ```\n\n# __Task__ resources\n\n## **NEW**\n\n* parameter: **task/new**/\n* method: **post**\n* payload\n\n  ```json\n  {\"name\": \"Task name\"}\n  ```\n\n* header\n\n  ```json\n  {\n    \"content-type\": \"application/json\",\n    \"Authorization\": \"YOUR_TOKEN\"\n  }\n  ```\n\n* success\n\n  ```json\n  {\"message\": \"Task Successfully Added\"}\n  ```\n\n* warnings\n\n  ```json\n  {\"message\": \"Invalid Arguments Number (Expected One)\"}\n  {\"message\": \"Could Not Add Task\"}\n  ```\n\n## **SEARCH**\n\n* parameter: **task/search**/\n* method: **post**\n* payload\n  * Payload is not necessary, as the control is performed by `token`.\n  * Realized field accept values: `0` (open) or `1` (realized)\n\n* header\n\n  ```json\n  {\n    \"content-type\": \"application/json\",\n    \"Authorization\": \"YOUR_TOKEN\"\n  }\n  ```\n\n* success\n\n  ```json\n  [\n    {\n      \"id\": 1,\n      \"userId\": 1,\n      \"name\": \"task name\",\n      \"date\": \"2021-08-16\",\n      \"realized\": 0\n    }\n  ]\n  ```\n\n* Warnings\n\n  ```json\n  {\"message\": \"Task(s) not found\"}\n  ```\n\n## **UPDATE**\n\n* parameter: **task/update**/\n* method: **put**\n* payload\n\n  ```json\n  {\n    \"id\": \"value\",\n    \"name\": \"Task name\",\n    \"realized\": \"value\"\n  }\n  ```\n\n* header\n\n  ```json\n  {\n    \"content-type\": \"application/json\",\n    \"Authorization\": \"YOUR_TOKEN\"\n  }\n  ```\n\n* Success\n\n  ```json\n  {\"message\": \"Task Successfully Updated\"}\n  ```\n\n* Warnings\n\n  ```json\n  {\"message\": \"Task(s) not found\"}\n  {\"message\": \"Method Not Allowed\"}\n  {\"message\": \"Invalid Arguments Number (Expected Three)\"}\n  ```\n\n## **EDIT**\n\n* parameter: **task/edit**/\n* method: **put**\n* payload\n\n    ```json\n    {\"id\": \"value\"}\n    ```\n\n* header\n\n  ```json\n  {\n    \"content-type\": \"application/json\",\n    \"Authorization\": \"YOUR_TOKEN\"\n  }\n  ```\n\n* Success\n\n  ```json\n  {\n  \"id\": 2,\n  \"userId\": 1,\n  \"name\": \"Task name\",\n  \"date\": \"2021-08-16\",\n  \"realized\": 0\n  }\n  ```\n\n* Warnings\n\n  ```json\n  {\"message\": \"Payload Precondition Failed\"}\n  {\"message\": \"Invalid or Missing Token\"}  \n  {\"message\": \"Invalid Arguments Number (Expected One)\"}\n  {\"message\": \"Bad Request (Invalid Syntax)\"}\n  {\"message\": \"Token Refused\"}\n  ```\n\n## **DELETE**\n\n* parameter: **task/delete**/\n* method: **delete**\n\n* payload\n\n  ```json\n  {\"id\": \"id_task\"}\n  ```\n\n* header\n\n  ```json\n  {\n    \"content-type\": \"application/json\",\n    \"Authorization\": \"YOUR_TOKEN\"\n  }\n  ```\n\n* Success\n\n  ```json\n  {\"message\": \"Task deleted Successfully\"}\n  ```\n\n* Warnings\n\n  ```json\n  {\"message\": \"Task not exist\"}\n  {\"message\": \"Payload Precondition Failed\"}\n  {\"message\": \"Invalid or Missing Token\"}  \n  {\"message\": \"Invalid Arguments Number (Expected One)\"}\n  ```\n\n\n### Other Warnings\n\n```json\n{\"message\": \"Bad Request (Invalid Syntax)\"}\n{\"message\": \"Token Refused\"}\n{\"message\": \"Invalid or Missing Token\"}\n{\"message\": \"Method Not Allowed\"}\n{\"message\": \"\u003cSQL Code\u003e\"}\n{\"message\": \"\u003cUnknown\u003e\"}\n```\n\n\n\u003ca name=\"tryonline\"\u003e\u003c/a\u003e\n\n# Try Online\n\nYou can try online this API with full features.\n\n* URI: [https://todolist-api.edsonmelo.com.br/api/](https://todolist-api.edsonmelo.com.br/api/)\n\n---\n\n## Flutter APP ToDoList\n\nYou can test the API functionalities by accessing [here](https://github.com/Wilian-N-Silva/flutter_to_do_list) the APP developed by [Wilian Silva](https://github.com/Wilian-N-Silva).\n\n### Views\n\n![Alt text](images/telas.png \"APP Views\")\n___\n\n## How to cite this content\n\n```\nDE SOUZA, Edson Melo (2021, August 16). PHP API TO-DO-LIST v.2.0.\nAvailable in: https://github.com/EdsonMSouza/php-api-to-do-list\n```\n\nOr BibTeX for LaTeX:\n\n```latex\n@misc{desouza2020phpapi,\n  author = {DE SOUZA, Edson Melo},\n  title = {PHP API TO-DO-LIST v.2.0},\n  url = {https://github.com/EdsonMSouza/php-api-to-do-list},\n  year = {2021},\n  month = {August}\n}\n```\n\n## Acknowledgements\n\n* [Arthur Timoteo](https://github.com/arthur-timoteo)\n  \n* [Wilian Silva](https://github.com/Wilian-N-Silva)\n\n## License\n\n[![CC BY-SA 4.0][cc-by-sa-shield]][cc-by-sa]\n\nThis work is licensed under a\n[Creative Commons Attribution-ShareAlike 4.0 International License][cc-by-sa].\n\n[![CC BY-SA 4.0][cc-by-sa-image]][cc-by-sa]\n\n[cc-by-sa]: http://creativecommons.org/licenses/by-sa/4.0/\n\n[cc-by-sa-image]: https://licensebuttons.net/l/by-sa/4.0/88x31.png\n\n[cc-by-sa-shield]: https://img.shields.io/badge/License-CC%20BY--SA%204.0-lightgrey.svg\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fedsonmsouza%2Fphp-api-to-do-list","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fedsonmsouza%2Fphp-api-to-do-list","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fedsonmsouza%2Fphp-api-to-do-list/lists"}