Michaelhall/geo-se

此包已被废弃,不再维护。未建议替代包。

瑞典地理数据

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

瑞典地理数据的类。

需求

  • PHP >= 7.1

使用Composer安装

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

基本用法

<?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);

许可证

MIT