2017 © Pedro Peláez
 

library places-validation

validate users addresses through services like google place

image

gocanto/places-validation

validate users addresses through services like google place

  • Sunday, February 25, 2018
  • by gocanto
  • Repository
  • 3 Watchers
  • 40 Stars
  • 132 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 5 Forks
  • 0 Open issues
  • 10 Versions
  • 8 % Grown

The README.md

Places Validation

Total Downloads Build Status Latest Stable Version, (*1)

Places validation is a laravel library that will help you out to handle your user addresses. Its aim is making sure the addresses submitted by users are valid through 3rd party services, as google., (*2)

Installation

Begin by installing the package through Composer. Run the following command in your terminal:, (*3)

composer require gocanto/places-validation

Once composer is done, add the package service provider in the providers array in config/app.php:, (*4)

Gocanto\AddressValidation\ValidatorServiceProvider::class

Client Side

Vuejs component which implements the google autocomplete library:, (*5)

Settings

You will be able to set the validator driver into config/addressval.php file. At the moment, the package just has the ability to work with google, but others services are planned ahead., (*6)

The array driver looks like this:, (*7)

'driver' => [

  //api key if required
  'key' => '',

  //driver object
  'name' => 'GeoogleGeocode',

  //api url
  'api' => 'http://maps.google.com/maps/api/geocode/json'
],

if you do not set the driver within this file, the default one will be used., (*8)

Validate user address using the Laravel validator object

Now you will be able to use this package to validate the user address information within your validations rules. This is how it would look like:, (*9)

$rules = [
  'address' => 'valid_place'
];

$data = [
  'address' => 'Guacara, Carabobo, Venezuela'
];

$v = \Validator::make($data, $rules);

You will be able to see the implementation on ManagerTest, (*10)

Use out of the Laravel object

To implement the validation within your project, you have to include the Checker object as so:, (*11)

use Gocanto\AddressValidation\Lib\Checker;

then, you can let laravel to handle the dependency injection for you, as so:, (*12)

public function index(Checker $places)
{

  if ( ! $v = $places->validate('Guacara, Carabobo, Venezuela')) {
    //the place is not valid.
  }

  //retrieve the place information.
  dd($v->retrieve(), $v->location());
}

Output Illustration, (*13)

example, (*14)

Inspiration

The inspiration came from a needed of using the validation within a form request object. I used Prosper Otemuyiwa package to have a scope of what I had to do., (*15)

Contributing

Please feel free to fork this package and contribute by submitting a pull request to enhance the functionalities., (*16)

License

The MIT License (MIT). Please see License File for more information., (*17)

How can I thank you?

Why not star the github repo? Why not share the link for this repository on Twitter? Spread the word!, (*18)

Don't forget to follow me on twitter!, (*19)

Thanks!, (*20)

Gustavo Ocanto. gustavoocanto@gmail.com, (*21)

The Versions

25/02 2018

dev-master

9999999-dev https://github.com/gocanto/places-validation

validate users addresses through services like google place

  Sources   Download

MIT

The Requires

 

The Development Requires

validation places validate addresses users

25/02 2018

0.8

0.8.0.0 https://github.com/gocanto/places-validation

validate users addresses through services like google place

  Sources   Download

MIT

The Requires

 

The Development Requires

validation places validate addresses users

01/09 2017

0.7

0.7.0.0 https://github.com/gocanto/places-validation

validate users addresses through services like google place

  Sources   Download

MIT

The Requires

 

The Development Requires

validation places validate addresses users

01/03 2017

v0.6

0.6.0.0 https://github.com/gocanto/places-validation

validate users addresses through services like google place

  Sources   Download

MIT

The Requires

 

The Development Requires

validation places validate addresses users

01/03 2017

dev-dev

dev-dev https://github.com/gocanto/places-validation

validate users addresses through services like google place

  Sources   Download

MIT

The Requires

 

The Development Requires

validation places validate addresses users

06/09 2016

v0.5

0.5.0.0 https://github.com/gocanto/places-validation

validate users addresses through services like google place

  Sources   Download

MIT

The Requires

 

The Development Requires

validation places validate addresses users

17/07 2016

v0.4

0.4.0.0 https://github.com/gocanto/address-validation

validate users addresses through services like google place

  Sources   Download

MIT

The Requires

 

The Development Requires

validate addresses users

10/07 2016

v0.3

0.3.0.0 https://github.com/gocanto/address-validation

validate users addresses through services like google place

  Sources   Download

MIT

The Requires

 

The Development Requires

validate addresses users

09/07 2016

v0.2

0.2.0.0 https://github.com/gocanto/address-validation

validate users addresses through services like google place

  Sources   Download

MIT

The Requires

 

The Development Requires

validate addresses users

09/07 2016

v0.1

0.1.0.0 https://github.com/gocanto/address-validation

validate users addresses through services like google place

  Sources   Download

MIT

The Requires

 

The Development Requires

validate addresses users