{"id":18933865,"url":"https://github.com/mchamoudadev/react-with-php","last_synced_at":"2026-05-06T06:31:26.524Z","repository":{"id":163593139,"uuid":"501513119","full_name":"mchamoudadev/react-with-php","owner":"mchamoudadev","description":"React With Php and Mysql As a Backend","archived":false,"fork":false,"pushed_at":"2022-06-09T06:22:41.000Z","size":6,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-11-08T11:58:11.183Z","etag":null,"topics":["bootstrap","mysql","php","react"],"latest_commit_sha":null,"homepage":"","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/mchamoudadev.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,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-06-09T05:12:54.000Z","updated_at":"2023-09-05T14:04:38.000Z","dependencies_parsed_at":null,"dependency_job_id":"48739d37-9753-4954-af47-edefa1ed0d31","html_url":"https://github.com/mchamoudadev/react-with-php","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/mchamoudadev%2Freact-with-php","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mchamoudadev%2Freact-with-php/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mchamoudadev%2Freact-with-php/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mchamoudadev%2Freact-with-php/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mchamoudadev","download_url":"https://codeload.github.com/mchamoudadev/react-with-php/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":232028770,"owners_count":18462506,"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":["bootstrap","mysql","php","react"],"created_at":"2024-11-08T11:56:44.362Z","updated_at":"2025-09-19T06:44:02.070Z","avatar_url":"https://github.com/mchamoudadev.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# react-with-php\n\n\u003cp\u003eI have tried to connect my react app with php and mysql as a backend which has alot of comminuty.\u003c/p\u003e\n\u003cp\u003eThere is some challenges with this stack for example the Cors  Policy is quite challenging so i have googled and i come up with a solution\u003c/p\u003e\n\u003cp\u003eif you watched my videos on php apis or enrolled my php for professionals course we have a nice api's that we can communicate smoothly, \n  in this project the we have two reigions\u003c/p\u003e\n  \n  1. Backend \n  2. Frontend\n  \n  ## backend \n    uses localhost:80\n  ## frontend \n    uses localhost:3000\n    \n   so we have to accept from our backend to process this requests comes from another region.\n   \n   ## The solution\n   \n   So i have created new file and called **header.php** basicaly this files has some rules that we can accept the other region so the code is here :\n   \n   ```php\n      header(\"Access-Control-Allow-Origin: *\");\n      header(\"Access-Control-Allow-Methods: PUT, POST, OPTIONS\");\n      header(\"Content-Type: application/json; charset=utf8mb4\");\n      header(\"Access-Control-Allow-Headers: Content-Type, Access-Control-Allow-Headers, Authorization, X-Requested-With\");\n\n      header(\"Content-Type: application/json\");\n      \u003c!--This line converts the inputs or the body that we sent into $_POST global varibale for php for accepting post values--\u003e\n      $_POST = json_decode(file_get_contents(\"php://input\"), true);\n\n   ```\n   To use this project you need to have a php server , i'm using xampp which gives me mysql out of the box , when you have php and mysql the create new \n   database and call you favorite name and then create a table with four feilds *****id as an autoincrement, title , description and timestamp.*****\n   \n   _**happy coding**_🔥.\n   \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmchamoudadev%2Freact-with-php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmchamoudadev%2Freact-with-php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmchamoudadev%2Freact-with-php/lists"}