c6digital/mapit-php

Third-party PHP SDK for MapIt.

Maintainers

👁 ryangjchandler

Package info

github.com/c6digital/mapit-php

pkg:composer/c6digital/mapit-php

Fund package maintenance!

c6digital

Statistics

Installs: 1 054

Dependents: 0

Suggesters: 0

Stars: 1

Open Issues: 3

v0.2.0 2025-10-16 22:39 UTC

Requires

Requires (Dev)

Suggests

None

Provides

None

Conflicts

None

Replaces

None

MIT f01cb4819d8523bce40d382695e785e23b9caa17

  • Ryan Chandler <support.woop@ryangjchandler.co.uk>

c6digitalmapit-php


README

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