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.
All versions of geographer with dependencies
Informations about the package geographer
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
- PHP >= 5.5
Installation via Composer
To install simply run:
Or add it to
This, main package is shipped with English language so add extra dependencies for your other languages, eg.:
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:
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 object got the following convenience methods:
By default, we will use ISO 3166-1 country classification.
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.
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.
Geonames ID is currently the only viable option to reference a city in your data store.
Integrations with frameworks
Current coverage: subdivisions
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.
English texts are included in the data package and are used as default metadata.
Our main principles and goals are:
- Be lightweight and independent – so that this package can be pulled anywhere alone
- Coverage – Geographer should cover all countries and languages
- Be extensible – developers should be able to override and extend easily
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
I've just started a educational YouTube channel that will cover top IT trends in software development and DevOps: config.sys
- Add a basic spatial index
- Add some unit tests (in addition to existing integration tests)
- Add coverage information for language packages
Projects using Geographer
Tell us about yours!
Read our Contribution guide
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.