Download the PHP package shipstream/fedex-rest-sdk without Composer

On this page you can find all versions of the php package shipstream/fedex-rest-sdk. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package fedex-rest-sdk

FedEx SDK for PHP

This is a PHP SDK for working with FedEx's REST APIs. The SDK is autogenerated from FedEx's OpenAPI models (with substantial model refactoring) and built on top of Saloon.

[!WARNING] This SDK has not yet been used in production, and is still very much in beta. There may very well be bugs that we haven't found yet. If you find any problems, we'd really appreciate it if you submitted an issue.

Installation

composer require shipstream/fedex-rest-sdk

Quickstart

The FedEx class is the jumping-off point for accessing all segments of the FedEx API. To get started, instantiate an instance of the FedEx class with your client ID and secret key:

To access a particular set of endpoints, get an instance of the relevant resource collection class from the connector:

To figure out which DTO(s) need(s) to be passed to a particular endpoint method, use your editor to inspect the method's arguments:

Configuration options

The FedEx class constructor accepts the following arguments:

Saloon features

Since this SDK is built on top of Saloon, it inherits Saloon's many useful built-in features, such as automatic request retries, easy request debugging, middleware, request pools, and more.

Contributing

We welcome any and all contributions! There are a few ways you can contribute to this project:

Issues

Before submitting an issue, please make sure you search the existing issues to see if anyone else has already reported and/or solved the same problem you're reporting. If you don't find anything that matches your problem, submit a new issue. Please make sure to include:

Pull Requests

We welcome PRs! If you want to submit a PR, we encourage you to first submit an issue describing the change you want to make. That way, you don't end up in the frustrating situation of putting a lot of work into a PR only to have us reject it because it's not a change/feature we want to support.

Once you're ready to start work on your PR, please check out the SDK Design section below to make sure your changes conform to the overall design of this library.

Before submitting a PR for review, please ensure the test suite is working with composer test and that the code is linted using composer lint.

Testing

To get the tests up and running, you'll need a set of FedEx REST API sandbox credentials. Since FedEx has a fairly complete sandbox environment, we use their actual sandbox instead of mocking responses.

Once you have credentials, copy phpunit.dist.xml to phpunit.xml and fill in the CLIENT_ID and CLIENT_SECRET environment variables with your test credentials. Now you should be able to run the test suite!

Since we are using the actual sandbox API instead of mocking, make sure you use the Endpoint::SANDBOX endpoint in all tests! FedEx has separate production and sandbox credentials, so you will likely just get an error if you specify the production endpoint, but if you accidentally put production creds in phpunit.xml (see below) you will be making real API requests during testing.

SDK Design

This SDK is (almost) entirely autogenerated from FedEx's OpenAPI model files, using highsidelabs/saloon-sdk-autogenerator. As with most big multi-file OpenAPI specifications, the FedEx spec took quite a bit of massaging to get into a format that worked well with an autogenerator. We put a lot of work into making sure that the generation process, from downloading the model files to the generated code, is idempotent and reliable.

There are three major steps to building this library:

  1. Downloading the raw OpenAPI schema files from FedEx
  2. Combining and editing those files to make their formatting more consistent and usable
  3. Generating the final code from the modified OpenAPI schema files

The details of each step are described below. Each of these steps is run via its own CLI command, defined in bin/console. The CLI commands accept the following options, both of which can accept multiple values:

So, to download v1 of the authorization and pickup-request APIs, you can run:

Downloading schemas: php bin/console schema:download

This step is the simplest of the three. The resources/apis.json is the primary source of truth for what all the different segments of FedEx's REST API are, what their names are, and the URLs of their OpenAPI schema files. Some API segments (for instance, the Service Availability API) are composed of multiple OpenAPI model files. The apis.json file is also built to support multiple versions of the same API segment, in case FedEx later releases new versions of these APIs. There is a more complete description of the apis.json file below.

Downloaded OpenAPI models are placed in resources/models/.raw/<api-name>. Once the models for a particular API segment have been downloaded, they can then be refactored.

Refactoring schemas: php bin/console schema:refactor

A wide variety of refactoring processes are run on the raw schemas to get them ready to be used in the following step: code generation. A broad overview of the refactoring steps:

Once refactoring is complete, the finalized OpenAPI model file is saved to resources/models/<api-name>/<version>.json. These files are version-controlled, unlike the raw models, because having them available to everyone makes it easier to reason about the autogeneration process.

Generating code: php bin/console schema:generate

Finally, the code is generated from the finalized OpenAPI models. We use highsidelabs/saloon-sdk-generator for this, which handles most of the heavy lifting. All the code in the ShipStream\FedEx\Api namespace is autogenerate, so do not edit any of that code directly! Any changes in that namespace will be overridden the next time the library is generated, so if you want to make a change to any of that code, that change will have to be made by either a) modifying/extending the generator code, or b) via the modifications.json file.

The config.json file provides some basic configuration parameters to the autogenerator, and the files in src/Generator/Generators override highsidelabs/saloon-sdk-generator's default file generators to make minor modifications. There are several different generator files that can be overridden – you can see all of them here. If you have questions about how to go about extending or modifying the generator files, please open an issue in the highsidelabs/saloon-sdk-generator repository.

Generator control files

apis.json

This file is the source of truth for all API segments, names, versions, and upstream OpenAPI model URLs. The top-level object keys (e.g., authorization, address-validation, etc) are the names that are used to reference and retrieve a particular API segment throughout the codebase.

Each top-level sub-object is the definition for an API segment. It contains a human-readable name, and an array of version definitions. Each version consists of a version code (e.g., 1), and a url key which is either a string or an array of strings, depending on whether or not FedEx defines the API segment via a single OpenAPI model file or multiple model files.

modifications.json

This file contains manually-defined OpenAPI model modifications. These modifications are applied after all other model refactoring steps. Each modification definition has two or three elements:

Authors

This SDK was built in collaboration with Jesse Evers of Highside Labs.


All versions of fedex-rest-sdk with dependencies

PHP Build Version
Package Version
Requires saloonphp/saloon Version ^3.8
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package shipstream/fedex-rest-sdk contains the following files

Loading the files please wait ....