Download the PHP package mbuzz/mbuzz-php without Composer

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

Mbuzz PHP SDK

Multi-touch attribution SDK for PHP. Framework-agnostic core with first-party adapters for Laravel, Symfony, and any PSR-15 framework (Slim, Mezzio, …).

Requirements

Installation

Quick Start

Configuration Options

By default the API URL is https://api.mbuzz.co/api/v1 — all traffic routes through the edge ingest proxy.

Data-resident installs (api_url)

An account whose data must stay in a region (for example Australia) is given a region API key (sk_live_au_...) and a host to send to. Set both:

api_url is an explicit opt-in with three rules, so a normal install can never be redirected by accident:

Non-blocking dispatch

Fire-and-forget tracking calls (Mbuzz::initFromRequest() session creates, explicit Api::post) are queued and flushed in the PHP shutdown phase. On FPM and LiteSpeed the SDK calls fastcgi_finish_request / litespeed_finish_request first, so the user receives the response before the tracking POST goes out — page-render latency is unaffected even when the API is slow. On environments without FPM (CLI workers, plain CGI) the queue still flushes in shutdown but synchronously; the session POST keeps a tight 2-second cap as a backstop.

Mbuzz::event(), Mbuzz::conversion(), and Mbuzz::identify() remain synchronous because callers want the response (event_id, conversion_id, attribution).

Full-page caching — REQUIRED on every install

Add this inline in your <head>, on every page. Without it the SDK establishes no visitor and tracks nothing.

Why

A full-page cache — Cloudflare, Varnish, WP Rocket, Nginx proxy_cache — serves HTML without ever invoking PHP. On a cache HIT the SDK does not run, so it cannot set the visitor cookie while rendering the page. Every later event and conversion is then rejected for having nobody to attribute it to: silently, with no HTTP call and nothing logged, while the page renders perfectly.

POST /_mbuzz/session is the one request that always reaches the app, because no cache stores a POST. The snippet above triggers it; the server mints the cookie on the response, so the id stays HttpOnly and keeps its full two-year life. (A document.cookie fallback would be capped at 7 days by Safari's ITP — 24 hours after an ad click — which is worse than the bug.)

Inline, not an enqueued file. Asset optimisers delay external scripts until the visitor first interacts, so an external trigger never runs for the visitor who lands and converts without clicking — exactly the traffic this recovers.

The endpoint is handled by the SDK. The bundled adapters intercept it for you; a hand-rolled plain PHP integration needs the early return shown below.

If you are behind a CDN or WAF

Two layers can sit between the browser and PHP, and both fail silently:

Check both by fetching a page and confirming the script is present unmodified, then confirming POST /_mbuzz/session returns 204 with a Set-Cookie: _mbuzz_vid header.

Framework Integration

Plain PHP

Laravel

The middleware is duck-typed against Laravel's handle($request, Closure $next) contract and never imports an Illuminate class. A dedicated service provider / config publisher is not shipped yet — wire Mbuzz::init() into a provider you already own.

Symfony

The SymfonySubscriber automatically initializes tracking on each request by listening to the kernel.request event with high priority.

Slim / PSR-15 Frameworks

Add psr/http-server-middleware to your project (Slim and Mezzio already require it transitively):

Then wire it in:

The same middleware works for Mezzio, Hyperf, and any other PSR-15 compliant framework.

WordPress

A dedicated WordPress plugin (with WooCommerce conversion hooks) is on the roadmap — see lib/specs/wordpress-plugin.md. Until it ships, drop the SDK into a small mu-plugin that calls Mbuzz::init() on plugins_loaded and Mbuzz::initFromRequest() on template_redirect.

API Reference

Mbuzz::init(array $options)

Initialize the SDK. Must be called before any tracking methods.

Mbuzz::initFromRequest(): bool

Initialize context from the current HTTP request. Reads the visitor cookie, captures IP and user agent for server-side session resolution, and handles POST /_mbuzz/session.

Returns true when the request WAS the session endpoint and has already been answered — the cookie is set and a 204 is on its way. The caller must return immediately rather than render:

The bundled Laravel, Symfony and PSR-15 adapters do this for you.

Changed in 2.0.0: previously returned void.

Mbuzz::event(string $eventType, array $properties = [])

Track an event. Returns result array with event_id on success, false on failure.

Mbuzz::conversion(string $conversionType, array $options = [])

Track a conversion. Options:

Returns result array with conversion_id on success, false on failure.

Mbuzz::identify(string|int $userId, array $traits = [])

Link the current visitor to a known user. Returns true on success.

Mbuzz::visitorId(), Mbuzz::userId()

Get current tracking IDs.

Mbuzz::reset()

Reset SDK state. Useful for testing or long-running processes.

Cookie Behavior

The SDK sets one cookie:

The cookie is:

Session resolution is handled server-side using IP and user agent for device fingerprinting.

The cookie is minted only by POST /_mbuzz/session, never by a page response. A page can be stored by a full-page cache and replayed to every visitor, so a Set-Cookie in it would hand everyone the same id and merge unrelated people into one journey — corruption rather than loss. A page response reads the cookie the browser already holds and nothing else.

Development

License

MIT


All versions of mbuzz-php with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
ext-curl Version *
ext-json Version *
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 mbuzz/mbuzz-php contains the following files

Loading the files please wait ...