How to display the current and parent category in WordPress
Need to show the category hierarchy in your theme? Learn how to get the current category and its parent using get_the_category() and get_category_parents().
A council application rarely stops at a database row. A planning decision becomes a letter, a bin collection change becomes a text message, a licence fee becomes a card payment. In the UK public sector those three steps often run through GOV.UK Notify and GOV.UK Pay. I am Mariusz Szatkowski, a PHP developer in Gdynia, Poland. I take PHP work from the West Midlands remotely and in writing, and I connect case systems to these two platforms or implement a design your team already has.

Photographer David Hallam-Jones, CC BY-SA 2.0 licence, via Wikimedia Commons.
Everything below is read from the platforms’ own documentation. Where a page did not show a detail when I fetched it, the text says so.
The Notify page on who can use it lists local authorities among the teams it is available to, and states that only public sector organisations can accept its data processing and financial agreement. Whether a supplier works with keys the council issues is the council’s decision.
The GOV.UK Pay home page says it is used across central and local government, police and the NHS, and that the API has no charge. It does not state formal eligibility rules on that page. The council’s service owner decides that, not the developer.
The PHP documentation installs the official client with Composer, together with a PSR-7 adapter:
composer require php-http/guzzle7-adapter alphagov/notifications-php-clientThe client takes the API key and an HTTP client:
<?php
declare(strict_types=1);
$notifyClient = new \Alphagov\Notifications\Client([
'apiKey' => getenv('NOTIFY_API_KEY'),
'httpClient' => new \Http\Adapter\Guzzle7\Client(),
]);The key comes from the environment. The documentation recommends rotating live keys regularly, which is easier when the key is not in the code.
The documentation separates keys by what they do:
| Key type | What the documentation says |
|---|---|
| Test | realistic responses with a delivered status, nothing is sent, nothing shows on the dashboard, nothing counts against allowances; specific test numbers and addresses simulate failures |
| Team and guest list | real messages to your team and up to 5 guest recipients while a service is in trial mode; these count against allowances |
| Live | sends to anyone, but only after the service is live |
A PHP application should pick the key from configuration per environment, and a deployment to staging must never hold the live key. Letters can only be sent with a live key from a live service.
The client has one method per channel. The documentation shows sendEmail, sendSms and sendLetter, each taking a template identifier and a personalisation array, with an optional reference.
try {
$response = $notifyClient->sendEmail(
$emailAddress,
$templateId,
['name' => $name, 'case_ref' => $caseRef],
$reference
);
} catch (\Alphagov\Notifications\Exception\ApiException $e) {
// branch on $e->getCode(), see the error section
}For letters the personalisation must include a recipient address of at least three lines, and the last line must be a real UK postcode or a non-UK country name. The documentation’s own letter example calls sendEmail, which looks like a copy error, so the sample above uses the channel method that fits the channel.
The reference is a value you create to identify one notification or a batch. The documentation says it must not contain personal information such as a name or postal address. A case number that is itself personal data needs the council’s data protection officer to decide before it goes in.
There is no bulk call in the PHP documentation. It says to loop over the recipients and send one message at a time, within the rate limit. That limit is 3,000 messages per minute, calculated on a rolling basis per API key type, and the page asks you to avoid large spikes. Going over returns HTTP 429 with a RateLimitError.
The page also gives daily limits for live and test keys: 250,000 emails, 250,000 text messages and 20,000 letters, with limits resetting at midnight UTC. Trial-mode team keys are limited to 50 emails or text messages.
In PHP the answer is a queue. A web request writes one row per message to a table or a queue, and a worker sends them at a steady pace below the limit. If the worker receives a 429 it waits and tries that row again. A large mailing then runs for a planned stretch of minutes instead of failing as one request.
Failed requests raise Alphagov\Notifications\Exception\ApiException. The documentation advises branching on the status code or error type and not on the message text, because messages can change. It lists validation errors as 400, authentication as 403, rate limits as 429 and server errors as 500.
try {
$notifyClient->sendSms($number, $templateId, ['name' => $name]);
} catch (\Alphagov\Notifications\Exception\ApiException $e) {
if ($e->getCode() >= 500 || $e->getCode() === 429) {
// put the row back on the queue
} else {
// 400 or 403: a bug or a bad key, log $e->getErrors() and stop retrying
}
}The split matters in practice. A 400 does not get better by retrying, and a retry loop on a wrong key only fills the log.
There are two routes, and a council system usually needs both.
Polling. getNotification($notificationId) returns one message, and listNotifications() returns up to 250 messages a page. Both only see messages sent within the retention period, which defaults to 7 days. The documented statuses for an email are created, sending, delivered, permanent-failure, temporary-failure and technical-failure. Text messages add pending and sent. Letters use accepted, received, cancelled, technical-failure and permanent-failure.
Callbacks. Notify sends a POST to your URL when a text or email is delivered or fails, when your service receives a text, and when a returned letter is reported. You give it a URL and a bearer token, and it places the token in the authorisation header. A failed callback is retried every 5 minutes, up to 5 times. The delivery receipt carries fields including id, reference, status, completed_at and notification_type.
A callback endpoint is a public URL, so it checks the token before anything else. In PHP use hash_equals for the comparison, which php.net documents as timing-attack safe, and write the status change before answering 200.
<?php
$given = $_SERVER['HTTP_AUTHORIZATION'] ?? '';
if (!hash_equals('Bearer ' . getenv('NOTIFY_CALLBACK_TOKEN'), $given)) {
http_response_code(401);
exit;
}
$receipt = json_decode(file_get_contents('php://input'), true, 512, JSON_THROW_ON_ERROR);
// update the row whose reference matches $receipt['reference']
http_response_code(200);Because the retention period is 7 days, a case system that needs a delivery record for longer stores the status itself from the callback.
The documentation describes a file upload through personalisation, with prepareUpload. The file must be smaller than 2MB, and the permitted types include PDF, DOCX, XLSX, CSV, JPEG, PNG and others. The filename is at most 100 characters and needs an extension. The retention period runs from 1 to 78 weeks with a default of 26 weeks, and recipients confirm their email address before downloading unless that flag is turned off per file.
The page notes that turning the confirmation off is not recommended. For a letter that contains a person’s case details, the default is the safer choice.
The payment flow page describes seven steps. The user reaches the point of paying and sees what and how much. Your service sends a create-payment request with the amount and a return URL. The response carries a next_url, and you send the user there. The user enters card details on the Pay page, the provider checks with the card issuer, and the user confirms. The user returns to your return URL, and your service checks the status through the API and shows a confirmation or failure page. The user has 90 minutes to finish after the payment is created.
The create request is POST /v1/payments with these body fields:
amount, in pence, as a numberreference, an identifier for the payment, ideally uniquedescription, the human-readable purposereturn_url, where the user goes when the journey ends, over HTTPS for real payments$payload = [
'amount' => 14500,
'reference' => $paymentRef,
'description' => 'Pay your licence fee',
'return_url' => 'https://example.org/payment/return',
];The response carries payment_id, state, and _links with self and next_url.
Three rules come straight from the Pay documentation.
next_url only to the paying user. The page warns that anyone else holding it could hijack the payment.next_url. Each carries a unique token and works once. To resume an incomplete payment (status created, started or submitted) redirect the user to the next_url of that payment. Failed, cancelled and error payments cannot be resumed and need a new payment.return_url, call GET /v1/payments/{PAYMENT_ID}. The page says to use this request for the status and not search requests, which may not be up to date.So the return page is not proof of payment. It is a trigger to ask the API, and the case record changes only on the API’s answer. Store the payment_id against the case before redirecting the user, so a return without a session can still be matched.
The docs also describe webhooks for payment events, with sections on setting up a callback URL. When I fetched that page, the headings were visible but not the bodies, so I do not describe the webhook payload here.
I write the PHP: the Notify and Pay clients behind an interface, the queue and worker, the callback endpoint, a test suite that runs against the Notify test key, and a runbook your team can follow. I work remotely from Gdynia, one hour ahead of Britain, in email and shared documents.
I do not hold your council’s keys, I do not decide what a template may say, and I do not give legal advice on data protection. Those stay with the service owner and the data protection officer. The PHP developer page describes the general scope of my PHP work.
Write to me through the contact form with the channels you need, the volume per month and the stack you run. The first written estimate is free, and it lists which of the cases above your system hits.
Examples of my work.
Jobsin.co is a modern job board focused on posting job offers for qualified specialists in the fields of construction, mechanics, and engineering worldwide.
The event application project dedicated to the 15th Broadband Technology Conference is a WordPress-based event site with editable content and event-management features for conference participants.
Effective e-Publishing is an innovative project focused on digital content creation, import, publishing, and distribution. This platform is designed for effe...
Describe your project by e-mail. I reply within 24 hours.
Describe your projectNeed to show the category hierarchy in your theme? Learn how to get the current category and its parent using get_the_category() and get_category_parents().
Need to get the URL of the first image or link in an article? Prefer DOMDocument over regex. Ready-made WordPress PHP for developers.
On 1 December 2026 Taylor Otwell shipped the Laravel Rust beta, and Laravel Go followed a day later. What the framework contains, what the 18x benchmark really measures, what happens to Laravel PHP and WordPress, and when a rewrite makes sense.
Custom WordPress engineering and architecture.
Scalable headless, ERP, and AI architecture for enterprise.
Stores, checkout flow, and sales logic.
Stability, updates, and post-launch support.
What the monthly care fee covers and what changes it.
Business process automation around WordPress and company systems.
Headless WordPress, Sanity, Strapi, and Contentful with Astro or Next.js.
Astro, MDX, edge delivery, and Core Web Vitals measured on real traffic.

How to start as a WordPress developer in 2026. Local environment, theme and plugin development, REST API and headless paths, security and Core Web Vitals. A practitioner playbook that does not waste your first month.

WordPress 7.0 with AI Client against Astro 7 with the Rust compiler and Vite 8. Speed, cost, SEO and security compared, plus the real bill for my own Astro 6 to 7 migration.

A detailed comparison table of EmDash CMS and WordPress across architecture, security, plugins, AI features, content model, hosting, and ecosystem maturity.