farmto / shippo-laravel
Laravel integration for Shippo Api
v1.13.10
2025-06-12 18:19 UTC
Requires
- php: ^8.0
- illuminate/support: ^8.0|^9.0|^10.0
- shippo/shippo-php: ^2.0
Requires (Dev)
- orchestra/testbench: ^6.0 || ^7.0 || ^8.0
- phpunit/phpunit: ^9.0
README
A Laravel package that integrates the Shippo API into your Laravel application for easy shipping label generation, tracking, and carrier management.
Installation
You can install the package via composer:
composer require FarmToYou/shippo-laravel
Configuration
Publish the configuration file:
php artisan vendor:publish --provider="FarmToYou\ShippoLaravel\ShippoCarrierServiceProvider"
Then update your .env
file with your Shippo API credentials:
SHIPPO_API_KEY=your_api_key_here
SHIPPO_API_VERSION=2018-02-08
Usage
use FarmToYou\ShippoLaravel\Facades\ShippoCarrier; // Create a shipping label $shipment = ShippoCarrier::createShipment([ 'address_from' => [ 'name' => 'John Doe', 'street1' => '123 Main St', 'city' => 'San Francisco', 'state' => 'CA', 'zip' => '94105', 'country' => 'US', ], 'address_to' => [ 'name' => 'Jane Doe', 'street1' => '456 Oak St', 'city' => 'New York', 'state' => 'NY', 'zip' => '10001', 'country' => 'US', ], 'parcels' => [ [ 'length' => 10, 'width' => 8, 'height' => 4, 'distance_unit' => 'in', 'weight' => 2, 'mass_unit' => 'lb', ], ], ]); // Get available shipping rates $rates = ShippoCarrier::getShipmentRates($shipment['object_id']); // Purchase a label $transaction = ShippoCarrier::purchaseShippingLabel($rates[0]['object_id']);
Troubleshooting
If you encounter the error "Class 'FarmToYou\ShippoLaravels\ShippoCarriersServiceProvider' not found", there might be a namespace discrepancy. Make sure your service provider uses the correct namespace as defined in your composer.json file.
For service provider issues:
Check that your composer.json has the correct PSR-4 autoloading configuration:
"autoload": { "psr-4": { "FarmToYou\\ShippoLaravel\\": "src/" } }
Then run:
composer dump-autoload
License
The MIT License (MIT). Please see License File for more information.