Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Server Sdk Laravel Package

launchdarkly/server-sdk

LaunchDarkly server-side SDK for PHP lets you evaluate feature flags, target users, and manage segments directly in your PHP applications, with streaming updates, polling, and local caching for fast, reliable flag delivery.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

What it is. The official LaunchDarkly server-side SDK for PHP: a vendor-maintained client that evaluates feature flags locally, caches flag state, and streams/polls configuration from LaunchDarkly's service or a Relay Proxy. It is the sanctioned integration path for PHP, not a community wrapper.

Architecture fit. Good for Laravel's service-container model — the SDK is a natural singleton (LDClient) resolved once per process, with an LDUser/context object built per request. The friction is lifecycle, not API design: PHP-FPM tears down the process at request end, so a naive binding would construct a client, open a streaming connection, evaluate a flag, and discard it on every request. That is architecturally wrong and will produce latency spikes and connection churn. The package fits well only under one of three deployment shapes:

  • Relay Proxy / daemon mode (recommended): PHP SDK configured in offline or polling mode against a local Relay sidecar; the long-lived connection lives outside PHP.
  • Redis-backed feature store: SDK polls and reads flag state from a shared store, so per-request clients are cheap and consistent.
  • Long-lived workers: Laravel Octane/Swoole/RoadRunner, or queue workers, where the client genuinely persists across jobs.

Integration feasibility. High. Composer install, one service provider, one config file. The public surface is small — client init, variation()/variationDetail(), identify(), flush(), track(). Everything else (targeting rules, segments, prerequisites, experiments) is configured in the LaunchDarkly UI, not in code, so the PHP footprint stays thin. No schema, no migrations, no database coupling.

