fireenginered / smartystreets-laravel
Laravel (PHP) SDK for using SmartyStreets geocoding.
Installs: 42 120
Dependents: 0
Suggesters: 0
Security: 0
Stars: 6
Watchers: 17
Forks: 9
Open Issues: 2
Requires
- php: >=5.5.0
- illuminate/support: 5.*
README
Laravel (PHP) SDK for using SmartyStreets geocoding.
Only attempting Address Verify at this time; willing to accept pull requests that fill in the other functionalities too (Zipcode Verify, Autocomplete, and Address Extraction).
Example Usage
$response = SmartyStreets::addressQuickVerify(array( 'street'=>'P.O. Box 1017', 'city'=>'Havertown', 'state'=>'PA', ));
Methods are available (addressAddToRequest && addressGetCandidates) to check multiple addresses with one POST, but addressQuickVerify only handles one address at a time.
Further API details, including request and response fields, available at SmartyStreets: https://smartystreets.com/docs/address
How to Install
Laravel 5.0 +
-
Install the
fireenginered/smartystreets-laravel
package$ composer require fireenginered/smartystreets-laravel:dev-master
-
Update
config/app.php
to activate SmartyStreets# Add `SmartyStreetsLaravelServiceProvider` to the `providers` array 'providers' => array( ... 'FireEngineRed\SmartyStreetsLaravel\SmartyStreetsServiceProvider', ) # Add the `SmartyStreetsFacade` to the `aliases` array 'aliases' => array( ... 'SmartyStreets' => 'FireEngineRed\SmartyStreetsLaravel\SmartyStreetsFacade', )
-
Create the configuration file
config/smartystreets.php
:$ php artisan vendor:publish
-
Configure your API credentials in the config file.
'authId' => 'raw ID here', 'authToken' => 'raw token here',
Alternately, replace the values there with env() calls, and put the credentials in your .env file