PHP Fundamentals
Good to know
Training goal
To make the participants acquire the fundamental bases of creation of a Web application with the PHP language. Knowledge of the communication between the client and the server.
Detailed contents
The content is updated regularly. The pedagogical course is presented in the form of an Internet application project created by each participant. Practical work takes place throughout the training, which gradually leads the participants to correct their mistakes. The emphasis is on best practices.
Matériel pédagogique fourni
The trainer will distribute the training materials in electronic format at the end of the training.
In addition, the work done during these 3 days will result in the creation of a step-by-step versioned web application. Each participant is invited to keep on their machine the code of the training project, which they will have written themselves with the help of the trainer, because this code can be used as a technical base for future projects.
Prerequisites
In order to fully benefit from the training, participants must have previous professional experience in the following areas :
- object-oriented PHP development
- use of a relational database
Participants should have a computer with a LAMP environment, including preferably the following elements :
- An internet connection allowing the installation of PHP extensions and packages from packagist and working with ease (if the training is held outside our premises),
- An IDE they master (PHPStorm, SublimeText, VSCode, ...),
- A UNIX shell,
- A currently supported version of PHP (https://www.php.net/supported-versions.php),
- Git installed (useful for composer dependencies),
- One MySql/MariaDB server per person,
- Administrator rights on the machine,
It is recommended for the participants to use a text editor they are comfortable with, so that they can focus on the training.
If the training is held in the Client's premises, we require for the Client to provide a separate room for the training to take place, big enough to accommodate all participants and the trainer, for the whole duration of the training. A video projector or wide screen TV must be provided so that the participants can see the trainer's laptop computer screen. A paperboard or whiteboard, and Internet access would be appreciated.
Training course
History
Static vs dynamic site
Client / Server
Interpreted language != compiled
Reputation
Performance comparison between versions
Prepare your working environment
Setup Apache / PHP / Mysql
Windows
Mac
Linux
The editors
PHPStorm
Vscode
Error reporting: php.ini
The syntax of the language
Variables
Control structures
Arrays
Functions
PHP specificity
== vs ===
Object Oriented Programming (OOP)
Class
Variables
Methods
Constructor
Visibility
Abstract class
Inheritance
Interface
Feature
Specific syntax (instanceof, magic methods)
Refactoring of current code to object
Namespace
Autoloading
Make your own autoloading
Composer
Packagist
Version
composer.lock
boostrap composer + use composer autoloading + install and use a lib
Data transmission
Via Form
Form in GET method
Practical: Searching via URL
Via Form
Form in POST method
Adding an element
The super globals
Session and Cookies
Practical: Connecting with a cookie
Read / Write file
Practical: Persistence via a json file
Data management (via PDO)
SQL script to provide and execute
phpMyAdmin
Install
Reading
Make a class responsible for reading elements
Writing
Make a class responsible for writing elements <= end of morning 3
Making a small opening with Symfony
Example of what is facilitated with Sf
Autoloading
Config
Advanced
Tools (PHPStan, php-cs-fixer, PHPUnit)
Design patterns
Reflection