Download the PHP package phpfacile/geocoding without Composer

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

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package geocoding

PHPFacile! Geocoding

This is mainly aimed at retrieving coordinates (latitude, longitude) of a location (address, place).

It is based on geocoder-php (https://github.com/geocoder-php/Geocoder) and tries to use the provider matching our requirements:

REM: A cache is used so as to meet as far as possible usage limitation defined by the providers

Installation

At the root of your project type

Or add "phpfacile/geocoding": "^1.0" to the "require" part of your composer.json file

Providers comparison

Providers Storage allowed? Restrictions
Geonames Yes No more than 1 req/s
GoogleMap for 30 days max
MapBox No
Nominatim Yes No more than 1 req/s

Usage

$geocodingService = new GeocodingService($cfg, $cacheDir);

$cfg = [
    'geonames' => [
        'username' => '<replace with geonames username>',
    ],
    'nominatim' => [
        'rootUrl' => 'https://nominatim.openstreetmap.org',
        'userAgent' => '<replace with a user-agent>',
    ]
];

$cacheDir.'/nominatim' must exist (ex: if $cacheDir='/cache' then '/cache/nominatim' folder must exist and be writable)

Actually, in the current implementation, in any case nominatim is the preferred provider.

$locations = $this->geocodingService->getLocationsByAddress('Etretat, France');
foreach ($locations as $location) {
    var_dump($location);
}

$locations = $this->geocodingService->getPlacesByCountryAndPlaceName('France', 'Etretat');
foreach ($locations as $location) {
    var_dump($location);
}

Disclaimer

Nominatim may stop its service at any moment

Troubleshooting

If ever you modify the code so as to use geonames, you have to know that the following error message is silently ignored by the geonames provider (https://github.com/geocoder-php/geonames-provider)

{"status":{"message":"user account not enabled to use the free webservice. Please enable it on your account page: http://www.geonames.org/manageaccount ","value":10}}

Todo


All versions of geocoding with dependencies

PHP Build Version
Package Version
Requires php Version >=7.0.0
geocoder-php/cache-provider Version ^4.1
geocoder-php/geonames-provider Version ^4.1
geocoder-php/nominatim-provider Version ^5.0
php-http/guzzle6-adapter Version ^1.1
php-http/message Version ^1.7
zendframework/zend-cache Version ^2.8
zendframework/zend-serializer Version ^2.9
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package phpfacile/geocoding contains the following files

Loading the files please wait ....