Technical risk.

  • Licensing ambiguity. NOASSERTION means GitHub's detector failed, not that the license is unusual — LaunchDarkly SDKs are typically Apache-2.0. Still, legal must confirm before this becomes a dependency in a distributed or client-facing artifact.
  • Ecosystem signal is weak in the metadata provided. 39 stars and 0 listed dependents understate real usage (PHP packages are distributed via Packagist, which GitHub doesn't count), but they also mean fewer public issue reports, fewer Stack Overflow answers, and a smaller pool of engineers who have debugged it in production. Bus-factor risk is on the vendor, not the community.
  • Release metadata anomaly. A last-release date of 2026-10-21 is in the future — likely a scraping/versioning artifact. Treat release cadence as unverified until checked directly against Packagist and the repo's tags.
  • Extension dependencies. Streaming and event delivery lean on curl; without it, the SDK falls back to slower, blocking file-based event publishing. Verify the target runtime image (Alpine, distroless, minimal FPM images) has the required extensions.
  • Vendor lock-in. Flag evaluation is local, but flag definition lives in LaunchDarkly's control plane. Migrating off means re-implementing targeting semantics elsewhere.

Key questions for the vendor/team.

  1. What is the confirmed license and does it clear legal review?
  2. Which PHP versions and Laravel versions are explicitly supported, and what is the support window?
  3. Are we licensed for the Relay Proxy, and does our contract cover the connection volume we'd generate?
  4. What is the documented behavior when LaunchDarkly is unreachable — cached last-known-good, or hardcoded defaults?
  5. Do we need data residency or a self-hosted relay for PII in the evaluation context?
  6. Who owns flag hygiene — engineering or product — and what is the archival policy for stale flags?
  7. Is there an existing in-house config/experimentation system this would duplicate or replace?

Integration Approach

Stack fit. Laravel-native. Register the client as a singleton in a service provider, expose it behind a thin FeatureFlags interface rather than injecting LDClient directly into controllers and jobs. Publish a config/launchdarkly.php fed by environment variables (LAUNCHDARKLY_SDK_KEY, mode, relay URL, cache backend). Provide a Blade directive and a validation rule or middleware if flags gate routes.

Migration path. Do not rip out the current mechanism first. Sequence:

  1. Spike (1–2 days). Stand up a Relay Proxy in a dev namespace, wire the SDK in offline/polling mode, prove flag evaluation and a kill-switch toggle end to end.
  2. Abstraction layer. Define FeatureFlags::bool(string $key, Context $ctx, bool $default) before any product code depends on the vendor. This is the single highest-value step — it makes a future vendor swap a one-class change and keeps the SDK out of domain logic.
  3. Shadow mode. For 2–3 high-traffic flags, evaluate via both the existing mechanism and LaunchDarkly, log disagreements, serve the existing value. This surfaces context-construction bugs (wrong user key, missing attributes) before they cause an incident.
  4. Migrate in tiers. Internal/admin flags → non-critical UX flags → gated rollouts → kill switches and entitlement enforcement. Entitlements last, because a flag-service outage there becomes a functional outage.
  5. Decommission. Remove the old config paths; add a CI check that flags referenced in code exist in LaunchDarkly.

Compatibility. Confirm PHP and Laravel version support against the project's actual runtime, not the latest. Verify curl and, if using the Redis store, the Redis extension and a Redis instance reachable from every web and worker node. Check that the SDK plays correctly with Octane's worker reuse — singletons that hold state across requests need explicit reset or per-request context construction.

Sequencing dependencies. Relay Proxy infrastructure and network policy must land before the SDK is enabled in streaming mode. Secret distribution for the SDK key must land before any environment goes live. Observability (flag evaluation logs, SDK connection health) should land in the same sprint as the first production flag — otherwise the first incident is undiagnosable.

Operational Impact

Maintenance. Low-to-moderate. The vendor ships the code and the security patches; the team owns version pinning, the Relay Proxy deployment, and flag lifecycle. The real maintenance cost is flag debt — flags are cheap to create and expensive to remove. Budget for a recurring audit and a hard rule that a flag that has been at 100% for N weeks gets deleted. Renovate/Dependabot on the SDK and relay image, with a defined patch SLA.

Support. Two layers. Vendor support (LaunchDarkly's plans) covers the service and SDK defects; it does not cover "your context object is malformed" or "your relay is misconfigured" — that is internal on-call. Given the small public footprint, expect to debug more from SDK source and vendor docs than from community answers. Designate one engineer as the internal owner; a flagging system with no owner decays into unmaintained config sprawl.

Scaling. Two dimensions:

  • Evaluation volume is essentially free — evaluation is in-process and in-memory, so cost scales with request volume at negligible marginal latency (microseconds). This is the SDK's main strength.
  • Connection volume is where it bites. Streaming mode from every PHP-FPM worker does not scale — worker counts in the hundreds mean hundreds of persistent connections. The Relay Proxy collapses this to one connection per relay, with PHP talking to the relay over localhost. Treat the relay as required infrastructure, not an optimization.

Failure modes to instrument and plan for:

  • LaunchDarkly unavailable at request time — with streaming, the SDK serves last-known-good from memory; on cold start with no cache, it serves hardcoded defaults. Every flag call must pass a deliberate default, and the default must be the safe one (feature off, old code path, conservative entitlement). This is a code-review checklist item, not a runtime setting.
  • Relay Proxy down — flag state goes stale but evaluation continues from memory; if the relay is also the cache, cold starts degrade to defaults. Run more than one replica and alert on relay health.
  • Event pipeline backpressure — track() and evaluation events buffer in memory and flush periodically. High-volume PHP with short-lived processes can lose events on abrupt termination. Call flush() explicitly at request end (terminate() middleware) or on queue job completion; accept that analytics events are best-effort and never make business logic depend on them.
  • Stale flags — a flag stuck at an old value after a bad migration silently changes behavior. Alert on SDK connection age and on flag-version skew against the LaunchDarkly audit log.
  • Missing extensions in a rebuilt image — a base-image change that drops curl degrades event delivery silently. Pin and test the runtime image.

Ramp-up. Low for the mechanics: an engineer can ship a boolean kill switch in under a day. Moderate for correctness: context design (consistent user keys across web, queue, and CLI; which attributes are safe to send), targeting semantics, and default-value discipline are where teams get burned. Plan a half-day internal walkthrough covering context construction, default values, the Relay Proxy topology, and the flag-removal policy. Include a runbook for "flags are evaluating incorrectly" and "LaunchDarkly is down."

Verdict. Technically sound and the correct choice if the organization is committing to LaunchDarkly; the SDK is thin, well-scoped, and the vendor carries the maintenance. Adoption risk is not in the package — it is in the operational shape (relay infrastructure, PHP process lifecycle), in flag governance, and in the licensing and ecosystem signals that remain unverified. Clear those four items before the first production flag.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
uni-method/symfony-lib
tacticmedia/scim-server-bundle
neika-ai/symfony-bundle
mattleads/agent-publishing-bundle
glavweb/framework-bundle
glavweb/extra-bundle
glavweb/api-bundle
glavweb/admin-bundle
adachsoft/api-version-bundle
elsayed85/laravel-api-exceptions
ouhssini/laravel-demo-mode
daworks/ncloud-outbound-mailer-driver
gp247/cms
ignibyte/aic-gates
nexa-merchant/blog
novasa/laravel-language-center
opencage/geocode
adolfoholzer/parameters
livenetworks/ln-starter
cgv/localized-resource