{"id":18256902,"url":"https://github.com/mediacomem/comem-archidep-php-todo-exercise","last_synced_at":"2025-04-04T12:06:45.679Z","repository":{"id":61182622,"uuid":"153414647","full_name":"MediaComem/comem-archidep-php-todo-exercise","owner":"MediaComem","description":"A collaborative Git exercise based on a todo list written in PHP, HTML \u0026 CSS","archived":false,"fork":false,"pushed_at":"2025-01-03T22:34:05.000Z","size":287,"stargazers_count":3,"open_issues_count":0,"forks_count":223,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-28T11:07:55.001Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://todolist.archidep.ch","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MediaComem.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","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":"2018-10-17T07:32:06.000Z","updated_at":"2024-09-29T20:29:44.000Z","dependencies_parsed_at":"2024-09-07T00:41:13.033Z","dependency_job_id":null,"html_url":"https://github.com/MediaComem/comem-archidep-php-todo-exercise","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/MediaComem%2Fcomem-archidep-php-todo-exercise","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MediaComem%2Fcomem-archidep-php-todo-exercise/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MediaComem%2Fcomem-archidep-php-todo-exercise/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MediaComem%2Fcomem-archidep-php-todo-exercise/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MediaComem","download_url":"https://codeload.github.com/MediaComem/comem-archidep-php-todo-exercise/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247174415,"owners_count":20896078,"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-11-05T10:24:04.396Z","updated_at":"2025-04-04T12:06:45.659Z","avatar_url":"https://github.com/MediaComem.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Collaborative Git Exercise\n\nThe goal of this exercise is to collaborate on a simple project on GitHub as a\nteam of 2 or 3.\n\n\u003c!-- START doctoc generated TOC please keep comment here to allow auto update --\u003e\n\u003c!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --\u003e\n\n- [Legend](#legend)\n- [:gem: The application](#gem-the-application)\n- [:gem: Tips](#gem-tips)\n- [:exclamation: Instructions](#exclamation-instructions)\n- [:question: End result](#question-end-result)\n- [:exclamation: Evaluation](#exclamation-evaluation)\n- [:exclamation: Delivery](#exclamation-delivery)\n- [:classical_building: Architecture](#classical_building-architecture)\n- [:boom: Troubleshooting](#boom-troubleshooting)\n  - [:boom: `You have an error in your SQL syntax [...] near BY`](#boom-you-have-an-error-in-your-sql-syntax--near-by)\n  - [:boom: `Uncaught PDOException [...] Access denied`](#boom-uncaught-pdoexception--access-denied)\n  - [:boom: `Invalid argument supplied for foreach()`](#boom-invalid-argument-supplied-for-foreach)\n  - [:boom: Adding a todo item redirects to another URL](#boom-adding-a-todo-item-redirects-to-another-url)\n  - [:boom: The application displays correctly but modifications are not taken into account](#boom-the-application-displays-correctly-but-modifications-are-not-taken-into-account)\n\n\u003c!-- END doctoc generated TOC please keep comment here to allow auto update --\u003e\n\n\n\n## Legend\n\nParts of this guide are annotated with the following icons:\n\n- :exclamation: A task you **MUST** perform to complete the exercise.\n- :question: An optional step that you _may_ perform to make sure that\n  everything is working correctly.\n- :warning: **Critically important information about the exercise.**\n- :gem: Tips on the exercise, reminders about previous exercises, or\n  explanations about how this exercise differs from the previous one.\n- :space_invader: More advanced tips on how to save some time. Challenges.\n- :books: Additional information about the exercise or the commands and tools\n  used.\n- :checkered_flag: The end of the exercise.\n  - :classical_building: The architecture of what you deployed during the\n    exercise.\n- :boom: Troubleshooting tips: how to fix common problems you might encounter.\n\n\n\n## :gem: The application\n\nThis repository contains a partially implemented todo list written in PHP, HTML\nand CSS. The application connects to a MySQL database. All the code is in the\n`index.php` file.\n\nThe incomplete lines of code are marked with the following comment: `// IMPLEMENT ME`.\n\n\n\n## :gem: Tips\n\n* :gem: You may run this application on your local machine with [MAMP][mamp] or\n  [WAMP][wamp], or with a local installation of PHP and MySQL if you already\n  have them.\n* :gem: This repository contains a `todolist.sql` file you can use to create the\n  database for this project. If you use MAMP, you can run its contents from\n  MAMP's phpMyAdmin interface.\n\n  You should **change the password** in the SQL before running it.\n* :gem: Need help choosing a good password? [Don't use something that is hard to\n  remember](https://xkcd.com/936/). You're better off [using a\n  passphrase](https://www.useapassphrase.com) (here's a [French\n  version](https://passwordcreator.org/fr.html#good)).\n* :gem: You can update the [constants at the top of `index.php`][ex-constants]\n  to match your local installation:\n  * The value of `BASE_URL` must match the URL at which the application is\n    available.\n\n    For example, if you use MAMP and put this repository in MAMP's `htdocs`\n    directory, the application will be accessible at\n    http://localhost:8888/comem-archidep-php-todo-exercise/ (with the default\n    ports). In this situation, the value of `BASE_URL` should be\n    `/comem-archidep-php-todo-exercise/`.\n  * You can change the value of `DB_PORT` to match your local MySQL port (for\n    example, with MAMP, the default is 8889).\n\n\n\n## :exclamation: Instructions\n\nThe first two team members will be referred to as **Alice** and **Bob**.\n\n1. **Alice**\n   * Open the [MediaComem/comem-archidep-php-todo-exercise repository][ex-repo]\n     in your browser.\n   * Click the **`Fork`** button in the top-right corner of the page (you must\n     be logged in to GitHub).\n\n     ![Fork](images/fork.png)\n\n     This will create a copy of the repository on GitHub that belongs to you\n     (under your GitHub username instead of `MediaComem`).\n   * In the settings of the forked repository, add **Bob** and any other team\n     members to the list of **Collaborators** (this will give them push access).\n   * Clone the forked repository on your local machine.\n2. **Bob** (and other team members)\n   * Clone Alice's repository on your local machine.\n3. **All**\n   * Implement one or more of the missing features.\n   * Commit the changes and push them to Alice's repository on GitHub.\n\n\n\n## :question: End result\n\nThe fully implemented application should look and behave like this:\nhttps://todolist.archidep.ch\n\n\n\n## :exclamation: Evaluation\n\n* The work must be delivered in the forked repository on GitHub.\n* The todo list must work:\n  * Tasks can be added, toggled and deleted.\n  * Tasks must be listed from newest to oldest (i.e. by descending creation\n    date).\n* Each team member must contribute at least one useful commit:\n  * The commits must be made on each team member's machine using their local Git\n    installation, not through GitHub's web interface.\n  * The author name and email address of each team member's commits must be\n    correctly configured.\n* Commit messages must be relevant (i.e. describe the change that was made).\n\n\n\n## :exclamation: Delivery\n\nSend one email per team to both teachers (Simon O. \u0026 Simon P.) with:\n\n* The link to the team's solution repository on GitHub.\n* The list of team members (and their GitHub username if it is not obvious).\n\n\n\n## :classical_building: Architecture\n\nThis is a simplified architecture of the main running processes and\ncommunication flow at the end of the exercise (assuming you've used MAMP with\nApache running on port 8888 and MySQL on port 8889).\n\n![Diagram](./images/simplified-architecture.png)\n\n\u003e [PDF version](./images/simplified-architecture.pdf).\n\n\n\n## :boom: Troubleshooting\n\n\u003e Note that PHP errors may appear only in your PHP error log, or also in your\n\u003e browser. Whether they appear in your browser depends on parameters in your\n\u003e `php.ini` configuration, such as\n\u003e [`error_reporting`](https://www.php.net/manual/en/errorfunc.configuration.php#ini.error-reporting).\n\n### :boom: `You have an error in your SQL syntax [...] near BY`\n\nThe `todolist.sql` file contains the following query:\n\n```sql\nCREATE USER IF NOT EXISTS 'todolist'@'localhost' IDENTIFIED WITH mysql_native_password BY 'chAngeMeN0w!';\n```\n\nThe `WITH mysql_native_password` portion of this query is required for some\nolder versions of MySQL. If you get a syntax error message when you run it,\nsimply remove that part and use only `IDENTIFIED BY`.\n\n### :boom: `Uncaught PDOException [...] Access denied`\n\nIf you see an error that looks like this displayed in your browser or in the PHP\nerror log:\n\n```\nPHP Fatal error:\n  Uncaught PDOException: SQLSTATE[HY000] [1045]\n  Access denied for user 'todolist'@'localhost' (using password: YES)\n```\n\nIt means that you are not using the correct database connection parameters. Make\nsure that the following parameters are configured correctly:\n\n* The `DB_PASS` parameter must be the password you used when you created the\n  `todolist` user with the SQL in the `todolist.sql` file.\n* The `DB_PORT` parameter must be the port on which you MySQL server is\n  listening. The default MySQL port is 3306, but it may be different depending\n  on your installation method. For example, MAMP uses port 8888 by default.\n\n\u003e You may also have made a mistake when creating the MySQL user. If you are not\n\u003e sure, you can delete the user by running the query `DROP USER\n\u003e 'todolist'@'localhost';`, then re-run the `CREATE USER ...` and `GRANT ALL\n\u003e PRIVILEGES ...` queries of the `todolist.sql` file.\n\n### :boom: `Invalid argument supplied for foreach()`\n\nIf you see an error that looks like this displayed in your browser or in the PHP\nerror log:\n\n```\nPHP Warning: Invalid argument supplied for foreach()\n```\n\nIt is simply because you have not yet implemented the `SELECT` query in the\n`$selectQuery` variable. This makes the `$items` variable empty, which produces\nan error in the `foreach` loop that attempts to iterate over it to display the\ntodo items.\n\n### :boom: Adding a todo item redirects to another URL\n\nYou have not configured the `BASE_URL` parameter correctly. This value is used\nin the [form's `action`\nattribute](https://www.w3schools.com/tags/att_form_action.asp) when creating a\ntodo item.\n\nThe correct value is the base path under which the application is exposed. For\nexample, if you are accessing the application at\n`http://localhost:8888/comem-archidep-php-todo-exercise/`, then `BASE_URL`\nshould be `/comem-archidep-php-todo-exercise/`. If you are accessing the\napplication at `http://localhost:8888`, then `BASE_URL` should be `/`.\n\n### :boom: The application displays correctly but modifications are not taken into account\n\nYou may have configured your `BASE_URL` without a trailing slash (e.g.\n`/comem-archidep-php-todo-exercise` instead of\n`/comem-archidep-php-todo-exercise/`).\n\nThe Apache web server (in MAMP or equivalent) will not treat requests to those\ntwo paths in the same way:\n\n* The first path `/comem-archidep-php-todo-exercise` will probably be redirected\n  to `/comem-archidep-php-todo-exercise/` with a standard Apache configuration.\n  Any form data submitted in the request will be lost in the redirection.\n* The second path `/comem-archidep-php-todo-exercise/` refers to the directory\n  by the same name. In that case, a standard Apache configuration will probably\n  execute the `index.php` page in that directory.\n\nWithout the trailing slash, your application may display correctly, but form\nsubmission may be broken.\n\n\n\n[ex-constants]: https://github.com/MediaComem/comem-archidep-php-todo-exercise/blob/master/index.php#L3-L8\n[ex-repo]: https://github.com/MediaComem/comem-archidep-php-todo-exercise\n[mamp]: https://www.mamp.info/\n[wamp]: http://www.wampserver.com/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmediacomem%2Fcomem-archidep-php-todo-exercise","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmediacomem%2Fcomem-archidep-php-todo-exercise","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmediacomem%2Fcomem-archidep-php-todo-exercise/lists"}