Download the PHP package menarasolutions/geographer without Composer

On this page you can find all versions of the php package menarasolutions/geographer. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

Please rate this library. Is it a good library?

All versions of geographer with dependencies

Informations about the package geographer

Geographer

Build Status Code Climate Test Coverage Total Downloads Latest Stable Version Latest Unstable Version License

Geographer is a PHP library that knows how any country, state or city is called in any language. Documentation on the official website

Includes integrations with: Laravel 5, Lumen 5

Geographer

Dependencies

Installation via Composer

To install simply run:

Or add it to composer.json manually:

This, main package is shipped with English language so add extra dependencies for your other languages, eg.:

Usage

Collections

Arrays of administrative divisions (countries, states or cities) are returned as collections – a modern way of implementing arrays. Some of the available methods are:

Common methods on division objects

All objects can do the following:

You can access information in a number of ways, do whatever you are comfortable with:

Subdivision standards

By default, we will use ISO-3166-1 country and ISO 3166-2 state classification. Therefore, countries or states that don't have ISO codes are not visible by default. Please note that FIPS 10-4 is a deprecated (abandoned) standard. It's better not to rely on it – new states and/or countries won't appear in FIPS.

You can change subdivision standard with method:

This will affect and output.

Earth API

Earth object got the following convenience methods:

By default, we will use ISO 3166-1 country classification.

Country API

Country objects got the following encapsulated data:

Geonames, ISO 3166-1 alpha-2, alpha-3 and numeric codes are four viable options to reference country in your data store.

State API

At this moment Geographer only keeps cities with population above 50,000 for the sake of performance.

Geonames, ISO 3166-2 and FIPS are all unique codes so all three can be used to reference states in your data store.

City API

Geonames ID is currently the only viable option to reference a city in your data store.

Integrations with frameworks

Official Laravel package

Current coverage: subdivisions

Type ISO 3166 FIPS Geonames GENC
Countries 100% Coming soon 100% TBC
States 100% Coming soon 100% TBC

Subdivision data is kept in a separate repo - geographer-data so that it may be reused by different language SDKs.

Current coverage: translations

By default Geographer assumes that you use Packagist (Composer) to install language packages, therefore we will expect them in vendor/ folder. There is no need to manually turn on an extra language, but if you attempt to use a non-existing language – expect an exception.

Language Countries States Cities Package
English 100% 100% 100% geographer-data
Russian 100% 100% 63% geographer-ru
Ukrainian geographer-uk
Spanish geographer-es
Italian geographer-it
French geographer-fr
German geographer-de
Chinese Mandarin geographer-zh

English texts are included in the data package and are used as default metadata.

Vision

Our main principles and goals are:

  1. Be lightweight and independent – so that this package can be pulled anywhere alone
  2. Coverage – Geographer should cover all countries and languages
  3. Be extensible – developers should be able to override and extend easily

Performance

While not a number one priority at this stage, we will try maintain reasonable CPU and memory performance. Some benchmarks:

Inflating a city based on its Id

Time: 6 ms, memory: 81056 bytes

Video tutorials

I've just started a educational YouTube channel that will cover top IT trends in software development and DevOps: config.sys

Todo

  1. Add a basic spatial index
  2. Add some unit tests (in addition to existing integration tests)
  3. Add coverage information for language packages

Projects using Geographer

Tell us about yours!

Contribution

Read our Contribution guide

License

The MIT License (MIT) Copyright (c) 2016 Denis Mysenko

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


Version
Requires php Version >=5.5.0
menarasolutions/geographer-data Version ^0.1.0

The package menarasolutions/geographer contains the following files

Loading the files please wait ....