dev-master
9999999-devA service provider to integrate FedEx services into your Laravel Project
MIT
The Requires
1.0
1.0.0.0A service provider to integrate FedEx services into your Laravel Project
MIT
The Requires
Wallogit.com
2017 © Pedro Peláez
A service provider to integrate FedEx services into your Laravel Project
This is a fork of Arkitecht/fedex-laravel, package modified for backward compability to support Laravel 4.*., (*1)
You can install the package most easily through composer, (*2)
composer require krsman/fedex-laravel4
Add the service provider to your config/app.php, (*3)
array(
'Illuminate\Foundation\Providers\ArtisanServiceProvider',
'Illuminate\Auth\AuthServiceProvider',
'Illuminate\Cache\CacheServiceProvider',
'Illuminate\Session\CommandsServiceProvider',
...
'Krsman\FedEx\Laravel\Providers\FedExServiceProvider',
),
?>
Add the Facade to your config/app.php, (*4)
array(
'FedEx' => 'Krsman\FedEx\Laravel\Facades\FedEx'
),
?>
Publish the config file, (*5)
php artisan config:publish krsman/fedex-laravel4, (*6)
Set up your environment, (*7)
Add values for the following setting keys in your /app/config/packages/krsman/fedex-laravel4/config.php, (*8)
'key' => '', 'password' => '', 'account' => '', 'meter' => '', 'beta' => false,
Get FedEx Rates, (*9)
```php <?php, (*10)
$rateRequest = FedEx::rateRequest();, (*11)
$shipment = new \Arkitecht\FedEx\Structs\RequestedShipment(); $shipment->TotalWeight = new \Arkitecht\FedEx\Structs\Weight(\Arkitecht\FedEx\Enums\WeightUnits::VALUE_LB, $weight);, (*12)
$shipment->Shipper = new \Arkitecht\FedEx\Structs\Party(); $shipment->Shipper->Address = new \Arkitecht\FedEx\Structs\Address( $shipper->address, $shipper->city, $shipper->state, $shipper->zip, null, 'US');, (*13)
$shipment->Recipient = new \Arkitecht\FedEx\Structs\Party(); $shipment->Recipient->Address = new \Arkitecht\FedEx\Structs\Address( $recipient->address, $recipient->city, $recipient->state, $recipient->zip, null, 'US');, (*14)
$lineItem = new \Arkitecht\FedEx\Structs\RequestedPackageLineItem(); $lineItem->Weight = new \Arkitecht\FedEx\Structs\Weight(\Arkitecht\FedEx\Enums\WeightUnits::VALUE_LB, $weight); $lineItem->GroupPackageCount = 1; $shipment->PackageCount = 1;, (*15)
$shipment->RequestedPackageLineItems = [ $lineItem ];, (*16)
$rateRequest->Version = FedEx::rateService()->version;, (*17)
$rateRequest->setRequestedShipment($shipment);, (*18)
$rate = FedEx::rateService();, (*19)
$response = $rate->getRates($rateRequest);, (*20)
$rates = [];, (*21)
if ($response->HighestSeverity == 'SUCCESS') { foreach ($response->RateReplyDetails as $rate) { $rates[$rate->ServiceType] = $rate->RatedShipmentDetails[0]->ShipmentRateDetail->TotalNetCharge->Amount; } }, (*22)
A service provider to integrate FedEx services into your Laravel Project
MIT
A service provider to integrate FedEx services into your Laravel Project
MIT