PHPackages                             apitoolkit/apitoolkit-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. [HTTP &amp; Networking](/categories/http)
4. /
5. apitoolkit/apitoolkit-slim

ActiveLibrary[HTTP &amp; Networking](/categories/http)

apitoolkit/apitoolkit-slim
==========================

APIToolkit SDK for php slim framework

v2.0.4(1y ago)139[2 PRs](https://github.com/apitoolkit/apitoolkit-slim/pulls)MITPHPPHP ^7.4 || ^8.0

Since Dec 10Pushed 1y ago1 watchersCompare

[ Source](https://github.com/apitoolkit/apitoolkit-slim)[ Packagist](https://packagist.org/packages/apitoolkit/apitoolkit-slim)[ Docs](http://github.com/apitoolkit/apitoolkit-slim)[ RSS](/packages/apitoolkit-apitoolkit-slim/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (13)Versions (16)Used By (0)

[![APItoolkit's Logo](https://github.com/apitoolkit/.github/raw/main/images/logo-white.svg?raw=true#gh-dark-mode-only)](https://github.com/apitoolkit/.github/blob/main/images/logo-white.svg?raw=true#gh-dark-mode-only)[![APItoolkit's Logo](https://github.com/apitoolkit/.github/raw/main/images/logo-black.svg?raw=true#gh-light-mode-only)](https://github.com/apitoolkit/.github/blob/main/images/logo-black.svg?raw=true#gh-light-mode-only)

Slim SDK
--------

[](#slim-sdk)

[![APItoolkit SDK](https://camo.githubusercontent.com/9c71d70056fd1449aeff5acce45f104a5a35245d424d0c75ba42886b21a90e7f/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f415049746f6f6c6b69742d53444b2d3030363866663f6c6f676f3d706870)](https://github.com/topics/apitoolkit-sdk) [![Join Discord Server](https://camo.githubusercontent.com/dd0cde65a806f8c74389de9910e309342b68f6f34323cb36639d49d891bd65be/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f436861742d446973636f72642d373238396461)](https://apitoolkit.io/discord?utm_campaign=devrel&utm_medium=github&utm_source=sdks_readme) [![APItoolkit Docs](https://camo.githubusercontent.com/e564bf9ed10a447656c22b3abc4e1c41e684552580bc05043612215d99fe1a57/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f526561642d446f63732d303036386666)](https://apitoolkit.io/docs/sdks/php/slim?utm_campaign=devrel&utm_medium=github&utm_source=sdks_readme)

APItoolkit is an end-to-end API and web services management toolkit for engineers and customer support teams. To integrate your Slim (PHP) application with APItoolkit, you need to use this SDK to monitor incoming traffic, aggregate the requests, and then deliver them to the APItoolkit's servers.

---

Table of Contents
-----------------

[](#table-of-contents)

- [Installation](#installation)
- [Open Telemetry Configuration](#setup-opentelemetry)
- [APItoolkit Middleware Setup](#setup-apitoolkit-middleware)
- [Contributing and Help](#contributing-and-help)
- [License](#license)

---

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

[](#installation)

Kindly run the command below to install the apitoolkit-slim sdk and otel packages:

```
composer require \
    open-telemetry/sdk \
    open-telemetry/exporter-otlp \
    open-telemetry/opentelemetry-auto-slim \
    open-telemetry/opentelemetry-auto-psr18 \
    apitoolkit/apitoolkit-slim
```

Setup Opentelemetry
-------------------

[](#setup-opentelemetry)

#### Installing opentelemetry extension

[](#installing-opentelemetry-extension)

After installing the necessary packages, you'll need to install the opentelemetry extention and add it to your `php.ini` file

```
pecl install opentelemetry
```

Then add it to your `php.ini` file like so.

```
[opentelemetry]
extension=opentelemetry.so
```

Export the following environment variables to configure the opentelemetry extension.

```
export OTEL_PHP_AUTOLOAD_ENABLED=true
export OTEL_SERVICE_NAME=your-service-name
export OTEL_TRACES_EXPORTER=otlp
export OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf
export OTEL_EXPORTER_OTLP_ENDPOINT=http://otelcol.apitoolkit.io:4318
export OTEL_RESOURCE_ATTRIBUTES="at-project-key={ENTER_YOUR_API_KEY_HERE}"
export OTEL_PROPAGATORS=baggage,tracecontext
```

Setup APItoolkit Middleware
---------------------------

[](#setup-apitoolkit-middleware)

Next, create a new instance of the `APIToolkitMiddleware` class and register the middleware with the Slim Framework in the `app/middleware.php` file. This creates a customs spans which captures and sends http request info such as headers, requests and repsonse bodies, matched route etc. for each request

```
use Slim\Factory\AppFactory;
use APIToolkit\APIToolkitMiddleware;

require __DIR__ . '/vendor/autoload.php';

$app = AppFactory::create();

$apitoolkitMiddleware = new APIToolkitMiddleware(['captureRequestBody' => true]);

$app->add($apitoolkitMiddleware);

$app->get('/', function ($request, $response) {
    $response->getBody()->write('Hello, World!');
    return $response;
});

$app->run();
```

Note

The `{ENTER_YOUR_API_KEY_HERE}` demo string should be replaced with the [API key](https://apitoolkit.io/docs/dashboard/settings-pages/api-keys?utm_campaign=devrel&utm_medium=github&utm_source=sdks_readme) generated from the APItoolkit dashboard.

Important

To learn more configuration options (redacting fields, error reporting, outgoing requests, etc.), please read this [SDK documentation](https://apitoolkit.io/docs/sdks/php/slim?utm_campaign=devrel&utm_medium=github&utm_source=sdks_readme).

Contributing and Help
---------------------

[](#contributing-and-help)

To contribute to the development of this SDK or request help from the community and our team, kindly do any of the following:

- Read our [Contributors Guide](https://github.com/apitoolkit/.github/blob/main/CONTRIBUTING.md).
- Join our community [Discord Server](https://apitoolkit.io/discord?utm_campaign=devrel&utm_medium=github&utm_source=sdks_readme).
- Create a [new issue](https://github.com/apitoolkit/apitoolkit-slim/issues/new/choose) in this repository.

License
-------

[](#license)

This repository is published under the [MIT](LICENSE) license.

---

[![](https://github.com/apitoolkit/.github/raw/main/images/icon.png?raw=true)](https://apitoolkit.io?utm_campaign=devrel&utm_medium=github&utm_source=sdks_readme)

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance43

Moderate activity, may be stable

Popularity9

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 94.1% 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 ~32 days

Recently: every ~1 days

Total

13

Last Release

487d ago

Major Versions

v1.7.0 → v2.0.02025-01-02

### Community

Maintainers

![](https://www.gravatar.com/avatar/f0795799b745c3fccb8ae09c5a4b2a65566f7b38fb0e41be002836fca0e37332?d=identicon)[apitoolkitio](/maintainers/apitoolkitio)

---

Top Contributors

[![dawkaka](https://avatars.githubusercontent.com/u/49823605?v=4)](https://github.com/dawkaka "dawkaka (32 commits)")[![BolajiAyodeji](https://avatars.githubusercontent.com/u/30334776?v=4)](https://github.com/BolajiAyodeji "BolajiAyodeji (2 commits)")

---

Tags

apitoolkitapitoolkit-sdkphpslim-frameworkrestmicroframeworkapisapitoolkit

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

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

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

PHPackages © 2026

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