Professional Documents
Culture Documents
Preparation of laptops
● Install git
● Install PhpStorm and activate license
● Install PHP
● Install Slack
● Configure account for the courses:
○ SensioLabs connect
○ Activate them on SensioUniversity
○ Create account on SymfonyCasts
○ Create Udemy account
Linux basics
● We make sure everyone has access to the linux terminal locally
● Course: https://www.udemy.com/course/linux-terminal-for-beginners/
Git basics
PHP basics
- https://symfonycasts.com/screencast/php-ep1 How to win friends & develop in PHP
- https://symfonycasts.com/screencast/php-ep2 Course 2: How to stop worrying & start
writing PHP
- Please read Chapter 4 (only chapter 4
https://phptherightway.com/#language_highlights)
Courses: Database
- https://symfonycasts.com/screencast/php-ep3 Talking to a MySQL Database in PHP
Day 5
Day 6
Day 7
Reading material:
- https://phptherightway.com/#errors_and_exceptions (only error and exception
chapter)
- http://bestpractices.thecodingmachine.com/php/error_handling.html
- https://netgen.io/blog/modern-error-handling-in-php
Reading material
- Read chapter 6 https://phptherightway.com/#coding_practices
- It also contains a link to https://designpatternsphp.readthedocs.io/. Make sure you
read that.
- Read chapter 7 https://phptherightway.com/#dependency_injection
Day 9
Courses: Composer
- https://symfonycasts.com/screencast/composer/composer
Reading material
- Read chapter 5 https://phptherightway.com/#dependency_management
For this you need to create an empty git repository. We will provide you a Gitlab repository to
push to. Try to create small commits per working change.
It’s okay to search on the Internet and Stack Overflow for help.
1. Create a simple web page with PHP which displays “hello is it now: <the current date
and time>:
2. Commit your changes and push to master.
3. Checkout a new branch in git locally and keep on working in this branch.
4. Create a form for adding an entry in a guestbook. The form doesn’t need to do
anything yet. Give it the following form fields:
○ name
○ email
○ message
5. Now add some validation to the form so that when you submit it, validation errors are
shown. It does not have to be beautiful, as long as it works it’s good. Apply the
following validation rules:
○ name is required
○ email is required
○ message is required and should not be longer than 200 characters
6. Try to store the submitted and validated values in a JSON file on disk
○ hints: see file_put_contents, file_get_contents, json_encode and
json_decode
7. Try to display all entries from the JSON file on the page.
8. Try to store the entries in a database table instead of the JSON file.
9. Display all entries from the database table on the screen instead of the JSON file.
10. Great, the guestbook is finished now!
11. Push your new branch
12. Tryo to open a merge request, share the merge request with us on Slack.
13. We’ll review the code and maybe put some small comments/
14. Try to fix those, push your changes again.
15. Once everything is resolved you can merge the merge request.
16. Congratulations! Your first code is merged.
interface GuestbookRepository {
public function readAll();
public function write(GuestBookEntry $guestbookEntry): void
}
1. Create a new branch where you left off by the previous assignment.
2. If not already done in the previous assignment, create a User object which holds all
the properties for a user.
3. Create a database table for storing the users
4. Configure a few users manually in the table
a. can be done in a separate PHP file
b. or via a database tool like PhpMyAdmin, PHPStorm etc
5. Change the login validation so that it reads from the database instead of hardcoded
users.
6. Add a registration page with a form (doesn’t have to do anything yet):
a. email
b. password
7. Once submitted, validate:
a. email is required
b. password is required
8. If the form is valid, create a new user and redirect to the login page.
9. Try and see if the login is working
10. Storing passwords in plaintext is a security issue. Change the registration form and
login so that it is using hashed passwords.
a. hint: see password_hash and password_verify
11. Push your changes and open a merge request and ask for feedback.
12. Merge it once all comments are resolved.
Assignment 5: Namespaces and exceptions
1. In the code you currently have, try to implement namespacing for the classes.
2. In the code you currently have, try to create some exceptions and catch them
a. examples: if the user login fails, if the database connection fails etc
Assignment 6: Composer
1. Install composer locally