PHP developer in Birmingham

WordPress for businesses in Birmingham, delivered remotely by one developer.

PHP developer

My place in the WordPress community

  • I have had a wordpress.org account since 2006.
  • I contributed to WordPress core for versions 7.0 and 7.1.
  • I maintain 30 plugins on wordpress.org.
  • I organise and speak at WordCamps.
  • I have attended every WordCamp Europe from 2017 to 2026.

My WordPress.org profile

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.

Narrowboats moored along the canal at Gas Street Basin in Birmingham

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.

#Who can use GOV.UK Notify and GOV.UK Pay?

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.

#How do I install the Notify client in PHP?

The PHP documentation installs the official client with Composer, together with a PSR-7 adapter:

composer require php-http/guzzle7-adapter alphagov/notifications-php-client

The 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.

#What are the three key types?

The documentation separates keys by what they do:

Key typeWhat the documentation says
Testrealistic 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 listreal messages to your team and up to 5 guest recipients while a service is in trial mode; these count against allowances
Livesends 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.

#How do I send an email, text or letter?

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.

#How do I send to many people?

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.

#How should PHP code handle Notify errors?

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.

#How do I know a message was delivered?

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.

#Can I attach a file to an email?

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.

#How does a GOV.UK Pay payment work?

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 number
  • reference, an identifier for the payment, ideally unique
  • description, the human-readable purpose
  • return_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.

#What must the PHP code do with next_url and the return page?

Three rules come straight from the Pay documentation.

  1. Show next_url only to the paying user. The page warns that anyone else holding it could hijack the payment.
  2. Never reuse an old 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.
  3. When the user lands on your 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.

#What I do and do not take on

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.

#Brief for a Notify or Pay integration

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.

Need this service: PHP developer in Birmingham?

Describe your project by e-mail. I reply within 24 hours.

Describe your project

Latest PHP developer articles

Dec 2, 2026

Laravel Rust: what does it mean for PHP apps?

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.

Explore other WordPress services and knowledge base