New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

c6digital/mapit-php

Third-party PHP SDK for MapIt.
1,330 1
Install
composer require c6digital/mapit-php
Latest Version:v0.2.0
PHP:^8.2
Laravel:11 · 12
License:MIT
Last Updated:Jun 22, 2026
Links: GitHub  ·  Packagist
Maintainer: ryangjchandler

Third-party PHP SDK for MapIt.

Latest Version on Packagist Tests Total Downloads

This package provides a lightweight SDK to interact with MapIt APIs. It doesn't have methods for everything, only the things that we as an organisation frequently use.

Installation

You can install the package via Composer:

composer require c6digital/mapit-php

Usage

use C6Digital\MapIt\MapIt;

$mapIt = new MapIt(
    key: 'your-mapit-key-here',          // Your MapIt API key / token.
    url: 'https://mapit.mysociety.org'  // An optional MapIt URL.
);

Laravel

If you're using Laravel, this package provides a service provider that automatically registers the MapIt class and uses .env variables to configure the key and URL.

MAPIT_KEY=...
MAPIT_URL=...

You can then request it from the container when you need to use it.

use C6Digital\MapIt\MapIt;

class MyController
{
    public function __invoke(MapIt $mapIt)
    {
        // ...
    }
}

Retrieving postcodes

$mapIt->postcode('SW1P 3BD');

Throwing when errors occur

$mapIt->throw()->postcode(...);

Testing

composer test

Changelog

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

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

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

Related Packages

c6digital/filament-plausible-page

Embed your Plausible dashboard inside of Filament.

1,599 0
c6digital/laravel-site-redirect

A small package to redirect all requests elsewhere.

1,281 1
doctrine/dbal

Powerful PHP database abstraction layer (DBAL) with many features for database s...

651,963,193 9,701
laravel/framework

The Laravel Framework.

604,216,237 34,982

Version History

Version Released PHP Laravel License
v0.2.0 ^8.2 ^11.5 || ^12.0 MIT
v0.1.2 ^8.2 ^11.5 MIT
v0.1.1 ^8.2 ^11.5 MIT
v0.1.0 ^8.2 ^11.5 MIT