jolanuk/filament-postcodes

A valid UK postcode generator for FilamentPHP.

Maintainers

Package info

github.com/jolanUK/filament-postcodes

Homepage

Issues

pkg:composer/jolanuk/filament-postcodes

Fund package maintenance!

jolanUK

Statistics

Installs: 1

Dependents: 0

Suggesters: 0

Stars: 0

v5.0.0 2026-03-01 19:39 UTC

This package is auto-updated.

Last update: 2026-03-08 00:49:35 UTC


README

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

A valid UK postcode generator for FilamentPHP, structurally inspired by the Brazilian equivalent developed by Otávio Araújo. This version uses the API found at postcodes.io.

Installation

You can install the package via composer:

composer require jolanuk/filament-postcodes

Usage

Similar to SmartCEP, Filament Postcodes also implements field bindings.

use jolanUK\FilamentPostcodes\Forms\Components\PostcodeField;

PostcodeField::make('postcode')
    ->bindQualityField('quality')
    ->bindEastingsField('eastings')
    ->bindNorthingsField('northings')
    ->bindCountryField('country')
    ->bindNHSHAField('nhs_ha')
    ->bindLongitudeField('longitude')
    ->bindLatitudeField('latitude')
    ->bindEuropeanElectoralRegionField('european_electoral_region')
    ->bindPrimaryCareTrustField('primary_care_trust')
    ->bindRegionField('region')
    ->bindLSOAField('lsoa')
    ->bindMSOAField('msoa')
    ->bindIncodeField('incode')
    ->bindOutcodeField('outcode')
    ->bindParliamentaryConstituencyField('parliamentary_constituency')
    ->bindParliamentaryConstituency2024Field('parliamentary_constituency_2024')
    ->bindAdminDistrictField('admin_district')
    ->bindParishField('parish')
    ->bindAdminCountyField('admin_county')
    ->bindDateOfIntroductionField('date_of_introduction')
    ->bindAdminWardField('admin_ward')
    ->bindCEDField('ced')
    ->bindCCGField('ccg')
    ->bindNUTSField('nuts')
    ->bindPFAField('pfa')
    ->bindNHSRegionField('nhs_region')
    ->bindTTWAField('ttwa')
    ->bindNationalParkField('national_park')
    ->bindBUAField('bua')
    ->bindICBField('icb')
    ->bindCancerAllianceField('cancer_alliance')
    ->bindLSOA11Field('lsoa11')
    ->bindMSOA11Field('msoa11')
    ->bindLSOA21Field('lsoa21')
    ->bindMSOA21Field('msoa21')
    ->bindOA21Field('oa21')
    ->bindRUC11Field('ruc11')
    ->bindRUC21Field('ruc21')
    ->bindLEP1Field('lep1')
    ->bindLEP2Field('lep2'),

This will bind to a field in the same schema, with the matching machine name.

TextInput::make('quality'),
TextInput::make('eastings'),
TextInput::make('northings'),
TextInput::make('country'),
TextInput::make('nhs_ha'),
TextInput::make('longitude'),
TextInput::make('latitude'),
TextInput::make('european_electoral_region'),
TextInput::make('primary_care_trust'),
TextInput::make('region'),
TextInput::make('lsoa'),
TextInput::make('msoa'),
TextInput::make('incode'),
TextInput::make('outcode'),
TextInput::make('parliamentary_constituency'),
TextInput::make('parliamentary_constituency_2024'),
TextInput::make('admin_district'),
TextInput::make('parish'),
TextInput::make('admin_county'),
TextInput::make('date_of_introduction'),
TextInput::make('admin_ward'),
TextInput::make('ced'),
TextInput::make('ccg'),
TextInput::make('nuts'),
TextInput::make('pfa'),
TextInput::make('nhs_region'),
TextInput::make('ttwa'),
TextInput::make('national_park'),
TextInput::make('bua'),
TextInput::make('icb'),
TextInput::make('cancer_alliance'),
TextInput::make('lsoa11'),
TextInput::make('msoa11'),
TextInput::make('lsoa21'),
TextInput::make('msoa21'),
TextInput::make('oa21'),
TextInput::make('ruc11'),
TextInput::make('ruc21'),
TextInput::make('lep1'),
TextInput::make('lep2'),

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Security Vulnerabilities

Please email me directly to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.