setono/client-id
Setono Client ID provides a lightweight way to generate and persist a unique client identifier for visitors. It helps recognize returning users and supports analytics-style tracking without requiring login, with simple PHP/Symfony integration.
composer require setono/client-id. There is no Laravel service provider or facade — this is a framework-agnostic library (the Symfony integration lives in a separate bundle), so budget ~15–30 minutes to wire it into the container yourself.ClientId value object (what you actually pass around).client_id cookie on a visitor's first request, then read it back on every subsequent request. That ID becomes the join key between your browser-side pixel (Meta, TikTok, GA4) and your server-side events (Conversions API, Events API, Measurement Protocol). Without a shared key, server events can't be deduplicated against browser events and your attribution gets noisy.ClientIdServiceProvider.terminate hook) that ensures the cookie exists on the outgoing response.terminate() or on the response object so you don't clobber it on redirects.ClientId as a scoped/singleton instance resolved from the request. Then any controller, job, or listener can type-hint it rather than re-parsing the cookie. This keeps conversion-tracking code clean: SendPurchaseEvent::dispatch($order, $clientId).external_id / client_id in its payload. Server-side, read the cookie via the provider and send the identical value. Deduplication then works on (event_name, event_id, client_id).ClientId value before dispatch — queues have no request/cookie context, and the provider will return null in a worker.withCookie('client_id', $uuid) (or withUnencryptedCookie if you've excluded it from encryption) in feature tests, and assert the cookie is set on first-hit responses. Test the "cookie already present" path separately — it's the branch that silently breaks.symfony/http-foundation 4.x is not), composer will refuse the upgrade. Run composer why-not setono/client-id 0.2.2 before assuming it's safe. Treat it as a maintenance release otherwise — no API changes for a Laravel consumer.App\Http\Middleware\EncryptCookies::$except. If you forget, the browser sees an encrypted blob and your pixel/server matching silently fails — no error, just 0% match rate. This is the single most common integration bug.HttpOnly is a deliberate trade-off. Server-only matching can keep it HttpOnly; browser matching requires it readable. Decide early; changing it later rotates every visitor's ID.EncryptCookies so the exclusion applies. Debugging tip: if the ID rotates on every request, you're either setting the cookie on a cached response, or the encryption exclusion isn't in place.How can I help you explore Laravel packages today?