PHPackages                             jeremy-dunn/php-fedex-api-wrapper - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. jeremy-dunn/php-fedex-api-wrapper

AbandonedArchivedLibrary[API Development](/categories/api)

jeremy-dunn/php-fedex-api-wrapper
=================================

API Wrapper for Fedex web services

6.0.3(4y ago)2701.2M—6.6%182[3 issues](https://github.com/JeremyDunn/php-fedex-api-wrapper/issues)[3 PRs](https://github.com/JeremyDunn/php-fedex-api-wrapper/pulls)2MITPHPPHP &gt;=7.3|&gt;=8.0|&gt;=8.1

Since Mar 28Pushed 3y ago22 watchersCompare

[ Source](https://github.com/JeremyDunn/php-fedex-api-wrapper)[ Packagist](https://packagist.org/packages/jeremy-dunn/php-fedex-api-wrapper)[ Docs](https://github.com/JeremyDunn/php-fedex-api-wrapper)[ RSS](/packages/jeremy-dunn-php-fedex-api-wrapper/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (4)Versions (22)Used By (2)

PHP FedEx API Wrapper
=====================

[](#php-fedex-api-wrapper)

[![Latest Stable Version](https://camo.githubusercontent.com/1794248e207cda548e865204a66b35e5fc48906d47f7f4f45bc3ea56d8b0d3d9/68747470733a2f2f706f7365722e707567782e6f72672f6a6572656d792d64756e6e2f7068702d66656465782d6170692d777261707065722f762f737461626c65)](https://packagist.org/packages/jeremy-dunn/php-fedex-api-wrapper)[![Total Downloads](https://camo.githubusercontent.com/f1d57b8c321b484aa999d2e09436704c5d755ade5bcfd9098b899bca922b1db9/68747470733a2f2f706f7365722e707567782e6f72672f6a6572656d792d64756e6e2f7068702d66656465782d6170692d777261707065722f646f776e6c6f616473)](https://packagist.org/packages/jeremy-dunn/php-fedex-api-wrapper)

This library provides a fluid interface for constructing requests to the FedEx web service API.

General Information
-------------------

[](#general-information)

All of the code under the `FedEx` namespace is generated using the [generate-classes-from-wsdls.php](util/generate-classes-from-wsdls.php) script. Each web service has it's own class namespace. See the official FedEx web service API documentation for a description of these services.

- [Address Validation Service](src/FedEx/AddressValidationService)
- [Close Service](src/FedEx/CloseService)
- [Courier Dispatch Service](src/FedEx/CourierDispatchService)
- [Locations Service](src/FedEx/LocationsService)
- [Package Movement Information Service](src/FedEx/PackageMovementInformationService)
- [Pickup Service](src/FedEx/PickupService)
- [Rate Service](src/FedEx/RateService)
- [Return Tag Service](src/FedEx/ReturnTagService)
- [Ship Service](src/FedEx/ShipService)
- [Track Service](src/FedEx/TrackService)
- [Upload Document Service](src/FedEx/UploadDocumentService)
- [Open Ship Service](src/FedEx/OpenShipService)
- [Validation Availability and Commitment Service](src/FedEx/ValidationAvailabilityAndCommitmentService)
- [ASYNC Transaction Service](src/FedEx/AsyncService)
- [In Flight Shipment Service](src/FedEx/InFlightShipmentService)
- [DGLD Service](src/FedEx/DGLDService)
- [DGDS Service](src/FedEx/DGDSService)

Installation
------------

[](#installation)

```
composer require jeremy-dunn/php-fedex-api-wrapper

```

Using the library
-----------------

[](#using-the-library)

The easiest way to get started constructing a web service request is to create an new `Request` object for the particular service you wish to use and then work backward by injecting the objects necessary to complete the request.

For example if we wish to get shipping rates, we'll create a new instance of [FedEx\\RateService\\Request](src/FedEx/RateService/Request.php) and call the [getGetRatesReply()](src/FedEx/RateService/Request.php#L61) method. This method requires an instance of [FedEx\\RateService\\ComplexType\\RateRequest](src/FedEx/RateService/ComplexType/RateRequest.php) which itself requires instances of [FedEx\\RateService\\ComplexType\\RequestedShipment](src/FedEx/RateService/ComplexType/RequestedShipment.php), [FedEx\\RateService\\ComplexType\\TransactionDetail](src/FedEx/RateService/ComplexType/TransactionDetail.php), [FedEx\\RateService\\ComplexType\\WebAuthenticationDetail](src/FedEx/RateService/ComplexType/WebAuthenticationDetail.php), [FedEx\\RateService\\ComplexType\\ClientDetail](src/FedEx/RateService/ComplexType/ClientDetail.php), and so on. See below for an example.

Rate Service request example
----------------------------

[](#rate-service-request-example)

This assumes the `FEDEX_KEY`, `FEDEX_PASSWORD`, `FEDEX_ACCOUNT_NUMBER`, and `FEDEX_METER_NUMBER` are previously defined in your application. Also note that by default, the library will use the beta/testing server (wsbeta.fedex.com). To use the production server (ws.fedex.com), set the location on the `\SoapClient` returned from the Request. See below for an example of how to do this.

```
use FedEx\RateService\Request;
use FedEx\RateService\ComplexType;
use FedEx\RateService\SimpleType;

$rateRequest = new ComplexType\RateRequest();

//authentication & client details
$rateRequest->WebAuthenticationDetail->UserCredential->Key = FEDEX_KEY;
$rateRequest->WebAuthenticationDetail->UserCredential->Password = FEDEX_PASSWORD;
$rateRequest->ClientDetail->AccountNumber = FEDEX_ACCOUNT_NUMBER;
$rateRequest->ClientDetail->MeterNumber = FEDEX_METER_NUMBER;

$rateRequest->TransactionDetail->CustomerTransactionId = 'testing rate service request';

//version
$rateRequest->Version->ServiceId = 'crs';
$rateRequest->Version->Major = 24;
$rateRequest->Version->Minor = 0;
$rateRequest->Version->Intermediate = 0;

$rateRequest->ReturnTransitAndCommit = true;

//shipper
$rateRequest->RequestedShipment->PreferredCurrency = 'USD';
$rateRequest->RequestedShipment->Shipper->Address->StreetLines = ['10 Fed Ex Pkwy'];
$rateRequest->RequestedShipment->Shipper->Address->City = 'Memphis';
$rateRequest->RequestedShipment->Shipper->Address->StateOrProvinceCode = 'TN';
$rateRequest->RequestedShipment->Shipper->Address->PostalCode = 38115;
$rateRequest->RequestedShipment->Shipper->Address->CountryCode = 'US';

//recipient
$rateRequest->RequestedShipment->Recipient->Address->StreetLines = ['13450 Farmcrest Ct'];
$rateRequest->RequestedShipment->Recipient->Address->City = 'Herndon';
$rateRequest->RequestedShipment->Recipient->Address->StateOrProvinceCode = 'VA';
$rateRequest->RequestedShipment->Recipient->Address->PostalCode = 20171;
$rateRequest->RequestedShipment->Recipient->Address->CountryCode = 'US';

//shipping charges payment
$rateRequest->RequestedShipment->ShippingChargesPayment->PaymentType = SimpleType\PaymentType::_SENDER;

//rate request types
$rateRequest->RequestedShipment->RateRequestTypes = [SimpleType\RateRequestType::_PREFERRED, SimpleType\RateRequestType::_LIST];

$rateRequest->RequestedShipment->PackageCount = 2;

//create package line items
$rateRequest->RequestedShipment->RequestedPackageLineItems = [new ComplexType\RequestedPackageLineItem(), new ComplexType\RequestedPackageLineItem()];

//package 1
$rateRequest->RequestedShipment->RequestedPackageLineItems[0]->Weight->Value = 2;
$rateRequest->RequestedShipment->RequestedPackageLineItems[0]->Weight->Units = SimpleType\WeightUnits::_LB;
$rateRequest->RequestedShipment->RequestedPackageLineItems[0]->Dimensions->Length = 10;
$rateRequest->RequestedShipment->RequestedPackageLineItems[0]->Dimensions->Width = 10;
$rateRequest->RequestedShipment->RequestedPackageLineItems[0]->Dimensions->Height = 3;
$rateRequest->RequestedShipment->RequestedPackageLineItems[0]->Dimensions->Units = SimpleType\LinearUnits::_IN;
$rateRequest->RequestedShipment->RequestedPackageLineItems[0]->GroupPackageCount = 1;

//package 2
$rateRequest->RequestedShipment->RequestedPackageLineItems[1]->Weight->Value = 5;
$rateRequest->RequestedShipment->RequestedPackageLineItems[1]->Weight->Units = SimpleType\WeightUnits::_LB;
$rateRequest->RequestedShipment->RequestedPackageLineItems[1]->Dimensions->Length = 20;
$rateRequest->RequestedShipment->RequestedPackageLineItems[1]->Dimensions->Width = 20;
$rateRequest->RequestedShipment->RequestedPackageLineItems[1]->Dimensions->Height = 10;
$rateRequest->RequestedShipment->RequestedPackageLineItems[1]->Dimensions->Units = SimpleType\LinearUnits::_IN;
$rateRequest->RequestedShipment->RequestedPackageLineItems[1]->GroupPackageCount = 1;

$rateServiceRequest = new Request();
//$rateServiceRequest->getSoapClient()->__setLocation(Request::PRODUCTION_URL); //use production URL

$rateReply = $rateServiceRequest->getGetRatesReply($rateRequest); // send true as the 2nd argument to return the SoapClient's stdClass response.

if (!empty($rateReply->RateReplyDetails)) {
    foreach ($rateReply->RateReplyDetails as $rateReplyDetail) {
        var_dump($rateReplyDetail->ServiceType);
        if (!empty($rateReplyDetail->RatedShipmentDetails)) {
            foreach ($rateReplyDetail->RatedShipmentDetails as $ratedShipmentDetail) {
                var_dump($ratedShipmentDetail->ShipmentRateDetail->RateType . ": " . $ratedShipmentDetail->ShipmentRateDetail->TotalNetCharge->Amount);
            }
        }
        echo "";
    }
}

var_dump($rateReply);
```

More examples can be found in the [examples](examples) folder.

[Change Log](CHANGELOG.md)
--------------------------

[](#change-log)

###  Health Score

52

—

FairBetter than 96% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity60

Solid adoption and visibility

Community34

Small or concentrated contributor base

Maturity81

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 88.4% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~90 days

Recently: every ~49 days

Total

21

Last Release

1537d ago

Major Versions

2.6.2 → 3.02018-12-27

3.0 → 4.02020-08-19

4.0 → 5.02020-11-28

2.6.3 → 5.0.12021-02-13

5.0.2 → 6.0.02021-11-16

PHP version history (3 changes)1.0PHP &gt;=5.4.0

6.0.0PHP ^7.3|^8.0

6.0.2PHP &gt;=7.3|&gt;=8.0|&gt;=8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/1ae5049a4f4e6c356c50c98e844fe35375718a2d7066629745a1da587f10d914?d=identicon)[JeremyDunn](/maintainers/JeremyDunn)

---

Top Contributors

[![JeremyDunn](https://avatars.githubusercontent.com/u/161614?v=4)](https://github.com/JeremyDunn "JeremyDunn (205 commits)")[![alexankit](https://avatars.githubusercontent.com/u/10940370?v=4)](https://github.com/alexankit "alexankit (4 commits)")[![sg4tech](https://avatars.githubusercontent.com/u/3677021?v=4)](https://github.com/sg4tech "sg4tech (3 commits)")[![mixisLv](https://avatars.githubusercontent.com/u/3735128?v=4)](https://github.com/mixisLv "mixisLv (3 commits)")[![colinodell](https://avatars.githubusercontent.com/u/202034?v=4)](https://github.com/colinodell "colinodell (2 commits)")[![bilalyilmax](https://avatars.githubusercontent.com/u/10108441?v=4)](https://github.com/bilalyilmax "bilalyilmax (2 commits)")[![umpirsky](https://avatars.githubusercontent.com/u/208957?v=4)](https://github.com/umpirsky "umpirsky (2 commits)")[![stef686](https://avatars.githubusercontent.com/u/917453?v=4)](https://github.com/stef686 "stef686 (1 commits)")[![TomAshe](https://avatars.githubusercontent.com/u/13180419?v=4)](https://github.com/TomAshe "TomAshe (1 commits)")[![vlad-reshetylo](https://avatars.githubusercontent.com/u/7568590?v=4)](https://github.com/vlad-reshetylo "vlad-reshetylo (1 commits)")[![AegirLeet](https://avatars.githubusercontent.com/u/33277331?v=4)](https://github.com/AegirLeet "AegirLeet (1 commits)")[![wow-apps](https://avatars.githubusercontent.com/u/2779949?v=4)](https://github.com/wow-apps "wow-apps (1 commits)")[![ajohnson6494](https://avatars.githubusercontent.com/u/5192820?v=4)](https://github.com/ajohnson6494 "ajohnson6494 (1 commits)")[![ArseniyShestakov](https://avatars.githubusercontent.com/u/9513350?v=4)](https://github.com/ArseniyShestakov "ArseniyShestakov (1 commits)")[![codacy-badger](https://avatars.githubusercontent.com/u/23704769?v=4)](https://github.com/codacy-badger "codacy-badger (1 commits)")[![Destronom](https://avatars.githubusercontent.com/u/19309129?v=4)](https://github.com/Destronom "Destronom (1 commits)")[![runningrandall](https://avatars.githubusercontent.com/u/3854649?v=4)](https://github.com/runningrandall "runningrandall (1 commits)")[![shrimpwagon](https://avatars.githubusercontent.com/u/101164?v=4)](https://github.com/shrimpwagon "shrimpwagon (1 commits)")

---

Tags

apifedexphpshippingsoapshippingFedEx

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/jeremy-dunn-php-fedex-api-wrapper/health.svg)

```
[![Health](https://phpackages.com/badges/jeremy-dunn-php-fedex-api-wrapper/health.svg)](https://phpackages.com/packages/jeremy-dunn-php-fedex-api-wrapper)
```

###  Alternatives

[shippo/shippo-php

A PHP library for connecting with multiple carriers (FedEx, UPS, USPS) using Shippo.

1711.8M2](/packages/shippo-shippo-php)[gabrielbull/ups-api

PHP UPS API

4642.4M10](/packages/gabrielbull-ups-api)[easypost/easypost-php

EasyPost Shipping API Client Library for PHP

1753.1M5](/packages/easypost-easypost-php)[laminas/laminas-soap

6221.8M37](/packages/laminas-laminas-soap)[gusapi/gusapi

Gus Api Library for PHP

1351.5M8](/packages/gusapi-gusapi)[firstred/postnl-api-php

PostNL REST API PHP Bindings

27610.2k1](/packages/firstred-postnl-api-php)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
