{"id":22685771,"url":"https://github.com/pernillasterner/php_fundamentals","last_synced_at":"2025-06-19T17:35:21.837Z","repository":{"id":262417757,"uuid":"886759440","full_name":"pernillasterner/php_fundamentals","owner":"pernillasterner","description":"PHP For Beginners","archived":false,"fork":false,"pushed_at":"2025-06-09T08:49:50.000Z","size":73,"stargazers_count":1,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"development","last_synced_at":"2025-06-09T09:35:52.694Z","etag":null,"topics":["controllers","form-validation","mysql","partials","pdo-mysql","php","routing","sql","tailwindcss","views"],"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/pernillasterner.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,"zenodo":null}},"created_at":"2024-11-11T14:54:42.000Z","updated_at":"2025-06-09T08:49:53.000Z","dependencies_parsed_at":"2024-11-12T10:39:23.464Z","dependency_job_id":"fecc9cdc-c682-4c52-94c6-9bbf0213b25e","html_url":"https://github.com/pernillasterner/php_fundamentals","commit_stats":null,"previous_names":["pernillasterner/php_demo","pernillasterner/php_fundamentals"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/pernillasterner/php_fundamentals","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pernillasterner%2Fphp_fundamentals","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pernillasterner%2Fphp_fundamentals/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pernillasterner%2Fphp_fundamentals/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pernillasterner%2Fphp_fundamentals/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pernillasterner","download_url":"https://codeload.github.com/pernillasterner/php_fundamentals/tar.gz/refs/heads/development","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pernillasterner%2Fphp_fundamentals/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260797366,"owners_count":23064758,"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":["controllers","form-validation","mysql","partials","pdo-mysql","php","routing","sql","tailwindcss","views"],"created_at":"2024-12-09T22:17:35.370Z","updated_at":"2025-06-19T17:35:16.816Z","avatar_url":"https://github.com/pernillasterner.png","language":"PHP","readme":"# PHP for Beginners\n\nA basic project demonstrating how to build a simple PHP application with partials, views, controllers, and a basic router. TailwindCSS is also used to quickly implement modern and responsive styling.\n\n\n\n### Separating URI and Query in PHP\n\nTo separate the URI path and query parameters in PHP, you can use the `parse_url` function.\n\n```php\n\n$uri = \"/contact?name=johndoe\";\nprint_r(parse_url($uri));\n\n\n// Output\narray(2) {\n    [\"path\"] =\u003e\n    string(8) \"/contact\"\n    [\"query\"] =\u003e\n    string(12) \"name=johndoe\"\n}\n```\n\n\n### Securely Querying a Database with Placeholders\n\nUsing placeholders in SQL queries is important for security reasons. It helps to protect the db from SQL injection attacks.\n\n```php\n// Retrieving the 'id' parameter from the URL (?id=2)\n$id = $_GET['id'];\n\n// Creating the query with a placeholder\n$query = \"select * from posts where id = :id\";\n\n// Executing the query and binding the placeholder with the actual value of $id.\n$posts = $db-\u003equery($query, [':id' =\u003e $id])-\u003efetch();\n\n// Output the data\ndd($posts);\n```","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpernillasterner%2Fphp_fundamentals","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpernillasterner%2Fphp_fundamentals","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpernillasterner%2Fphp_fundamentals/lists"}