Section 1: Lab: Setting Up Tools and a PHP 8.5 Project
- Install VS Code with extensions for PHP and Git
- Run PHP 8.5, MySQL and SQL Server with Docker Compose
- Manage packages with Composer and PSR-4 autoloading
- Lab: a starter project used throughout day one
Section 2: Classes, Objects and Encapsulation
- Why OOP, and how it differs from top-down code
- Classes, objects, typed properties and methods
- Constructor promotion, readonly and visibility
- Lab: a product class that validates its values on creation
Section 3: Lab: Inheritance, Interfaces and Traits
- Inheritance, overriding and final
- Abstract classes versus interfaces, and polymorphism
- Traits, static methods and using them in moderation
- Lab: a shipping cost calculator with several methods behind an interface
Section 4: Namespaces, Enums and Exceptions
- Organising code with namespaces and use, the way frameworks do
- Backed enums for data statuses
- Custom exceptions and systematic error handling
- Lab: order statuses with enums and exceptions
Section 5: Lab: PDO with MySQL and MariaDB
- A PDO connection class with utf8mb4 and exception error mode
- Prepared statements to prevent SQL injection
- CRUD and transactions with beginTransaction and rollBack
- The repository idea, and Active Record versus Data Mapper ORMs
Section 6: Lab: PDO with Microsoft SQL Server
- Install the Microsoft Drivers for PHP and the ODBC driver
- The sqlsrv DSN and SQL differences such as TOP and OFFSET FETCH
- One interface to switch between MySQL and SQL Server
- Lab: product CRUD on SQL Server with the same classes