La Gazette de Saint-Glinglin
Learn PHP 8 from scratch
New to PHP? Learn the basics of the language, objects, Composer's autoload and a router, without a framework, by putting a small village's gazette online.
39 exercises 6 chapters 5,100 XP About 13 h of practice
€29.00 €19.00 Incl. VAT, lifetime access
Founder price, 100 places left.
Buy the trackFirst chapter free with an account.
01
Today's front page
Free
- Exercise 1: Hello Saint-Glinglin Topics covered echoVariableString
- Exercise 2: The date in the masthead Topics covered VariableNumberConcatenationdate()
- Exercise 3: Today's articles Topics covered ArrayAssociative arrayforeach
- Exercise 4: The top story Topics covered ifelseBooleanComparison
- Exercise 5: The standfirst Topics covered String functionsmb_strlen()mb_substr()mb_strtoupper()
- Exercise 6: One function per article Topics covered FunctionTypereturnhtmlspecialchars()
-
Chapter course notes
02
The newsroom gets organized
🔒 Full track
- Exercise 1: The Article class Topics covered ClassObjectConstructorNamed arguments
- Exercise 2: A title that stays put Topics covered readonlyVisibilityMethod$this
- Exercise 3: Sections Topics covered Enummatch
- Exercise 4: Who wrote this? Topics covered CompositionObject inside an objectMethod
- Exercise 5: A photo for the front page Topics covered Nullable typenullDefault value
- Exercise 6: Articles and classified ads Topics covered InterfaceimplementsPolymorphism
- Exercise 7: A price that holds up Topics covered Property hookprivate(set)Virtual property
- Exercise 8: The table of contents Topics covered Arrow functionfnarray_filter()count()instanceof
- Exercise 9: Bylines Topics covered array_map()array_unique()implode()
-
Chapter course notes
03
Too many requires
🔒 Full track
- Exercise 1: One file per class Topics covered require_once__DIR__Code organization
- Exercise 2: Class not found Topics covered DebuggingError messageLoading order
- Exercise 3: My first autoloader Topics covered Autoloadspl_autoload_register()Anonymous function
- Exercise 4: Namespaces Topics covered NamespacesnamespaceuseAutoload
-
Chapter course notes
04
Composer takes over
🔒 Full track
- Exercise 1: Reading a composer.json Topics covered Composercomposer.jsonJSONDependency
- Exercise 2: Declaring PSR-4 Topics covered PSR-4ComposerAutoloadcomposer dump-autoload
- Exercise 3: Goodbye, homemade autoloader Topics covered vendor/autoload.phpComposerAutoload
- Exercise 4: Subfolders Topics covered NamespacesusePSR-4Composercomposer dump-autoload -o
-
Chapter course notes
05
Every article gets its address
🔒 Full track
- Exercise 1: Installing a router Topics covered composer requireDependencyvendor/ComposerRouter
- Exercise 2: The newsroom moves out Topics covered Static methodSeparation of concernsuse
- Exercise 3: Functions without a name Topics covered Anonymous functionAssociative arrayisset()Router
- Exercise 4: The front controller Topics covered RouterFront controllerClass constant$_SERVER
- Exercise 5: One page per article Topics covered Route parameterLinkMethod
- Exercise 6: Sections online Topics covered Route parameterEnumfrom()
- Exercise 7: Lost in the post Topics covered HTTP status codes404405http_response_codetryFrom()
- Exercise 8: The missing article Topics covered Exceptionthrowtrycatch
- Exercise 9: An exception with its own name Topics covered Inheritanceextendsparent::Custom exceptionException
-
Chapter course notes
06
The Gazette is online
🔒 Full track
- Exercise 1: A first template Topics covered Template<?= ?>ob_start()extract()require
- Exercise 2: The article template Topics covered Alternative syntaxGetter
- Exercise 3: A shared layout Topics covered TemplateLayoutEnum::cases()
- Exercise 4: Posting a classified ad Topics covered FormsPOST method$_POSTValidation422
- Exercise 5: No traps in the ads Topics covered XSShtmlspecialchars()Validationis_string
- Exercise 6: Searching the gazette Topics covered GET method$_GETQuery stringstr_contains()array_filter()
- Exercise 7: Controllers as classes Topics covered ControllerCallable::classDynamic instantiation
-
Chapter course notes
Learn PHP 8 by writing code
This course teaches PHP by writing code, not by watching videos. Every exercise runs in the browser, with nothing to install: PHP runs inside the page, the preview of the site updates while you code, and automated tests tell you whether each objective is met.
The common thread: the gazette of Saint-Glinglin, a small French village. It starts as a page that says “Hello” and ends up as a real website, with one page per article, sections, a classified ads form and a search, all without a framework.
What you will learn
- the basics: variables, arrays, loops, conditions and functions;
- object-oriented programming in PHP 8: classes, promoted properties,
readonly, enums, interfaces, and the property hooks of PHP 8.4; - array functions and arrow functions;
- organizing code: one file per class, autoloading, namespaces;
- Composer:
composer.json, PSR-4, installing a dependency; - a router, a front controller, HTTP status codes and exceptions;
- templates,
GETandPOSTforms, validation and protection against XSS vulnerabilities.
Each exercise only adds a few concepts at a time, and you use them right away on the site. Each chapter ends with a course summary to keep, as a web page and as a PDF.
Who it is for
For anyone starting out with PHP, or who learned it a long time ago and wants to catch up with PHP 8. A little HTML is all you need. By the end, you will know what a framework like Symfony does for you, and the Symfony course will be the natural next step.
The first chapter is free with an account.