Back to Projects

CASE STUDY

Council Services on Drupal 11

A Drupal 11 site for a fictional local authority. Its custom Bin Day Finder module lets residents enter a postcode and see their next bin collections, through an accessible custom theme.

Drupal 11PHP 8.3TwigPHPUnitPlaywrightaxe-coreGitHub ActionsDDEV

0

axe-core accessibility violations across 5 page states, desktop and mobile

26

automated PHPUnit tests: unit, kernel and functional

WCAG 2.2 AA

colour contrast and keyboard access built into the theme

The Problem

“When is my bin day?” is one of the most common questions residents ask their council. The answer has to work for everyone, including people using screen readers, keyboards or old phones, and it shouldn't break when a third-party service is down.

The Solution

I built a custom Drupal 11 module and theme using modern Drupal practice: services with dependency injection, PHP attributes for hooks and plugins, configuration with schema, and the Form API. Rounds and bin types are stored as configuration, so they can be changed and deployed without editing code.

Accessible by design

A custom theme built to WCAG 2.2 AA, using GOV.UK Design System patterns for errors and hints. Automated axe-core checks run on every push.

Real API integration

Postcodes are checked against postcodes.io, with a 5-second timeout, 24-hour caching and a fallback if the service is down.

Secure and configurable

Rate limiting with Drupal's flood service, validation before any API call, and an admin settings page so staff can change behaviour without a developer.

Tested end to end

26 PHPUnit tests (unit, kernel and functional), Drupal coding standards and accessibility checks, all running in CI.

Screenshots

Bin Day Finder results showing the next black, blue and brown bin collection dates for a Sheffield postcode
Results
Error summary titled There is a problem, linking to the postcode field, with an inline error message
Validation error (GOV.UK pattern)
Bin Day Finder results on a phone-sized screen
Mobile

How It Works

01

Resident enters a postcode

On /bin-day or from a block in the sidebar. The form works without JavaScript.

02

Validate

The postcode is tidied up and its format checked, then the visitor's search count is checked against the hourly limit.

03

Verify

A service checks the postcode exists using postcodes.io. If the service is down, the resident still gets an answer, marked as unverified.

04

Work out collections

A second service maps the postcode area to a collection round and calculates the next black, blue and brown bin dates.

05

Show results

Results render through a Twig template, and focus moves to them so screen reader users know they've appeared.

Outcome

A working council service that installs with one command, passes its tests and accessibility checks on every push, and keeps answering residents when the postcode service fails. The tests caught two real bugs before release: a crash on a second search and stale results showing beside a new error.

Read more: Back to Drupal after ten years and Accessibility as a build requirement.

Portfolio project: “Demo City Council” is fictional and collection dates come from demonstration data. Postcode data from postcodes.io under the Open Government Licence.

Back to all Projects