Download the PHP package drawmyattention/phpaddressr without Composer

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

PHPAddressr

PHPAddressr is a framework agnostic set of methods that allows easy postcode / zipcode lookups, and conversion of addresses to longitude and latitude values via Google's mapping APIs.

Scrutinizer Code Quality Build Status License

Installation

Composer is the easiest way to install PHPAddressr.

composer require drawmyattention/phpaddressr

Api Key

Google's geocoding API requires an API key in order to function. A key can be generated via their official API website. Please keep your API key safe, and outside of source control.

Once you have an API key, edit the file to specify your key.

Alternatively, you can set the Api key using the method in the GoogleGeocode class.

Usage

Finding the longitude / latitude of an address

$geocode = new DrawMyAttention\PHPAddressr\GoogleGeocode();

// Optional, if a key hasn't been provided in the config file.
$geocode->setApiKey('123abc');

$latLng = $geocode->getLatLng([
    'building'  => 'Dock offices'
    'street'    => 'Surrey Quays Road',
    'city'      => 'London',
    'state'     => 'Greater London',
    'postcode'  => 'SE16 2XU',
    'country'   => 'United Kingdom'
]);

/* 
    array(2) {
      'longitude' =>
      double(-0.0507361)
      'latitude' =>
      double(51.4965262)
    }
*/

Note: Not all address values are required, however the higher number of accurate address parameters that are passed, the higher the accuracy of the longitude and latitude that is returned.

Finding an address by postcode

$geocode = new DrawMyAttention\PHPAddressr\GoogleGeocode();

$address = $geocode->getFullAddressByPostcode('SE16 2XU');

// An Address instance is returned.

/* 
    class DrawMyAttention\PHPAddressr\Address#4 (4) {
      private $address =>
      array(7) {
        'company' =>
        class DrawMyAttention\PHPAddressr\Data#9 (3) {
          public $required =>
          bool(false)
          public $value =>
          string(0) ""
          public $updated =>
          string(0) ""
        }
        'building' =>
        class DrawMyAttention\PHPAddressr\Data#10 (3) {
          public $required =>
          bool(false)
          public $value =>
          string(0) ""
          public $updated =>
          string(0) ""
        }
        'street' =>
        class DrawMyAttention\PHPAddressr\Data#5 (3) {
          public $required =>
          bool(true)
          public $value =>
          string(17) "Surrey Quays Road"
          public $updated =>
          string(0) ""
        }
        'city' =>
        class DrawMyAttention\PHPAddressr\Data#6 (3) {
          public $required =>
          bool(true)
          public $value =>
          string(6) "London"
          public $updated =>
          string(0) ""
        }
        'state' =>
        class DrawMyAttention\PHPAddressr\Data#7 (3) {
          public $required =>
          bool(false)
          public $value =>
          string(14) "Greater London"
          public $updated =>
          string(0) ""
        }
        'postcode' =>
        class DrawMyAttention\PHPAddressr\Data#11 (3) {
          public $required =>
          bool(true)
          public $value =>
          string(0) ""
          public $updated =>
          string(0) ""
        }
        'country' =>
        class DrawMyAttention\PHPAddressr\Data#8 (3) {
          public $required =>
          bool(true)
          public $value =>
          string(14) "United Kingdom"
          public $updated =>
          string(0) ""
        }
      }
      private $longitude =>
      double(-0.051054)
      private $latitude =>
      double(51.4967696)
*/

Contributing

Please submit any contributions via a pull request. Any submissions should be backed by tests in order to be merged.

Licence

This project is open-sourced software licenced under the MIT license.


All versions of phpaddressr with dependencies

PHP Build Version
Package Version
No informations.
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 drawmyattention/phpaddressr contains the following files

Loading the files please wait ....