Package Data | |
---|---|
Maintainer Username: | bmartus |
Maintainer Contact: | bmartus@gmail.com (Brandon Martus) |
Package Create Date: | 2016-02-02 |
Package Last Update: | 2016-05-25 |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2025-01-14 15:17:37 |
Package Statistics | |
---|---|
Total Downloads: | 12,656 |
Monthly Downloads: | 0 |
Daily Downloads: | 0 |
Total Stars: | 13 |
Total Watchers: | 1 |
Total Forks: | 4 |
Total Open Issues: | 2 |
Integrates the Shippo PHP library with Laravel 5.2 via a ServiceProvider.
Include laravel-shippo as a dependency in composer.json:
"bmartus/laravel-shippo": "dev-master"
Run composer install
to download the dependency.
Add the ServiceProvider to your provider array within app/config/app.php
:
'providers' => [
...
Bmartus\LaravelShippo\LaravelShippoServiceProvider::class,
]
Add the following to your .env
file:
SHIPPO_API_KEY=key_from_shippo
You may use the Shippo PHP Library as normal within your application. The Shippo API will automatically be configured with your API Key, so you do not need to set it yourself.
A quick example in routes.php
:
<?php
Route::get('/address', function() {
return \Shippo_Address::create([
'object_purpose' => 'QUOTE',
'name' => 'John Smith',
'company' => 'Initech',
'street1' => 'Greene Rd.',
'street_no' => '6512',
'street2' => '',
'city' => 'Woodridge',
'state' => 'IL',
'zip' => '60517',
'country' => 'US',
'phone' => '123 353 2345',
'email' => 'jmercouris@iit.com',
'metadata' => 'Customer ID 234;234'
]);
});