{"id":17024944,"url":"https://github.com/devatreides/php-api-rest","last_synced_at":"2026-05-03T01:41:31.524Z","repository":{"id":143574588,"uuid":"529372952","full_name":"devatreides/php-api-rest","owner":"devatreides","description":"A simple API REST application with PHP","archived":false,"fork":false,"pushed_at":"2022-08-26T18:57:03.000Z","size":13,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-27T22:53:57.181Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/devatreides.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2022-08-26T18:54:21.000Z","updated_at":"2022-08-26T18:54:51.000Z","dependencies_parsed_at":null,"dependency_job_id":"c9ed9dc4-c817-4d38-8129-34149bc64035","html_url":"https://github.com/devatreides/php-api-rest","commit_stats":null,"previous_names":["devatreides/php-api-rest"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devatreides%2Fphp-api-rest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devatreides%2Fphp-api-rest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devatreides%2Fphp-api-rest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devatreides%2Fphp-api-rest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/devatreides","download_url":"https://codeload.github.com/devatreides/php-api-rest/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245006269,"owners_count":20546133,"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-14T07:27:32.443Z","updated_at":"2025-10-22T10:51:27.686Z","avatar_url":"https://github.com/devatreides.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n    \u003cimg src=\"https://banners.beyondco.de/API%20App.png?theme=light\u0026packageManager=\u0026packageName=by+Tom+Benevides\u0026pattern=architect\u0026style=style_1\u0026description=A+simple+API+REST+app+with+PHP\u0026md=1\u0026showWatermark=0\u0026fontSize=100px\u0026images=document-add\" width=\"600\" alt=\"PHP-Video-Maker\"\u003e\n\u003c/p\u003e\n\n------\n\n## Prerequisites\n\n- PHP 8.1\n- PostgreSQL\n\n## Installation\n\n- Clone the repository\n- Install de dependencies running `composer install`\n- Run the migrations with `./vendor/bin/doctrine-migrations migrate --configuration ./src/Config/migrations.php --db-configuration ./src/Config/database.php`\n- Up the server with `php -S localhost:8000 -t public/index.php`\n\n### docker\n\nIf you want to use docker, you can make use of the `build` script in the root of the project. It will run simplier commands to up the server:\n\n- `./build composer install` to install the dependencies\n- `./build migrations migrate` to run the migrations (Change host value in `./src/Config/database.php` to `host.docker.internal`)\n- `./build serve` to up the server\n\np.s. The `build` script will only run the application in container. To run the migrations, you need to have the database up and running.\n\n## Usage\n\nThe API has several endpoints to manage users. The user has to types: *admin* and *user*. The *admin* can do everything that the *user* can do and more. The endpoints and their details are listed below:\n\n- `POST /login` to authenticate the user\n  - who can use: *admin* and *user*\n  - headers: `Content-Type: application/json`\n  - payload: `{email: string, password: string, code: string (if MFA is enabled)}`\n  - returns: `{token: string}`\n  \n- `POST /register` to register a new user\n  - who can use: *admin* and *user*\n  - headers: `Content-Type: application/json`\n  - payload: `{name: string, email: string, password: string}`\n  - returns: `{message: string}`\n  \n- `GET /enable-mfa` to enable the MFA authentication\n  - who can use: *admin* and *user*\n  - headers: `Content-Type: application/json|Authorization: \u003ctoken\u003e`\n  - payload: `{}`\n  - returns: `{secret: string, qrCode: string}`\n\n- `POST /verify-mfa` to verify the MFA authentication\n  - who can use: *admin* and *user*\n  - headers: `Content-Type: application/json|Authorization: \u003ctoken\u003e`\n  - payload: `{code: string}`\n  - returns: `{message: string}`\n  \n- `POST /users` to create a new user\n  - who can use: *admin*\n  - headers: `Content-Type: application/json|Authorization: \u003ctoken\u003e`\n  - payload: `{name: string, email: string, password: string, isAdmin: boolean}`\n  - returns: `{user: object}`\n  \n- `PUT /users/{id}` to update a user name\n  - who can use: *admin* and *user*\n  - headers: `Content-Type: application/json|Authorization: \u003ctoken\u003e`\n  - payload: `{name: string}`\n  - returns: `{user: object}`\n\n- `POST /users/{id}/deactivate` to deactivate a user\n  - who can use: *admin*\n  - headers: `Content-Type: application/json|Authorization: \u003ctoken\u003e`\n  - payload: `{}`\n  - returns: `{message: string}`\n\n- `POST /users/{id}/activate` to activate a user\n  - who can use: *admin*\n  - headers: `Content-Type: application/json|Authorization: \u003ctoken\u003e`\n  - payload: `{}`\n  - returns: `{message: string}`","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevatreides%2Fphp-api-rest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevatreides%2Fphp-api-rest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevatreides%2Fphp-api-rest/lists"}