Courses / Specialisations & media / PHP Programming

Free courseSelf-paced

PHP Programming

Build a PHP web application with validated forms, PDO database access, secure sessions and PHPUnit tests.

  • Who it's for. Learners who know basic programming and HTML forms and want to build server-side web applications in PHP.
  • Before you start. Prerequisite courses: Programming Problem Solving and Web Foundations: HTML, CSS and Responsive Layouts.
  • 30 to 51 hours of study with practice
  • 8 modules, 49 lessons
  • 4 guided projects and a final project

What you'll learn

  • Select a supported PHP branch from php.net, run scripts with the CLI and serve a project on loopback with the built-in server and curl.
  • Handle plain-PHP requests and forms: read request data, validate with filter_var, escape output with htmlspecialchars, redirect after POST and return JSON.
  • Handle failure with exceptions, JSON decoding errors, file operations and environment-based configuration instead of silent failures.
  • Access a database through PDO with prepared statements, fetch modes, transactions and repository classes.
  • Test PHP code with PHPUnit and loopback HTTP smoke checks, and deliver a small PHP web application with validated forms, database access and tests.

Skills you'll gain

  • PHP runtime
  • Types
  • functions
  • Requests
  • forms
  • Classes
  • packages
  • Errors
  • configuration
  • Database access
  • Sessions
  • security
  • Application tests

Tools you'll use

  • PHP
  • Composer
  • PDO
  • SQLite
  • PHPUnit
  • curl

Details to know

  • Certificate on completionIssued after your final project is reviewed
  • 8 module checkpointsA quiz and a practical task close each module
  • Self-pacedStudy any time; your progress is saved

How every lesson works

Each lesson follows the same four steps, so you always know what comes next.

  1. 01

    Watch & Learn

    A short animated video explains one idea at a time.

  2. 02

    Guided Practice

    Work through an example step by step and check the result.

  3. 03

    Quiz & Challenge

    Short questions check the idea has landed before you move on.

  4. 04

    Mini Project

    Build something useful from a project brief.

Learn at your own pace

This is a self-paced course. There are no live classes and no fixed timetable.

  • Start any timeStudy when it suits you. Lessons are short, so they fit around work or college.
  • Pick up where you left offYour progress is saved to your account.
  • Ask when you're stuckUse Ask Mentor inside the learning platform.

Your path in 5 phases

Each phase ends with something you have built and checked.

  1. 01

    Modules 1 to 2

    Command-line and loopback PHP toolkit

    Choose a supported PHP branch from php.net, run scripts and a loopback web server, and predict how PHP stores, compares and iterates simple values.

    You build: Command-line and loopback PHP toolkit: A CLI script that reads a data file into an associative array and prints a count with a meaningful exit status.

  2. 02

    Module 3

    Validated request handler on loopback

    Handle a plain-PHP HTTP request: read GET and POST data, validate with filter_var, escape output, redirect after a POST, answer JSON requests and route by path.

    You build: Validated request handler on loopback: A POST form handler that validates fields with filter_var and returns field-level messages.

  3. 03

    Modules 4 to 5

    Domain library with Composer autoload

    Model a domain with classes, interfaces and backed enums, organise them in namespaces, and load them with Composer's PSR-4 autoloader and locked dependencies.

    You build: Domain library with Composer autoload: Namespaced classes, a backed enum and PSR-4 autoloading with composer.json committed.

  4. 04

    Modules 6 to 7

    Persistent, secured notes service

    Connect with PDO, run every query through prepared statements, fetch results in a chosen shape, group writes in transactions and wrap SQL in repository classes.

    You build: Persistent, secured notes service: A PDO repository using prepared statements and a transaction for a two-table write.

  5. 05

    Module 8

    PHP web application with validated forms database access and tests

    Install PHPUnit with Composer, write assertions, exception and data-provider tests, test database code against SQLite and prove a running app with loopback curl checks.

    You build: The final project, demonstrated to a trainer.

Full curriculum

8 modules and 49 lessons, 30 to 51 hours of study

01PHP runtime6 lessons, 3 to 4 hours

Lessons

  • Choosing a supported PHP branch from php.net
  • Running a PHP script from the command line
  • Variables, scalar types and var_dump
  • Strict comparison, loose comparison and match
  • Indexed arrays, associative arrays and foreach
  • Serving PHP on loopback with the built-in server and curl

After this module you can

  • Read the php.net supported-versions table and justify in writing which installed branch a new project may use on 2026-10-12.
  • Execute a .php file with the CLI, explain the opening tag and what is sent to standard output, and set an exit status.
  • Start php -S on loopback with a document root, request a page with curl -i, and use a router script to return false for static files.
02Types and functions6 lessons, 3 to 4 hours

Lessons

  • declare(strict_types=1) and where it applies
  • Nullable types, union types and return types
  • Default values and named arguments
  • Closures, arrow functions and array_map / array_filter
  • Variadic parameters and argument unpacking
  • Passing by value and by reference

After this module you can

  • Predict whether a call coerces or throws TypeError by looking at the file that makes the call, not the file that defines the function.
  • Write signatures using ?T, T|U and return types, and predict which calls are accepted.
  • Predict whether a function changes the caller's variable, and use & references only when required.
03Requests and forms6 lessons, 3 to 4 hours

Lessons

  • Request method and the GET and POST superglobals
  • Validating input with filter_var and trim
  • Escaping output with htmlspecialchars
  • Post-redirect-get with header and exit
  • Reading a JSON request body and answering with JSON
  • Routing by path with a router script and 404 responses

