Download the PHP package stuartapp/stuart-client-php without Composer

On this page you can find all versions of the php package stuartapp/stuart-client-php. 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 stuart-client-php

Codeship Status for StuartApp/stuart-client-php

Stuart PHP Client

For a complete documentation of all endpoints offered by the Stuart API, you can visit Stuart API documentation.

Changelog

Visit Changelog

Running the demo

Install

Via Composer:

Usage

  1. Initialize Client
  2. Create a Job
    1. Minimalist
    2. Complete
      1. With scheduling at pickup
      2. With scheduling at drop off
      3. With stacking (multi-drop)
  3. Get a Job
  4. Cancel a Job
  5. Validate a Job
  6. Cancel a delivery
  7. Get a pricing
  8. Get a job eta to pickup
  9. Custom requests

Import the library

If composer is not installed, install it:

Add the library to your project:

Autoloading

In order to load all the classes from this library, just execute the autoload at the beginning of the Stuart code

Get credentials

For Sandbox (testing environment, couriers are bots) https://dashboard.sandbox.stuart.com/settings/api

For Production (real world, real couriers) https://dashboard.stuart.com/settings/api

Initialize client

You can also pass your own Guzzle client instance to the \Stuart\HttpClient constructor:

This can be useful if you need to attach middlewares to the Guzzle client.

Caching

It's highly recommended adding a caching mechanism for the authentication process. To do so, simply extend the Psr\SimpleCache\CacheInterface class and implement your own version.

There's a cache based on disk available out of the box for you to use. To use it, simply modify the Authentication class initialization and pass the cache implementation in the constructor:

Debugging token cache issues

You can initialize the DiskCache, Authenticator and HttpClient classes by passing a true value to the last constructor parameter of these classes.

Create a Job

Important: Even if you can create a Job with a minimal set of parameters, we highly recommend that you fill as many information as you can in order to ensure the delivery process goes well.

Minimalist

Package size based

Complete

Package size based

With scheduling at pickup

For more information about job scheduling you should check our API documentation.

With scheduling at dropoff

For more information about job scheduling you should check our API documentation.

Please note that this feature can only be used with only one dropoff.

With fleet targeting

With end customer time window information (used for metrics purposes only)

With stacking (multi-drop)

Package size based

Get a Job

Once you successfully created a Job you can retrieve it this way:

Or when you create a new Job:

The Stuart API determine the optimal route on your behalf, that's why the getDeliveries() method will return an empty array when the Job has not been created yet. The getDeliveries() method will return an array of Delivery as soon as the Job is created.

Cancel a job

Once you successfully created a Job you can cancel it in this way:

The result will hold the boolean value true if the job was cancelled. If there was an error, it will contain an error object.

For more details about how cancellation works, please refer to our dedicated documentation section.

Validate a Job

Before creating a Job you can validate it (control delivery area & address format). Validating a Job is optional and does not prevent you from creating a Job.

The result will hold the boolean value true if the job is valid. If there was an error, it will contain an error object.

Validate an address

We encourage to validate an address to find out if we can pickup / deliver there. Phone number is optional only for those places that the address is specific enough.

Cancel a delivery

Once you successfully created a Delivery you can cancel it in this way:

Get a pricing

Before creating a Job you can ask for a pricing. Asking for a pricing is optional and does not prevent you from creating a Job.

Get a job ETA to pickup

Before creating a Job you can ask for an estimated time of arrival at the pickup location (expressed in seconds). Asking for ETA is optional and does not prevent you from creating a job.

Custom requests

You can also send requests on your own without relying on the \Stuart\Client. It allows you to use endpoints that are not yet available on the \Stuart\Client and enjoy the \Stuart\Authenticator.


All versions of stuart-client-php with dependencies

PHP Build Version
Package Version
Requires php Version >=7.1
guzzlehttp/guzzle Version ^6.2|^7.0
league/oauth2-client Version ^2.1
psr/simple-cache Version ^1.0
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 stuartapp/stuart-client-php contains the following files

Loading the files please wait ....