PHP
Master server-side web development with PHP — 67 lessons from first script to advanced application architecture.
Learn PHP for web development — syntax, forms, sessions, databases, security and REST APIs — with practical interactive lessons.
Part of the free Php course at LearnCodingFast — hands-on lessons with examples you run in your browser, plus practice exercises and a quick quiz.
👋 New to PHP? Great choice for web backends.
PHP powers over 75% of the web. Start with Lesson 1 — we'll build your skills from the ground up.
Lessons in this course
- Introduction to PHP — What PHP is, how it runs on the server, and how to write your first script
- Variables & Data Types — Strings, integers, floats, booleans — PHP's core data types explained
- Data Types — PHP's eight data types, gettype(), and how var_dump() reveals what you have
- Strings & String Functions — Build, search, and transform text with PHP's rich string function library
- Numbers & Math — Integers, floats, math functions, and avoiding floating-point surprises
- Type Juggling & Casting — How PHP converts types automatically and when to cast explicitly
- Constants — Define unchanging values with const and define(), plus magic constants
- Superglobals ($_GET, $_POST, $_SERVER) — Access request, server, and session data through PHP's built-in superglobals
- Null & Null-Safe Operators — Handle missing values cleanly with ??, ??=, and the ?-> null-safe operator
- Checkpoint: PHP Basics — Combine variables, types, strings and math in a build challenge — then a quiz
- Operators & Expressions — Arithmetic, comparison, logical, and string operators in PHP
- Control Flow — Control program logic with if, elseif, else, and switch
- Loops — Repeat code with for, foreach, while, and do-while loops
- The match Expression — PHP 8's strict, expression-based alternative to switch — cleaner and safer
- Enums (PHP 8.1) — Model a fixed set of values with backed enums, methods, and constants
- Closures & Arrow Functions — Anonymous functions, use(), and concise fn() arrow syntax with capture
- Dates & Times (DateTime) — Parse, format, compare, and do arithmetic with DateTime and DateInterval
- Regular Expressions (preg) — Match, capture, and replace text patterns with preg_match and preg_replace
- Working with JSON — Encode and decode JSON for APIs with json_encode and json_decode
- Traits — Share methods across unrelated classes with horizontal code reuse
- Generators (yield) — Produce values lazily with yield to process large data sets efficiently
- Type Declarations & Typed Properties — Add parameter, return, and property types for safer, self-documenting code
- Checkpoint: Data & Types — Combine enums, match, closures and JSON in a build challenge — then a quiz
- Functions — Write reusable functions with parameters, return values, and default arguments
- Arrays & Collections — Work with indexed, associative, and multidimensional arrays
- File Handling — Read, write, and append to files on the server with PHP
- Forms & User Input — Handle HTML form submissions, validate user input, and sanitise data
- Sessions & Cookies — Persist user data between page loads with sessions and cookies
- Object-Oriented PHP — Create classes, objects, interfaces, and use OOP principles in PHP
- Database Integration (MySQL) — Connect to MySQL, run queries, and display database data on your page
- Security Best Practices — Prevent SQL injection, XSS, and CSRF in PHP web applications
- APIs & JSON — Build and consume REST APIs, encode/decode JSON data with PHP
- Advanced OOP Patterns: Factory, Singleton, Strategy & Repository — Apply GoF design patterns in production-quality PHP code
- Dependency Injection Containers & Service Providers — Build and use DI containers for testable, decoupled PHP applications
- Advanced Error Handling & Custom Exception Hierarchies — Custom exception types, global handlers, and error reporting strategies
- Working with REST APIs: cURL, Streams & Guzzle — Call external APIs with cURL, streams, and the Guzzle HTTP client
- Building Your Own Micro MVC Framework — Build a router, dispatcher, and controller system from scratch in PHP
- Middleware Architecture & Request Pipelines — Process HTTP requests through a stack of middleware for auth, logging, and more
- Advanced PDO: Transactions, Prepared Statements & Stored Procedures — Use PDO for safe, efficient database access with transactions and stored procs
- Query Builders & ORM Concepts (Doctrine/Eloquent Style) — Map database tables to PHP objects with ORM concepts and query builders
- Authentication Deep Dive: JWT, OAuth2 & API Tokens — Implement secure login, JWT issuance, and OAuth2 flows in PHP
- Securing PHP Applications: XSS, CSRF, SQL Injection & Hardening — Defend against all major PHP vulnerabilities with proven security techniques
- Password Hashing, Argon2 & Secure Credential Storage — Hash passwords with Argon2/bcrypt and store credentials safely
- Advanced Sessions: Redis, Database Sessions & Stateless Sessions — Scale session storage with Redis, DB-backed sessions, and JWT stateless auth
- Caching Techniques: OPcache, Redis & File Caching — Speed up PHP apps with OPcache, Redis object caching, and cache layers
- Building Dynamic APIs with JSON, HAL & Pagination — Design paginated, versioned REST APIs with proper JSON response formats
- Rate Limiting, Throttling & IP-Based Controls — Protect your API from abuse with rate limiting and throttle middleware
- Working with Queues: Redis, Beanstalk, RabbitMQ — Offload slow tasks to background queues with Redis and message brokers
- Building Email Systems: SMTP, PHPMailer, DKIM, SPF — Send transactional emails with PHPMailer and configure deliverability
- Image Uploads, Processing & Optimisation (GD & Imagick) — Handle user image uploads, resize, crop, and optimise with GD and Imagick
- Working with PDF Generation & File Exporting — Generate PDFs, invoices, and reports with TCPDF and dompdf
- Localization, Internationalisation & Multilingual Apps — Build multilingual PHP apps with gettext, locale detection, and i18n patterns
- Building Search Features (Full-Text Search, Elastic, Meilisearch) — Add full-text search to PHP apps using MySQL FTS, Elasticsearch, or Meilisearch
- Cron Jobs, Background Tasks & Scheduling Workers — Automate recurring tasks with cron, worker processes, and job schedulers
- Environment Management: env files, Config Services & Secrets — Manage config safely with .env files, vlucas/phpdotenv, and secrets management
- Integrating Payment Gateways (Stripe, PayPal, Mollie) — Accept payments in PHP with Stripe Checkout, webhooks, and refund handling
- Building E-Commerce Logic: Carts, Orders & Invoices — Model shopping carts, orders, inventory, and invoice generation in PHP
- Server-Side Rendering & Template Engines (Twig, Blade-like Patterns) — Separate logic from presentation with Twig and templating best practices
- API Rate Monitoring, Logging & Audit Trails — Log API calls, monitor usage, and build audit trails for compliance
- Building a Role & Permission System (RBAC, ACL) — Implement role-based access control and fine-grained permissions in PHP
- File Storage Abstraction: Local, S3, Cloud Storage — Abstract file storage with Flysystem to switch between local, S3, and cloud
- Optimizing PHP Performance & Understanding OPcache — Profile PHP apps, tune OPcache, and eliminate slow code paths
- Unit Testing & Integration Testing with PHPUnit — Write unit tests, integration tests, and test doubles with PHPUnit
- Building Composer Packages & Publishing Libraries — Create, version, and publish reusable PHP packages on Packagist
- Deploying PHP Apps: Nginx/Apache, PHP-FPM, Docker — Deploy PHP applications with Nginx, PHP-FPM, and Docker containers
- Building a Complete Real-World PHP Architecture (Modular Monolith) — Structure a full PHP application as a modular monolith with clean boundaries
- Final Project — Build and deploy a complete PHP web application from scratch
- Getting Started with Laravel — Routing, controllers, Blade, Eloquent ORM and artisan in PHP's leading framework
- GraphQL APIs in PHP — Build a typed, single-endpoint GraphQL API with schemas, queries and mutations
- Real-Time PHP with WebSockets — Push live updates with WebSockets, Ratchet and Laravel Reverb broadcasting
- Namespaces & PSR-4 Autoloading — Organize code with namespaces and Composer's PSR-4 autoloader
- Fibers & Async PHP — PHP 8.1 Fibers and the event-loop runtimes (ReactPHP, Amp, Swoole) built on them
- Static Analysis with PHPStan & Psalm — Catch bugs before runtime with typed analysis, levels and CI integration