Download the PHP package traffical/sdk without Composer

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

Traffical PHP SDK

Traffical is one control plane for experimentation, feature flags, and adaptive optimization. Instead of hard-coding decisions, you expose typed parameters — numbers, strings, booleans, and JSON, not just on/off toggles — and control behavior across web, mobile, push, and backend from a single place. Parameters are resolved locally in the SDK (sub-millisecond, no network round trips at runtime), and metrics are computed warehouse-native, against data you own. Start with a feature flag, graduate it to an A/B test, and let adaptive optimization shift traffic to the winning allocation — all on the same parameter, without a deploy.

This package is the official PHP SDK (PHP ^8.1) that brings the Traffical parameter control plane to your PHP services.

Features

Modes

Further reading

Installation

You also need a PSR-18 HTTP client and PSR-17 factories. Any compliant implementation works; the SDK auto-discovers them via php-http/discovery:

Quickstart (bundle mode)

Decide + track exposure

decide() returns a DecisionResult (assignments + metadata). Call trackExposure() when the user actually sees the treatment so exposures are attributed correctly.

Server mode

Delegate resolution to the edge worker instead of evaluating a local bundle. Each getParams()/decide() performs (and caches per request) a POST /v1/resolve.

See docs/conformance.md for the bundle-vs-server tradeoffs.

BYO warehouse-native assignment logging

Pass an assignmentLogger to route structured rows through your own pipeline. The WarehouseNativeLogger helper maps each entry to a snake_case row (including the stable policy_key/allocation_key used for warehouse joins):

Full guide: docs/warehouse-native.md.

Plugins

Hook into the SDK lifecycle (onBeforeDecision, onDecision, onExposure, onTrack, …). Built-ins: DebugPlugin, DecisionTrackingPlugin, WarehouseNativeLoggerPlugin.

Full guide: docs/plugins.md.

Framework integrations

PHP lifecycle

The client registers a shutdown handler that calls fastcgi_finish_request() (when available) so the HTTP response is returned to the user before events are flushed. See docs/php-lifecycle.md.

Configuration reference

ClientOptions is an immutable value object. Construct it with named arguments, or refine an existing instance with the fluent with*() methods (each returns a new instance):

Option Default Description
orgId, projectId, env, apiKey Required scoping + auth
baseUrl https://sdk.traffical.io Control-plane base URL
localConfig null Bootstrap/offline ConfigBundle
refreshIntervalMs 60000 Cached bundle TTL
evaluationMode bundle bundle (local) or server
assignmentLogger null BYO warehouse logger (callable or AssignmentLogger)
disableCloudEvents false Stop sending events to Traffical
deduplicateAssignmentLogger true Dedup logger calls per request
trackDecisions true Emit a decision event per decide()
batchSize 10 Events per delivery batch (auto-flush threshold)
flushIntervalMs 30000 Event flush cadence (PHP flushes on batch-full or request end)
deduplicateExposures true Exposure session-dedup on/off (S4)
exposureSessionTtlMs 1800000 Exposure session-dedup TTL (30-minute session)
configTimeoutMs 10000 Config-fetch request timeout (see note below)
eventsTimeoutMs 10000 Event-delivery request timeout (see note below)
resolveTimeoutMs 5000 Server-resolve request timeout (see note below)
configSource discovered Custom ConfigSource (HTTP/file/inline/cached)
eventTransport discovered Custom EventTransport sink
httpClient, requestFactory, streamFactory discovered PSR-18/17 seams
cache null PSR-16 shared store (FPM workers share one bundle)
logger NullLogger PSR-3 logger
clock system PSR-20 clock
plugins [] Plugin list

Request timeouts. PSR-18 defines no portable timeout API, so the SDK cannot set connect/read timeouts on an arbitrary injected or auto-discovered HTTP client. The configTimeoutMs / eventsTimeoutMs / resolveTimeoutMs options carry the spec's intended values (10s / 10s / 5s); configure the matching timeout on the PSR-18 client you pass as httpClient (e.g. Guzzle's connect_timeout / timeout) to enforce them.

Cross-language conformance

The PHP SDK shares the language-agnostic Traffical SDK spec with the JS/TS and Swift SDKs: the same SHA-256 v2 (UTF-8 byte) bucketing, the same layered resolution engine, and the same contextual-bandit scoring. Every release is gated on the spec's deterministic conformance vectors, so a given unit buckets identically on every platform. The fixtures are pinned via the tests/sdk-spec git submodule and run as part of composer conformance.

Development

Conformance fixtures are pinned via the tests/sdk-spec git submodule. After cloning:

License

MIT


All versions of sdk with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
psr/http-client Version ^1.0
psr/http-factory Version ^1.0
psr/http-message Version ^1.1 || ^2.0
psr/simple-cache Version ^2.0 || ^3.0
psr/log Version ^2.0 || ^3.0
psr/clock Version ^1.0
php-http/discovery Version ^1.19
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 traffical/sdk contains the following files

Loading the files please wait ...