PHP — From Absolute Beginner to Advanced PHP Developer
Learn PHP from zero by building a real booking product — no coding experience needed.
25
Acts
218
Chapters
BookBay
The Story
The Index
25 Acts. 218 Chapters. One continuous story.
What PHP Is and How It Runs
Day one at BookBay: six weeks before Launch Day, Marcus hands Mia the first file of the booking product — and when she opens it, the browser shows raw code instead of a page.
What Is PHP?
What Is PHP?
How PHP Runs a Web Request
How PHP Runs a Web Request
PHP Versions and Modern PHP
PHP Versions and Modern PHP
Installing PHP
Installing PHP
PHP Configuration and php.ini
PHP Configuration and php.ini
PHP Extensions and OPcache
PHP Extensions and OPcache
Serving PHP: Built-in Server, PHP-FPM, Nginx and Apache
Serving PHP: Built-in Server, PHP-FPM, Nginx and Apache
PHP Setup Checkpoint
PHP Basic Syntax
Mia's first edit: she changes one line, and the page shows a parse error with a line number that points somewhere else.
PHP Files and Tags
PHP Files and Tags
Statements, Expressions and Blocks
Statements, Expressions and Blocks
Comments, Whitespace and Case Sensitivity
Comments, Whitespace and Case Sensitivity
Identifiers, Keywords and Code Style
Identifiers, Keywords and Code Style
Output: echo and print
Output: echo and print
Strict Types and Type Declarations
Strict Types and Type Declarations
Debugging with var_dump, print_r and var_export
Debugging with var_dump, print_r and var_export
Syntax Checkpoint
Variables & Constants
The day's booking count shows nothing. A typo — $bookigns — created a new, empty variable, and PHP only gave a warning.
Variables and Assignment
Variables and Assignment
Checking Variables: isset, empty and unset
Checking Variables: isset, empty and unset
Constants and Magic Constants
Constants and Magic Constants
Variable Variables and References
Variable Variables and References
Variable Scope and Superglobals: A First Look
Variable Scope and Superglobals: A First Look
Variables Checkpoint
The PHP Type System
A price arrives as the string "25 USD". The booking total comes out wrong with only a warning, and a check written with == lets a wrong value through.
PHP's Type System: Dynamic, Strict and Weak Typing
PHP's Type System: Dynamic, Strict and Weak Typing
Scalar Types: bool, int, float and string
Scalar Types: bool, int, float and string
null, Arrays, Objects and Resources
null, Arrays, Objects and Resources
Special Types: callable, mixed, void, never, true and false
Special Types: callable, mixed, void, never, true and false
Nullable, Union, Intersection and DNF Types
Nullable, Union, Intersection and DNF Types
Class-Related Types: static, self, parent, object and iterable
Class-Related Types: static, self, parent, object and iterable
Type Juggling, Coercion and Casting
Type Juggling, Coercion and Casting
Checking Types at Runtime
Checking Types at Runtime
Types Checkpoint
Operators & Expressions
Two customers get the same 3 p.m. slot. The "is this slot free?" check mixes && and || without parentheses.
Arithmetic and Assignment Operators
Arithmetic and Assignment Operators
Comparison: Loose, Strict and the Spaceship
Comparison: Loose, Strict and the Spaceship
Logical Operators and Short-Circuiting
Logical Operators and Short-Circuiting
String and Array Operators
String and Array Operators
Bitwise and Error-Control Operators
Bitwise and Error-Control Operators
Null Coalescing, Ternary and Elvis
Null Coalescing, Ternary and Elvis
instanceof, Precedence and Associativity
instanceof, Precedence and Associativity
PHP 8 Expression Changes and the Pipe Operator
PHP 8 Expression Changes and the Pipe Operator
Operators Checkpoint
Control Flow
The code that builds the day's free slots is nested seven levels deep, and on Sundays it shows slots although the shop is closed.
if, else and elseif
if, else and elseif
Loops: while, do-while, for and foreach
Loops: while, do-while, for and foreach
switch and match
switch and match
return, exit and goto
return, exit and goto
Guard Clauses and Early Returns
Guard Clauses and Early Returns
Control Flow Checkpoint
Strings
A customer's name is cut in half in the SMS reminder, and phone numbers arrive in five different formats.
String Basics: Quotes, Interpolation and Escapes
String Basics: Quotes, Interpolation and Escapes
Heredoc, Nowdoc and Concatenation
Heredoc, Nowdoc and Concatenation
Searching, Replacing and Trimming Strings
Searching, Replacing and Trimming Strings
Splitting, Joining and Formatting Strings
Splitting, Joining and Formatting Strings
Comparing Strings and Numeric Strings
Comparing Strings and Numeric Strings
Multibyte Strings, Unicode and UTF-8
Multibyte Strings, Unicode and UTF-8
Regular Expressions with PCRE
Regular Expressions with PCRE
Regex Replacement, Validation and Security
Regex Replacement, Validation and Security
Strings Checkpoint
Arrays & Collections
The day's appointments sort with 10:00 before 9:00, and merging two barbers' schedules loses the barber IDs.
PHP Arrays: Indexed, Associative and Multidimensional
PHP Arrays: Indexed, Associative and Multidimensional
Array Keys and Key Conversion
Array Keys and Key Conversion
Adding, Updating and Removing Elements
Adding, Updating and Removing Elements
Destructuring, Spread and Unpacking
Destructuring, Spread and Unpacking
Iterating and Transforming Arrays: map, filter, reduce
Iterating and Transforming Arrays: map, filter, reduce
Combining Arrays: merge, replace and combine
Combining Arrays: merge, replace and combine
Keys, Values, Columns and Set Operations
Keys, Values, Columns and Set Operations
Sorting Arrays
Sorting Arrays
Searching, Slicing, Chunking and Grouping
Searching, Slicing, Chunking and Grouping
Modern Array Helpers
Modern Array Helpers
Array Performance: Arrays vs Objects vs Collections
Array Performance: Arrays vs Objects vs Collections
Arrays Checkpoint
Functions
The price calculation is copy-pasted into six files. A holiday-surcharge fix reaches only four of them.
Writing Functions
Writing Functions
Parameter and Return Types
Parameter and Return Types
Default, Named and Variadic Arguments
Default, Named and Variadic Arguments
Pass by Value vs Pass by Reference
Pass by Value vs Pass by Reference
Function Scope, Static Variables and Recursion
Function Scope, Static Variables and Recursion
Anonymous Functions and Closures
Anonymous Functions and Closures
Arrow Functions and First-Class Callables
Arrow Functions and First-Class Callables
Callbacks and Higher-Order Functions
Callbacks and Higher-Order Functions
Built-In Functions
Built-In Functions
Generators, never and Good Function Design
Generators, never and Good Function Design
Functions Checkpoint
Scope, Execution & the PHP Runtime
Mia splits the code into files. An included file quietly overwrites a variable, a function is "redeclared", and a script that works in the browser fails when run from the command line.
Scope Rules and $GLOBALS
Scope Rules and $GLOBALS
include, require and File Paths
include, require and File Paths
The Script, Request, CLI and PHP-FPM Lifecycles
The Script, Request, CLI and PHP-FPM Lifecycles
OPcache, Bytecode and JIT: A First Look
OPcache, Bytecode and JIT: A First Look
Runtime Checkpoint
Object-Oriented PHP
A booking is an array with 14 keys. Someone writes stat instead of status, and nothing complains — the code is now 2,000 lines and every change breaks something else.
Why OOP? Classes and Objects
Why OOP? Classes and Objects
Properties, Methods and $this
Properties, Methods and $this
Constructors, Destructors and Property Promotion
Constructors, Destructors and Property Promotion
Visibility: public, protected and private
Visibility: public, protected and private
Class Constants and Static Members
Class Constants and Static Members
Readonly Properties and Classes
Readonly Properties and Classes
Inheritance and Overriding
Inheritance and Overriding
Abstract Classes and Interfaces
Abstract Classes and Interfaces
Traits
Traits
Encapsulation, Abstraction and Polymorphism
Encapsulation, Abstraction and Polymorphism
Composition, Aggregation, Association and Dependency
Composition, Aggregation, Association and Dependency
Dependency Injection, Coupling and Cohesion: A First Look
Dependency Injection, Coupling and Cohesion: A First Look
Object Identity, Comparison, Cloning and Serialization
Object Identity, Comparison, Cloning and Serialization
OOP Checkpoint
Modern PHP OOP
A booking's status is saved as "confirmd". After a PHP upgrade, the logs fill with dynamic-property deprecation warnings.
Typed Properties, Promotion and Readonly, Revisited
Typed Properties, Promotion and Readonly, Revisited
Enums
Enums
Anonymous Classes and final
Anonymous Classes and final
Covariance, Contravariance and Late Static Binding
Covariance, Contravariance and Late Static Binding
Magic Methods: Construction and Property Access
Magic Methods: Construction and Property Access
Magic Methods: Calls, Strings, Invoking and Serialization
Magic Methods: Calls, Strings, Invoking and Serialization
Dynamic Properties, Property Hooks and Asymmetric Visibility
Dynamic Properties, Property Hooks and Asymmetric Visibility
Attributes and Modern OOP Design
Attributes and Modern OOP Design
Modern OOP Checkpoint
Namespaces, Autoloading & Composer
Mia's Notification class clashes with the SMS library's Notification. The library itself was copied in as a zip, and its update breaks everything.
Why Namespaces?
Why Namespaces?
Importing with use and Aliases
Importing with use and Aliases
How PHP Resolves Names
How PHP Resolves Names
Composer, composer.json and composer.lock
Composer, composer.json and composer.lock
Semantic Versioning and Version Constraints
Semantic Versioning and Version Constraints
Autoloading and PSR-4
Autoloading and PSR-4
Composer Scripts, Binaries and Configuration
Composer Scripts, Binaries and Configuration
Dependency Conflicts and Security
Dependency Conflicts and Security
Creating and Publishing Your Own Package
Creating and Publishing Your Own Package
Composer Checkpoint
Exceptions & Error Handling
A blank white page. display_errors is off, nothing is logged, and Mia has no idea what failed.
Errors vs Exceptions: Throwable and the Hierarchy
Errors vs Exceptions: Throwable and the Hierarchy
Throwing, Catching and Rethrowing
Throwing, Catching and Rethrowing
Custom Exceptions and Exception Chaining
Custom Exceptions and Exception Chaining
PHP's Built-In Errors
PHP's Built-In Errors
Error Handlers and Error Reporting
Error Handlers and Error Reporting
Logging and Production Error Handling
Logging and Production Error Handling
Designing Exceptions
Designing Exceptions
Errors Checkpoint
Files, Directories & Streams
Bookings are saved to a JSON file. Two customers book at the same moment and one booking disappears; two barbers upload photo.jpg and one photo replaces the other.
Files and Paths
Files and Paths
Reading, Writing and Permissions
Reading, Writing and Permissions
Working with Directories
Working with Directories
File Handles, Streams and Wrappers
File Handles, Streams and Wrappers
CSV, JSON and XML Files
CSV, JSON and XML Files
Locking, Atomic Writes and Temporary Files
Locking, Atomic Writes and Temporary Files
Handling Uploads Safely
Handling Uploads Safely
Files Checkpoint
HTTP & Web PHP
Tom's customers can finally book from a form — and a customer who refreshes the page after booking books the same slot twice.
HTTP Requests and Responses
HTTP Requests and Responses
HTTP Methods: GET, POST, PUT, PATCH and DELETE
HTTP Methods: GET, POST, PUT, PATCH and DELETE
Parameters, Request Body, Form Data and JSON
Parameters, Request Body, Form Data and JSON
PHP Superglobals
PHP Superglobals
Headers, Redirects and Content Types
Headers, Redirects and Content Types
Cookies, Sessions and HTTP Authentication: A First Look
Cookies, Sessions and HTTP Authentication: A First Look
CORS and CSRF: A First Look
CORS and CSRF: A First Look
Rendering HTML with PHP Templates
Rendering HTML with PHP Templates
Building JSON APIs
Building JSON APIs
HTTP Checkpoint
Forms, Sessions & Authentication Fundamentals
Barbers need a login to see their own schedule. Mia's first version stores passwords as plain text — Marcus stops it before it ships.
HTML Forms, Submission and File Uploads
HTML Forms, Submission and File Uploads
Coming soon
Validation, Sanitization and Normalization
Validation, Sanitization and Normalization
Coming soon
Sessions
Sessions
Coming soon
Secure Cookies: HttpOnly and SameSite
Secure Cookies: HttpOnly and SameSite
Coming soon
Password Hashing
Password Hashing
Coming soon
Authentication, Authorization and the Login Flow
Authentication, Authorization and the Login Flow
Coming soon
Authentication Checkpoint
Databases with PHP
Launch week. The JSON file can't keep up, so bookings move to a database — and in the last review before launch, Marcus types ' OR 1=1 -- into the booking search and sees every customer.
Connecting to a Database with PDO
Connecting to a Database with PDO
Coming soon
Prepared Statements and SQL Injection
Prepared Statements and SQL Injection
Coming soon
Running Queries, Fetching Rows and PDO Exceptions
Running Queries, Fetching Rows and PDO Exceptions
Coming soon
Transactions and Savepoints
Transactions and Savepoints
Coming soon
MySQL, PostgreSQL and SQLite with PHP
MySQL, PostgreSQL and SQLite with PHP
Coming soon
CRUD, Repositories and Data Mapping
CRUD, Repositories and Data Mapping
Coming soon
N+1 and Query Optimization: A First Look
N+1 and Query Optimization: A First Look
Coming soon
Database Checkpoint
JSON, XML & Data Interchange
Month 2. Tom wants his bookings in his accounting tool as CSV, a supplier's system sends XML, and one partner's JSON silently decodes to null.
Encoding and Decoding JSON
Encoding and Decoding JSON
Coming soon
XML with SimpleXML, DOM and XPath
XML with SimpleXML, DOM and XPath
Coming soon
CSV and Serialization
CSV and Serialization
Coming soon
DTOs and API Payload Design
DTOs and API Payload Design
Coming soon
Data Interchange Checkpoint
PHP Security
A security researcher emails: a customer's booking note runs a script on every barber's dashboard, and someone is trying thousands of passwords on the login page.
Security Mindset and Trust Boundaries
Security Mindset and Trust Boundaries
Coming soon
SQL Injection, Command Injection, XSS and CSRF
SQL Injection, Command Injection, XSS and CSRF
Coming soon
Session Attacks
Session Attacks
Coming soon
Authentication, Passwords and Brute Force
Authentication, Passwords and Brute Force
Coming soon
Secrets, File Uploads and Path Traversal
Secrets, File Uploads and Path Traversal
Coming soon
SSRF, XXE and Deserialization Attacks
SSRF, XXE and Deserialization Attacks
Coming soon
Open Redirects, Header Injection and CORS
Open Redirects, Header Injection and CORS
Coming soon
HTTPS, TLS and Security Headers
HTTPS, TLS and Security Headers
Coming soon
Dependencies, Error Disclosure and Secure Production Config
Dependencies, Error Disclosure and Secure Production Config
Coming soon
Security Checkpoint
Testing PHP Applications
Mia fixes a cancellation bug — and breaks rescheduling. Tom finds out from an angry customer.
Why Test? The Testing Pyramid
Why Test? The Testing Pyramid
Coming soon
PHPUnit Basics
PHPUnit Basics
Coming soon
Fixtures, Data Providers and Testing Exceptions
Fixtures, Data Providers and Testing Exceptions
Coming soon
Test Doubles and Testable Code
Test Doubles and Testable Code
Coming soon
Code Coverage and Mutation Testing
Code Coverage and Mutation Testing
Coming soon
Static Analysis with PHPStan
Static Analysis with PHPStan
Coming soon
Coding Standards and Automated Quality Checks
Coding Standards and Automated Quality Checks
Coming soon
Testing Checkpoint
PHP Architecture & Design
Month 4, 20 shops. Olivia asks for "more than one location per business" — and the change takes two weeks, because booking logic is spread across controllers, templates and SQL.
Clean Code: DRY, KISS and YAGNI
Clean Code: DRY, KISS and YAGNI
Coming soon
SOLID
SOLID
Coming soon
Separation of Concerns, Layers and MVC
Separation of Concerns, Layers and MVC
Coming soon
Repositories, DTOs and Value Objects
Repositories, DTOs and Value Objects
Coming soon
Factory, Builder, Adapter and Decorator
Factory, Builder, Adapter and Decorator
Coming soon
Strategy, Observer, Command and Specification
Strategy, Observer, Command and Specification
Coming soon
Dependency Injection and Dependency Inversion
Dependency Injection and Dependency Inversion
Coming soon
Domain, Application and Infrastructure Logic
Domain, Application and Infrastructure Logic
Coming soon
Refactoring Legacy PHP
Refactoring Legacy PHP
Coming soon
Architecture Checkpoint
Advanced PHP Internals
"Export all bookings" for the biggest shop runs out of memory, and Mia can't explain why copying an array didn't cost anything — until it suddenly did.
How PHP Executes: the Zend Engine and Opcodes
How PHP Executes: the Zend Engine and Opcodes
Coming soon
OPcache, JIT and Profiling
OPcache, JIT and Profiling
Coming soon
Memory, zvals, References and Copy-on-Write
Memory, zvals, References and Copy-on-Write
Coming soon
Garbage Collection and Cyclic References
Garbage Collection and Cyclic References
Coming soon
Arrays and Hash Tables Inside PHP
Arrays and Hash Tables Inside PHP
Coming soon
PHP-FPM Internals, Workers and Lifecycles
PHP-FPM Internals, Workers and Lifecycles
Coming soon
Extensions and Internal Functions
Extensions and Internal Functions
Coming soon
Reflection
Reflection
Coming soon
Generators, Iterators and Fibers
Generators, Iterators and Fibers
Coming soon
Closures, Serialization and Streams Inside PHP
Closures, Serialization and Streams Inside PHP
Coming soon
Internals Checkpoint
The Modern PHP Ecosystem
Mia wrote her own logger and her own HTTP client for the SMS provider. The provider slows down, the client has no timeout, and booking pages hang. The next PHP upgrade is also coming.
PHP Standards: the PSRs
PHP Standards: the PSRs
Coming soon
HTTP Messages: PSR-7, PSR-15, PSR-17 and PSR-18
HTTP Messages: PSR-7, PSR-15, PSR-17 and PSR-18
Coming soon
The Composer Ecosystem and Framework-Independent PHP
The Composer Ecosystem and Framework-Independent PHP
Coming soon
CLI Applications and Symfony Console
CLI Applications and Symfony Console
Coming soon
Everyday Libraries: Monolog, Guzzle and Carbon
Everyday Libraries: Monolog, Guzzle and Carbon
Coming soon
Versioning, Deprecations and PHP Migrations
Versioning, Deprecations and PHP Migrations
Coming soon
Ecosystem Checkpoint
PHP Production Engineering
Month 6, 30 shops, the first busy Saturday morning: PHP-FPM runs out of workers, pages time out, and a memory leak grows through the day.
Development vs Production Configuration
Development vs Production Configuration
Coming soon
PHP-FPM, Nginx, Apache and OPcache in Production
PHP-FPM, Nginx, Apache and OPcache in Production
Coming soon
Memory, Execution Time and Upload Limits
Memory, Execution Time and Upload Limits
Coming soon
Error, Application and Structured Logging
Error, Application and Structured Logging
Coming soon
Monitoring, Health Checks and Metrics
Monitoring, Health Checks and Metrics
Coming soon
Profiling Slow Requests and Memory Leaks
Profiling Slow Requests and Memory Leaks
Coming soon
Caching, Redis and Queues: A First Look
Caching, Redis and Queues: A First Look
Coming soon
Scaling PHP: Stateless Apps and Sessions
Scaling PHP: Stateless Apps and Sessions
Coming soon
Deployments, Rollback and PHP Upgrades
Deployments, Rollback and PHP Upgrades
Coming soon
Production Checkpoint
Course Complete