PHPackages                             logtide/logtide-slim - 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. logtide/logtide-slim

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

logtide/logtide-slim
====================

LogTide integration for Slim Framework 4

v0.7.4(3mo ago)00MITPHPPHP ^8.1

Since Mar 6Pushed 2mo agoCompare

[ Source](https://github.com/logtide-dev/logtide-slim)[ Packagist](https://packagist.org/packages/logtide/logtide-slim)[ RSS](/packages/logtide-logtide-slim/feed)WikiDiscussions main Synced 2w ago

READMEChangelogDependencies (6)Versions (6)Used By (0)

 [![LogTide Logo](https://raw.githubusercontent.com/logtide-dev/logtide/main/docs/images/logo.png)](https://raw.githubusercontent.com/logtide-dev/logtide/main/docs/images/logo.png)

logtide/logtide-slim
====================

[](#logtidelogtide-slim)

 [![Packagist](https://camo.githubusercontent.com/46175fed4c030300609f0b535b81adcbbef72e6dd8baad3743fc41eb873a9789/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6c6f67746964652f6c6f67746964652d736c696d3f636f6c6f723d626c7565)](https://packagist.org/packages/logtide/logtide-slim) [![License](https://camo.githubusercontent.com/08cef40a9105b6526ca22088bc514fbfdbc9aac1ddbf8d4e6c750e3a88a44dca/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d626c75652e737667)](../../LICENSE) [![Slim](https://camo.githubusercontent.com/6355327010eeae804d005c4518e6fdc2df84d9accbe2930413d51dec192bf8ad/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f536c696d2d342e782d3734623536362e737667)](https://www.slimframework.com/)

 [LogTide](https://logtide.dev) middleware for Slim 4 — automatic request tracing, error capture, and breadcrumbs.

---

Features
--------

[](#features)

- **Automatic request spans** for every incoming request
- **Error capture** with full request context via error middleware
- **W3C Trace Context** propagation (`traceparent` in/out)
- **Route pattern resolution** from Slim routing
- **Configurable skip paths** (e.g. `/health`, `/healthz`)
- **PSR-15 compliant** middleware
- **Slim 4** support

Installation
------------

[](#installation)

```
composer require logtide/logtide-slim
```

---

Quick Start
-----------

[](#quick-start)

```
use LogTide\Slim\LogtideMiddleware;
use LogTide\Slim\LogtideErrorMiddleware;
use Slim\Factory\AppFactory;

// Initialize LogTide
\LogTide\init([
    'dsn' => 'https://lp_your_key@your-instance.com',
    'service' => 'my-slim-api',
]);

$app = AppFactory::create();

// Add LogTide request tracing middleware
$app->add(new LogtideMiddleware());

// Add routes
$app->get('/hello/{name}', function ($request, $response, $args) {
    $response->getBody()->write("Hello, {$args['name']}!");
    return $response;
});

// Option A: Use Slim's built-in error middleware (LogtideMiddleware captures errors too)
$app->addErrorMiddleware(true, true, true);

// Option B: Use LogtideErrorMiddleware as a standalone alternative
// $app->add(new LogtideErrorMiddleware($app->getResponseFactory()));

$app->run();
```

---

How It Works
------------

[](#how-it-works)

The middleware runs on every request and:

1. **Extracts** incoming `traceparent` header (or generates a new trace)
2. **Creates a span** named after the request (e.g. `HTTP GET /hello/{name}`)
3. **Records breadcrumbs** for request and response
4. **Calls** the next middleware/handler
5. **Finishes the span** with `ok` or `error` based on response status
6. **Injects `traceparent`** into the response headers
7. **Captures errors** for 5xx responses with full context

---

Configuration
-------------

[](#configuration)

### Skip Paths

[](#skip-paths)

```
$middleware = new LogtideMiddleware(
    skipPaths: ['/health', '/healthz', '/metrics'],
);
```

### Error Middleware

[](#error-middleware)

`LogtideErrorMiddleware` is a standalone alternative to Slim's built-in `addErrorMiddleware`. It captures exceptions, logs them to LogTide, and renders an error response.

```
use LogTide\Slim\LogtideErrorMiddleware;

// Use instead of $app->addErrorMiddleware()
$app->add(new LogtideErrorMiddleware(
    responseFactory: $app->getResponseFactory(),
    displayErrorDetails: true, // show details in dev
));
```

---

License
-------

[](#license)

MIT License - see [LICENSE](../../LICENSE) for details.

Links
-----

[](#links)

- [LogTide Website](https://logtide.dev)
- [Documentation](https://logtide.dev/docs/sdks/slim/)
- [GitHub](https://github.com/logtide-dev/logtide-php)

###  Health Score

33

—

LowBetter than 72% of packages

Maintenance84

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity37

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~3 days

Total

5

Last Release

95d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/40077351?v=4)[Polliog](/maintainers/Polliog)[@Polliog](https://github.com/Polliog)

---

Top Contributors

[![Polliog](https://avatars.githubusercontent.com/u/40077351?v=4)](https://github.com/Polliog "Polliog (4 commits)")

---

Tags

logginglogtideobservabilitypackagistphppsr-15slimmiddlewareloggingslimobservabilitylogtide

### Embed Badge

![Health badge](/badges/logtide-logtide-slim/health.svg)

```
[![Health](https://phpackages.com/badges/logtide-logtide-slim/health.svg)](https://phpackages.com/packages/logtide-logtide-slim)
```

###  Alternatives

[itsgoingd/clockwork

php dev tools in your browser

5.9k29.0M110](/packages/itsgoingd-clockwork)[flynsarmy/slim-monolog

Monolog logging support Slim Framework

114483.3k10](/packages/flynsarmy-slim-monolog)[moesif/moesif-laravel

Moesif Collection/Data Ingestion Middleware for Laravel

1167.3k](/packages/moesif-moesif-laravel)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
