Download the PHP package chris48s/cakephp-geocoder without Composer

On this page you can find all versions of the php package chris48s/cakephp-geocoder. 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 cakephp-geocoder

CakePHP Geocoder Plugin

A thin wrapper around the Google Maps Geocoding API.

This plugin adds a geocoder controller component and model behavior to your CakePHP 3 application. It is based on Martin Bean's CakePHP 2 Geocoder Plugin, updated for compatibility with CakePHP 3. Thanks to Martin for making his code available under a MIT licence.

Installation

Install from packagist using composer. Add the following to your composer.json:

and run composer install or composer update, as applicable.

Loading the plugin

Add the code Plugin::load('Chris48s/Geocoder'); to your bootstrap.php.

Using the Component

You can use the component to geocode addresses within your controllers. A good example is if you need to take a user-submitted value and convert it to a latitude/longitude pair to pass to a model to search it.

To geocode an address in your controllers, do something similar to the following:

The component will return a response as a native PHP object from Google’s Geocoding API.

Using the Behavior

There is also a model behavior. This is useful if saving a record and you want to create a latitude/longitude pair from a field in your model’s data that represents the address, for example a store. Attach the behavior in your table class:

Configuration

By default, the behavior assumes you have two columns in your corresponding database table called latitude and longitude, and also a column called address. These can be changed though. Simply pass an array of options when attaching the behavior:

The addressColumn key also accepts an array. If you pass an array for the value, then the behavior will iterate over the fields and assemble the address that way. So if you store addresses as their separate components then you could do the following:

If addressColumn is not a string or an array, the Behavior will throw an exception of class GeocoderException.

By default, the behavior will not save the address if geocoding fails. This can also be configured using the requireSuccess key. Set this to false to save the address anyway even if geocoding fails:

If using this setting, your latitudeColumn and longitudeColumn should be set to allow NULL.

API Keys

To use the plugin with a Google API key, obtain a key and pass it in when calling the component

or when configuring the behaviour

Error Handling

If the Google Maps Geocoding API returns a status code other than 200 OK, the Component will throw an exception of class GeocoderException. The Behavior will add a validation error to the target entity object which can be accessed using $entity->errors().

Reporting Issues

If you have any issues with this plugin then please feel free to create a new Issue on the GitHub repository. This plugin is licensed under the MIT License.


All versions of cakephp-geocoder with dependencies

PHP Build Version
Package Version
Requires cakephp/cakephp Version ~3.0
php Version >=5.4
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 chris48s/cakephp-geocoder contains the following files

Loading the files please wait ....