Download the PHP package rerout/sdk without Composer

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

rerout/sdk

Official PHP SDK for the Rerout API.

Branded link infrastructure on Cloudflare — create short links, render QR codes, read analytics, and verify webhook signatures.

Install

Requires PHP 8.2+ and the json and hash extensions. HTTP transport is Guzzle 7.

Usage

API

Construction

A blank or missing API key throws a ReroutException with code missing_api_key. The base_url has trailing slashes trimmed.

Links

UpdateLinkInput distinguishes three states per field:

Constructing an empty UpdateLinkInput and calling update() throws a ReroutException (code bad_request) client-side — the request never leaves your process.

Project

QR codes

Webhook endpoint management

Manage the project's webhook endpoints with an API key. The project is resolved from the key — there is no project id in the path. The signingSecret is returned once on create; store it to verify deliveries.

Webhook signature verification

Rerout signs every webhook delivery with an X-Rerout-Signature header in the form t=<unix>,v1=<hex_hmac_sha256>. Verify it before trusting the payload:

The HMAC is SHA-256 over "<timestamp>.<raw_body>" and is compared in constant time. The default timestamp tolerance is 300 seconds — pass toleranceSeconds: 0 to disable the staleness check, or a custom value to widen it. A $clock callable can be injected for testing.

Tags

Manage the project's tags with an API key. The project is resolved from the key — there is no project id in the path. list() is the only call that returns each tag's linkCount (live, non-deleted links the tag is attached to); create/update return a plain Tag without it.

Error handling

Every API call throws Rerout\Exceptions\ReroutException on failure:

When the server returns a JSON error body, code and message are taken verbatim. When it does not, a synthetic code is used:

Condition Code
HTTP 401 unauthorized
HTTP 403 forbidden
HTTP 404 not_found
HTTP 429 rate_limited
HTTP 5xx server_error
other 4xx client_error
connection failure network_error
timeout timeout
2xx non-JSON body unexpected_response

Local development

License

MIT — see LICENSE.

Links


All versions of sdk with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
ext-json Version *
ext-hash Version *
guzzlehttp/guzzle Version ^7.12.1
psr/http-message Version ^1.0 || ^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 rerout/sdk contains the following files

Loading the files please wait ...