After this module you can

  • Branch on the HTTP method and read query-string and form values from $_GET and $_POST, handling absent keys without notices.
  • Validate integer, email and range inputs with filter_var and trim, and tell a failed check (false) from a valid but falsy value such as 0.
  • Dispatch requests to handlers by URL path inside a router script, returning 404 for unknown paths.
04Classes and packages7 lessons, 3 to 5 hours

Lessons

  • Classes with constructor promotion and readonly properties
  • Interfaces and polymorphic calls
  • Backed enums for fixed sets of values
  • Namespaces and use statements
  • PSR-4 autoloading with Composer
  • Requiring packages: composer.json, composer.lock and install versus update
  • Constructor injection to compose classes

After this module you can

  • Write an immutable value class with promoted readonly properties and predict what happens on modification.
  • Define an interface and two implementing classes, and call both through the interface type.
  • Build a service class that receives its collaborators through the constructor and swap an implementation without editing the service.
05Errors and configuration6 lessons, 3 to 4 hours

Lessons

  • try, catch and finally with custom exceptions
  • Error, Exception and the Throwable family
  • Strict JSON decoding and shape checks
  • Reading and writing files defensively
  • Configuration from the environment
  • Error display, logging and error_log in development versus production

After this module you can

  • Throw a custom exception subclass, catch it by type, and use finally for cleanup that must always run.
  • Catch built-in TypeError, ValueError and UnhandledMatchError and explain what Throwable covers.
  • Explain the difference between displaying and logging errors, and set them for a development run versus a safe default.
06Database access6 lessons, 3 to 4 hours

Lessons

  • Connecting with PDO and choosing the error mode
  • Prepared statements and named placeholders
  • Fetching results as rows, lists and single values
  • Inserting rows, lastInsertId and duplicate or NULL values
  • Transactions with commit and rollback
  • Repository classes and the LIKE and identifier pitfalls

After this module you can

  • Create a PDO connection to SQLite, set exceptions as the error mode, and show a failing query raising PDOException.
  • Run a parameterised SELECT with a named placeholder, passing request data only as bound values.
  • Wrap queries in a repository class and handle LIKE patterns and dynamic identifiers without string-built input.
07Sessions and security6 lessons, 3 to 4 hours

Lessons

  • Starting a session and carrying it with a cookie jar
  • Session cookie parameters: secure, httponly, samesite
  • Hashing passwords with password_hash and password_verify
  • Login, logout and session id regeneration
  • CSRF tokens with random_bytes and hash_equals
  • Access control: login required, ownership checks and escaped output

After this module you can

  • Store a value in $_SESSION in one request and read it in the next, using curl's cookie jar to carry the session cookie.
  • Set cookie attributes with session_set_cookie_params before session_start and verify them in the Set-Cookie header.
  • Restrict routes to logged-in users, check that a record belongs to the requesting user, and keep all output escaped.
08Application tests6 lessons, 3 to 4 hours

Lessons

  • Installing PHPUnit and running an empty suite
  • Writing a first test with assertSame
  • Testing exceptions with expectException
  • Data providers for table-driven cases
  • Testing database code against SQLite
  • HTTP smoke checks against the built-in server

After this module you can

  • Add PHPUnit as a Composer dev dependency, add a phpunit.xml and run vendor/bin/phpunit.
  • Write a TestCase subclass with test methods and choose assertSame over loose assertions.
  • Write a shell script that starts the app on loopback, checks status codes and bodies with curl, and stops the server.

What you'll build

4 guided projects along the way, then a final project.

  • Command-line and loopback PHP toolkit

    after module 2
  • Validated request handler on loopback

    after module 3
  • Domain library with Composer autoload

    after module 5
  • Persistent, secured notes service

    after module 7

Final project

PHP web application with validated forms database access and tests. Options: Event sign-up board; Equipment loan register; Community recipe box.

What you submit

Source repository with composer.json and composer.lock, namespaced classes under PSR-4 autoloading Functional checks: loopback curl transcript for every route, including a rejected invalid form and a rejected request without a CSRF token.

How it's reviewed

Trainer review against a weighted rubric: Security controls: prepared statements for all values, escaped output, password hashing, CSRF token, session regeneration (each checked by transcript).

Where you'll use it

  • Handle a form submission with validation, escaped output and a redirect after POST.
  • Run every database query through prepared statements and protect forms with CSRF tokens.

Roles that use these skills

  • PHP developer
  • Web developer
  • Backend developer

Earn the certificate by building, not watching

  1. Complete the lessons and pass each module checkpoint.
  2. Build your final project and demonstrate it.
  3. OUTLEARN reviews your project and issues your certificate. It is not issued automatically.

Frequently asked questions

What should I know before starting?

The course expects Programming Problem Solving, Web Foundations: HTML, CSS and Responsive Layouts or an accepted equivalent. Prerequisite courses: Programming Problem Solving and Web Foundations: HTML, CSS and Responsive Layouts. A short diagnostic check is described in the entry requirements.

What do I build for the final project?

You choose one of 3 options: Event sign-up board; Equipment loan register; Community recipe box. It is reviewed by a trainer in a live demonstration.

When do I get a certificate?

Only after you build and demonstrate your live project. OUTLEARN staff issue certificates; nothing is issued automatically.

Be first in when PHP Programming opens

Email us and we will tell you as soon as enrolment opens.

Notify me when it opens
FreeOpens soon
Notify me