Download the PHP package elastly/elastly-php without Composer

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

Elastly PHP SDK

The official PHP client for the Elastly REST API.

Elastly prices quote and order lines for B2B sellers. Send a line (product, customer, quantity) and get back a price with the reasoning behind it: which pricing rules fired, what each one added, and how confident the engine is. The engine learns from the outcomes you feed back, so prices improve over time.

This client covers the full v1 API:

Install

Requires PHP 8.1 or newer.

Authenticate

Create an API key in the dashboard (Settings, then API keys). Keys are scoped: an erp key prices lines, a connector key ingests data and claims write-backs. Send the key as a bearer token.

Price a line

Every response line is either a priced result (getOk() returns true) or a per-line error. One bad line never fails the batch.

Laravel

This package is framework-agnostic, so composer require is all Laravel needs. There is no service provider to register and nothing to publish.

To resolve a configured client from the container, bind it once in AppServiceProvider::register():

Add the key to config/services.php as 'elastly' => ['key' => env('ELASTLY_API_KEY')], then type-hint PricesApi anywhere Laravel resolves dependencies.

Retries and idempotency

POST /v1/prices requires an Idempotency-Key header. Use a fresh key for each logical request and reuse the same key on retries. A replay returns the stored response, so a retried call never prices twice.

Price with a deadline and a fallback

If you price inside a checkout or quote flow, use the serving layer instead of calling the API directly. It puts a hard deadline on the call (800ms by default), retries transient failures with backoff, trips a circuit breaker when Elastly is down (5 failures, 30 second cooldown), and falls back to a price you supply instead of blocking your flow.

Every result carries a source: elastly (a real price), fallback (your resolver's price), or unavailable (your resolver returned null). Mistakes on your side, like an invalid request or a bad key, always throw a typed error from Elastly\Errors instead of falling back. Prefer an exception over a fallback price? Pass FailOpenPolicy::throwOnFailure().

The transport handles retries and idempotency keys for you, so you do not need to manage the Idempotency-Key header yourself on this path.

Verify webhooks

Verify the elastly-signature header on every webhook before trusting the payload:

verify checks the HMAC signature in constant time, rejects replays older than 5 minutes, and returns a typed event.

Close the loop

Elastly learns from the difference between the price it recommended and the price your team actually charged. When you ingest quotes, echo the pricingDecisionId you received from the prices call on the matching quote line. Skip that and the engine has nothing to learn from.

Documentation

About this repository

This code is generated from the Elastly OpenAPI contract, so pull requests against generated files get overwritten by the next release. If something is broken or missing, open an issue or email [email protected].

License

MIT


All versions of elastly-php with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
ext-curl Version *
ext-json Version *
ext-mbstring Version *
guzzlehttp/guzzle Version ^7.3
guzzlehttp/psr7 Version ^1.7 || ^2.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 elastly/elastly-php contains the following files

Loading the files please wait ...