bmartus / laravel-shippo
Shippo for Laravel 5
Installs: 12 656
Dependents: 0
Suggesters: 0
Security: 0
Stars: 13
Watchers: 1
Forks: 4
Open Issues: 2
Requires
- php: >=5.5.9
- illuminate/support: ~5.1
- shippo/shippo-php: ~1.1
This package is not auto-updated.
Last update: 2025-01-04 20:57:57 UTC
README
Integrates the Shippo PHP library with Laravel 5.2 via a ServiceProvider.
Installation
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,
]
Configuration
Add the following to your .env
file:
SHIPPO_API_KEY=key_from_shippo
Usage
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.
Example
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'
]);
});