michaelhall/geo-se

This package is abandoned and no longer maintained. No replacement package was suggested.

Swedish geography data

v1.0.0 2017-11-23 21:52 UTC

This package is auto-updated.

Last update: 2022-02-01 13:11:08 UTC


README

Build Status codecov.io StyleCI License Latest Stable Version Total Downloads

Classes for swedish geography data.

Requirements

  • PHP >= 7.1

Install with composer

$ composer require "michaelhall/geo-se:~1.0"

Basic usage

<?php

require __DIR__ . '/vendor/autoload.php';

// Find a region by id.
$region = MichaelHall\GeoSe\Region::findById(1);

// Prints "Stockholms län".
echo $region->getName();

// Also prints "Stockholms län".
echo $region;

// Find a municipality by id.
$municipality = MichaelHall\GeoSe\Municipality::findById(1480);

// Prints "Göteborgs kommun".
echo $municipality->getName();

// Also prints "Göteborgs kommun".
echo $municipality;

// Prints "Västra Götalands län".
echo $municipality->getRegion()->getName();

// Throws a MichaelHall\GeoSe\Exceptions\RegionNotFoundException.
MichaelHall\GeoSe\Region::findById(123);

// Throws a MichaelHall\GeoSe\Exceptions\MunicipalityNotFoundException.
MichaelHall\GeoSe\Municipality::findById(4567);

License

MIT