2017 © Pedro Peláez
 

library fedex-laravel

A service provider to integrate FedEx servces into your Laravel Project

image

arkitecht/fedex-laravel

A service provider to integrate FedEx servces into your Laravel Project

  • Sunday, October 23, 2016
  • by Arkitecht
  • Repository
  • 1 Watchers
  • 3 Stars
  • 602 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 12 Forks
  • 0 Open issues
  • 3 Versions
  • 6 % Grown

The README.md

FedEx Laravel

A service provider to integrate FedEx services into your Laravel Project, (*1)

Quick Installation

You can install the package most easily through composer, (*2)

Laravel 5.x

composer require arkitecht/fedex-laravel

Using it in your project

Add the service provider to your config/app.php, (*3)

 [

        /*
         * Laravel Framework Service Providers...
         */
        //Illuminate\Foundation\Providers\ArtisanServiceProvider::class,
        Illuminate\Auth\AuthServiceProvider::class,
        Illuminate\Broadcasting\BroadcastServiceProvider::class,
        Illuminate\Bus\BusServiceProvider::class,

...
       Arkitecht\FedEx\Laravel\Providers\FedExServiceProvider::class,
    ],
?>

Add the Facade to your config/app.php, (*4)

 [

        'FedEx'     => Arkitecht\FedEx\Laravel\Facades\FedEx::class

    ],
?>

Publish the config file, (*5)

artisan vendor:publish, (*6)

Set up your environment, (*7)

Add values for the following setting keys in your .env or in config/fedex.php, (*8)

  • FEDEX_API_KEY - Your FedEx API Key
  • FEDEX_API_PASSWORD - Your FedEx API Password
  • FEDEX_ACCOUNT_NO - Your FedEx Account Number
  • FEDEX_METER_NO - Your FedEx Meter Number
  • FEDEX_USE_BETA - (Bool) Use the FedEx beta/test system instead of production

Example of Usage

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)

The Versions

23/10 2016

dev-master

9999999-dev

A service provider to integrate FedEx servces into your Laravel Project

  Sources   Download

MIT

The Requires

 

23/10 2016

1.0.1

1.0.1.0

A service provider to integrate FedEx servces into your Laravel Project

  Sources   Download

MIT

The Requires

 

26/04 2016

1.0

1.0.0.0

A service provider to integrate FedEx servces into your Laravel Project

  Sources   Download

MIT

The Requires