Download the PHP package runomine/runomine-php without Composer

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

runomine-php

The PHP library of runomine: cookieless analytics that counts money, not just visits. It sends pageviews and business events (signups, purchases, revenue) from your backend, so the visitor's IP never leaves your server, and the library sets nothing in the browser.

Install

From Packagist:

Or straight from this repository:

Laravel (10 and up)

That's all. The package is auto-discovered, adds Runomine\Laravel\TrackPageViews to the web middleware group, and starts recording pageviews. Then track what matters:

Inside an HTTP request, Rom::track() attaches the visitor hash, the URL, the country and the logged-in user's id. In queued jobs, commands and webhooks there is no request, so the event goes without a visitor field (never a made-up one): pass the user so runomine can link the event to that person's earlier visits, or hand over the visitor captured during the request with Rom::visitor().

Page views take props too, stored as the page view's dims: each key becomes a breakdown and a filter in Traffic (area feeds the Areas breakdown). Same rules as events: flat, up to 20 keys, string or number values. With the middleware, a controller sets them on the request; when you record the page view yourself (with middleware => false, or for pages the middleware doesn't see), pass them along:

Publish the config if you want to change the defaults:

Plain PHP (no framework)

Only record what the visitor actually saw: GET requests answered 200 with text/html. Long-running workers should call $rom->flush() after each unit of work.

Samples: your app's own numbers on the Live page

From a scheduled command, a few times a minute: queue depth, CPU, people on the site right now. Nested arrays become dotted keys (queue.pending), booleans 0/1, anything that isn't a number is dropped. Sent at once to POST /api/v1/samples (not queued), with the same retries; one sample per second (sending a ts again replaces it), any age.

true means runomine took the call; false that the client is disabled or the call failed after the retries, so a cursor-based push knows not to advance. Never throws.

Revenue from your payment provider

runomine takes revenue from your payment provider, not from prices in your code: connect Stripe, Paddle, Lemon Squeezy, Shopify or PayPal in the site's settings → Integrations, and runomine reads every sale, renewal and refund from it. To attribute a sale to the visit and the person behind it, pass two identifiers when you create the checkout; runomine reads them back from the provider.

runomine_visitor is this request's visitor hash and runomine_user your user id, as text. Only keys with a value are returned: outside an HTTP request or without a token there is no visitor (never a made-up one), and with nobody logged in there is no user.

Once a provider is connected, don't also send revenue with Rom::track('purchase', …): it would be counted twice. Send the event without revenue, or not at all. (The webhook examples above are for payments that don't go through a connected provider.)

Stripe Checkout: client_reference_id is used as the user when runomine_user is missing. For subscriptions, also put it on the subscription so renewals carry the user.

Paddle Billing: render the values into the page and pass them as customData to Paddle.js, or as custom_data when you create the transaction through the API.

Lemon Squeezy: checkout_data.custom when you create the checkout through the API, or URL parameters on a checkout link.

Shopify (headless, Storefront API cart): cart attributes, which become the order's note attributes.

PayPal Orders v2: custom_id on the purchase unit, as a query string (127 characters at most).

What is sent, and privacy

Each event goes to POST https://runomine.com/api/v1/events with your token as a bearer:

field
id A UUID v7 made here. runomine stores an event once even if it's sent twice.
type, name, ts pageview or event, the event's name, and when it happened.
url, referrer The page and where the visitor came from. runomine keeps the path, utm_*/ref and the referrer's host.
user_agent Pageviews only. Used for the bot filter and device/browser/OS families, then discarded.
visitor A daily hash, computed on your server. Required for pageviews (one without an IP or visitor is dropped); left out of events with no request behind them.
country From CF-IPCountry or CloudFront-Viewer-Country, when your CDN sends it.
user Your own user id, as text, when someone is logged in.
revenue, props {amount, currency} in major units, and flat string/number properties.

The IP never leaves your server. The visitor hash is:

so a person counts once per day and site, and the hash on its own can't follow anyone across days or sites. If you send user (your own user id), runomine links that user's visits and purchases over time to attribute revenue: that is no longer anonymous audience measurement, and it needs its own legal basis. The hash is the same value runomine's JS beacon produces, so a site using both counts each person once. Runomine\VisitorHash::compute() is public if you need it.

The library does no classification: no source, bot or device logic. runomine does that, once, for every library.

Behind a proxy or CDN

The hash uses $request->ip(), so configure Laravel's trusted proxies ($middleware->trustProxies(at: '*') in bootstrap/app.php when your platform's proxy is the only way in). Without that, every visitor looks like your load balancer. If you are behind Cloudflare and can't configure trusted proxies, set RUNOMINE_IP_HEADER=CF-Connecting-IP (only then: the header is easy to spoof otherwise).

Configuration

Environment variables (both the plain client and Laravel read them):

variable default
RUNOMINE_TOKEN The site's server token (rm_live_...). Required: without it nothing is sent.
RUNOMINE_URL https://runomine.com
RUNOMINE_ENABLED true when the token is set false switches everything off.
RUNOMINE_MIDDLEWARE true Laravel: add the pageview middleware to the web group.
RUNOMINE_IP_HEADER Laravel: read the client IP from this header instead of $request->ip().

config/runomine.php (Laravel):

key default
token, url, enabled from the env
middleware true Set false and add \Runomine\Laravel\TrackPageViews::class yourself where you want it.
skip api/*, up, livewire/*, build/*, storage/*, horizon*, telescope*, pulse*, _debugbar/*, sanctum/* $request->is() patterns never recorded as pageviews. Add your admin, e.g. admin/*.
user null null: the authenticated user's id. false: never send it. Or an invokable class: __invoke(?Request $request): string\|int\|null.
ip_header null See above.
timeout 2.0 Seconds for the call to runomine (made after the response is sent).

At runtime: Rom::resolveUserUsing(fn (?Request $request) => $request?->user()?->account_id);

The middleware records a pageview when the request is a GET, the answer is 200 with text/html, the path isn't skipped and it isn't a browser prefetch (Sec-Purpose/Purpose: prefetch). It does so in terminate(), after the response has been sent, and flushes there. Events tracked in commands and queued jobs are flushed when the command or job finishes. Inertia visits and other client-side navigations answer JSON, so they aren't seen here; add the beacon for those.

Client options

new Runomine\Client(token:, url:, enabled:, sender:, batchSize: 500, retries: 2, flushInterval: 5.0, timeout: 2.0)

Testing your app

Laravel: Rom::fake()

Also: assertNothingTracked(), assertNoPageviews(), and events(), tracked('name'), pageviews() to inspect the exact payloads that would have been sent (a page view's props are in $event['props']). Nothing leaves the test. To switch runomine off in tests without faking it, set RUNOMINE_ENABLED=false in phpunit.xml.

Samples are recorded too: sampled() lists them as sent (['ts' => …, 'data' => […]]), with assertSampled(fn (array $sample) => ($sample['data']['healthy'] ?? null) === true) and assertNothingSampled().

Plain PHP: FakeSender

Developing this package

The tests include the contract's visitor-hash vector, the payload shape, batching, retries, and the Laravel middleware and facade (with Orchestra Testbench).

License

MIT. See LICENSE.


All versions of runomine-php with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
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 runomine/runomine-php contains the following files

Loading the files please wait ...