PHPackages                             logbrew/sdk - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Logging &amp; Monitoring](/categories/logging)
4. /
5. logbrew/sdk

ActiveLibrary[Logging &amp; Monitoring](/categories/logging)

logbrew/sdk
===========

Public LogBrew PHP SDK for building, validating, and flushing event batches.

v0.1.1(3w ago)421[24 PRs](https://github.com/LogBrewCo/sdk/pulls)MITShellPHP ^8.2CI passing

Since Jun 6Pushed 4d agoCompare

[ Source](https://github.com/LogBrewCo/sdk)[ Packagist](https://packagist.org/packages/logbrew/sdk)[ Docs](https://github.com/LogBrewCo/sdk/tree/main/php/logbrew-php)[ RSS](/packages/logbrew-sdk/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (9)Dependencies (2)Versions (5)Used By (0)

LogBrew SDKs
============

[](#logbrew-sdks)

 [![LogBrew logo](https://raw.githubusercontent.com/LogBrewCo/sdk/main/assets/brand/logbrew-logo-transparent-512.png)](https://raw.githubusercontent.com/LogBrewCo/sdk/main/assets/brand/logbrew-logo-transparent-512.png)

LogBrew SDKs help applications send logs, errors, traces, releases, environments, actions, and explicit metrics to LogBrew with small, dependency-light clients.

This repository contains the public SDK packages, framework integrations, event contract, examples, and shared guidance used to keep the developer experience consistent across ecosystems.

What You Can Capture
--------------------

[](#what-you-can-capture)

- Releases and environments for deployment context.
- Issues and handled errors without raw stack traces by default.
- Logs from direct calls or app-owned logger integrations.
- Spans and W3C `traceparent` context for request tracing.
- Actions for important user or system events.
- Explicit metrics when your application already knows the measurement name, value, unit, kind, and temporality.

User-facing severity categories are `info`, `warning`, `error`, and `critical`. SDKs keep accepting common runtime aliases where they are idiomatic, such as `trace`, `debug`, `warn`, and `fatal`, but queued payloads normalize those aliases to the canonical categories before they are sent. See the [LogBrew severity contract](docs/severity-contract.md) for the full mapping.

Packages
--------

[](#packages)

Install only the package your application needs. The package names below are registry-specific entry points, not a bundle to install together:

- Use the core package for your runtime first, such as `@logbrew/sdk`, `logbrew-sdk`, `LogBrew`, or `co.logbrew:logbrew-sdk`.
- Add framework packages only when your app uses that framework, such as `@logbrew/react`, `@logbrew/express`, `logbrew-fastapi`, `logbrew-flask`, or `logbrew-django`.
- Frontend and mobile packages use public `clientKey` setup. Server packages should use server-side keys from app configuration.
- A change to one ecosystem package should not require developers in other ecosystems to update unless their package also changed.
- Apple app setup should start from the Swift/SwiftPM path. Objective-C remains available as an advanced source/header variant for mixed or Objective-C-only apps, not a separate first-step platform choice.
- Product setup pickers should show user-facing runtime/platform families instead of helper package names; see the [SDK setup picker guidance](docs/sdk-setup-picker-guidance.md).

Node queue integrations are published as separate npm packages. For BullMQ, KafkaJS, RabbitMQ/amqplib, and Amazon SQS, install the matching `@logbrew/*`integration alongside `@logbrew/sdk`, `@logbrew/node`, and the broker or client library your app already uses.

EcosystemPackageUse it forJavaScript[`@logbrew/sdk`](js/logbrew-js)Core event client, transports, trace helpers, console/Pino/Winston logger adaptersBrowser[`@logbrew/browser`](js/logbrew-browser)Browser page views, handled errors, lifecycle flushing, fetch delivery, target-scoped trace propagationNode.js[`@logbrew/node`](js/logbrew-node)Built-in `node:http` request capture and server deliveryBullMQ[`@logbrew/bullmq`](js/logbrew-bullmq)Explicit BullMQ producer/worker trace correlationKafkaJS[`@logbrew/kafkajs`](js/logbrew-kafkajs)Explicit KafkaJS producer/consumer trace correlationRabbitMQ / amqplib[`@logbrew/amqplib`](js/logbrew-amqplib)Explicit RabbitMQ publish/consume trace correlationAmazon SQS[`@logbrew/aws-sqs`](js/logbrew-aws-sqs)Explicit SQS send/receive/process trace correlationExpress[`@logbrew/express`](js/logbrew-express)Express request/error middlewareFastify[`@logbrew/fastify`](js/logbrew-fastify)Fastify plugin and request hooksNestJS[`@logbrew/nestjs`](js/logbrew-nestjs)NestJS interceptor captureAngular[`@logbrew/angular`](js/logbrew-angular)Angular providers, injection helpers, optional error captureVue[`@logbrew/vue`](js/logbrew-vue)Vue plugin/composable captureSvelte[`@logbrew/svelte`](js/logbrew-svelte)Svelte context and error helpersReact[`@logbrew/react`](js/logbrew-react)Provider, hook, error boundary, handled error helpersReact Native[`@logbrew/react-native`](js/logbrew-react-native)Mobile screen/app-state context and handled errorsNext.js[`@logbrew/next`](js/logbrew-next)App Router Route Handler capturePython[`logbrew-sdk`](python/logbrew_py)Core Python client, HTTP delivery, logging handlerFastAPI[`logbrew-fastapi`](python/logbrew_fastapi)FastAPI middlewareFlask[`logbrew-flask`](python/logbrew_flask)Flask request/exception middlewareDjango[`logbrew-django`](python/logbrew_django)Django middlewareGo[`github.com/LogBrewCo/sdk/go/logbrew`](go/logbrew)Core Go client, HTTP delivery, trace helpersJava[`co.logbrew:logbrew-sdk`](java/logbrew-java)Core Java client, HTTP delivery, JUL and Logback support.NET[`LogBrew`](dotnet/logbrew-dotnet)Core .NET client, HTTP delivery, `ILogger` providerASP.NET Core[`LogBrew.AspNetCore`](dotnet/logbrew-dotnet/src/LogBrew.AspNetCore)Optional ASP.NET Core request telemetry middlewareEntity Framework Core[`LogBrew.EntityFrameworkCore`](dotnet/logbrew-dotnet/src/LogBrew.EntityFrameworkCore)Optional EF Core command span interceptorStackExchange.Redis[`LogBrew.StackExchangeRedis`](dotnet/logbrew-dotnet/src/LogBrew.StackExchangeRedis)Optional Redis command spans without key/value capturePHP[`logbrew/sdk`](php/logbrew-php)Core PHP client, HTTP delivery, PSR-3 and Monolog/Laravel supportRuby[`logbrew-sdk`](ruby/logbrew-ruby)Core Ruby client, HTTP delivery, stdlib `Logger`, Rack/Rails-compatible helpersRust[`logbrew`](rust/logbrew)Core Rust client and optional blocking HTTP deliveryApple apps[`logbrew-swift`](swift/logbrew-swift) primary; [`logbrew-objc`](objc/logbrew-objc) advanced source/header variantSwiftPM `LogBrew` product for iOS, macOS, tvOS, watchOS, Apple-style logger ergonomics, URLSession delivery; Objective-C vendoring for mixed or Objective-C-only appsKotlin[`co.logbrew:logbrew-kotlin`](kotlin/logbrew-kotlin)Kotlin/JVM client, Android-style helper APIs, HTTP deliveryKotlin OkHttp[`kotlin/logbrew-kotlin-okhttp`](kotlin/logbrew-kotlin-okhttp)Optional OkHttp interceptor source package; Maven Central publication is pending, so use the core Kotlin package or local source until the artifact is publishedUnity[`co.logbrew.unity`](unity/logbrew-unity)Unity package with runtime helpers and HTTP deliveryC[`logbrew-c`](c/logbrew-c)C source/header clientC++[`logbrew-cpp`](cpp/logbrew-cpp)C++ RAII source/header client with optional HTTP deliveryQuick Start
-----------

[](#quick-start)

JavaScript:

```
npm install @logbrew/sdk
```

```
import { LogBrewClient, RecordingTransport } from "@logbrew/sdk";

const client = LogBrewClient.create({
  apiKey: "LOGBREW_API_KEY",
  sdkName: "checkout-api",
  sdkVersion: "1.0.0"
});

client.log("evt_log_001", "2026-06-02T10:00:03Z", {
  message: "worker started",
  level: "info",
  logger: "job-runner"
});

await client.flush(RecordingTransport.alwaysAccept());
```

Python:

```
python3 -m pip install logbrew-sdk
```

```
from logbrew_sdk import LogBrewClient, RecordingTransport

client = LogBrewClient.create("LOGBREW_API_KEY", "checkout-worker", "1.0.0")
client.log("evt_log_001", "2026-06-02T10:00:03Z", {
    "message": "worker started",
    "level": "info",
    "logger": "job-runner",
})
client.flush(RecordingTransport.always_accept())
```

Python DB-API spans are explicit and app-owned. Trace the connect callable your app already controls, then keep using normal cursor methods:

```
import sqlite3

from logbrew_sdk import connect_dbapi_connection_with_logbrew_spans

connection = connect_dbapi_connection_with_logbrew_spans(
    sqlite3.connect,
    connect_args=("checkout.db",),
    client=client,
    system="sqlite",
    db_name="checkout",
    trace_fetch_methods=True,  # opt in only when fetch timing is worth the extra spans
)

cursor = connection.execute(
    "SELECT id, status FROM checkout_order WHERE id = ?",
    (order_id,),
)
rows = cursor.fetchall()
connection.commit()
```

The wrapper records operation labels such as `SELECT`, `FETCHALL`, and `COMMIT`, duration, row counts when the driver exposes them, trace/span correlation, and type-only failures. It does not capture SQL values, bind parameters, result rows, connection strings, baggage, tracestate, stacks, or exception messages.

PHP:

```
composer require logbrew/sdk
```

```
