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

ActiveLibrary

laravel-bridge/slim
===================

The Laravel Bridge use on Slim framework

v1.1.0(5y ago)63691MITPHPPHP ^7.1CI failing

Since Jun 18Pushed 5y ago3 watchersCompare

[ Source](https://github.com/laravel-bridge/slim)[ Packagist](https://packagist.org/packages/laravel-bridge/slim)[ RSS](/packages/laravel-bridge-slim/feed)WikiDiscussions master Synced today

READMEChangelog (10)Dependencies (18)Versions (16)Used By (0)

[![](docs/logo.svg)](docs/logo.svg)

Laravel Bridge for Slim Framework
=================================

[](#laravel-bridge-for-slim-framework)

[![tests](https://github.com/laravel-bridge/slim/workflows/tests/badge.svg)](https://github.com/laravel-bridge/slim/workflows/tests/badge.svg)[![codecov](https://camo.githubusercontent.com/5793ed6421278c6fbcaf239014b782b6a7e8f616cecdafca454e373651b0fe3d/68747470733a2f2f636f6465636f762e696f2f67682f6c61726176656c2d6272696467652f736c696d2f6272616e63682f6d61737465722f67726170682f62616467652e737667)](https://codecov.io/gh/laravel-bridge/slim)[![codecov](https://camo.githubusercontent.com/93e9a498533af92ea3b6649689d818de0c653f3e64b76d441205e2aa0bda89b0/68747470733a2f2f6170692e636f646163792e636f6d2f70726f6a6563742f62616467652f47726164652f3163373433623761653634643435373961663137393866303834306130643065)](https://www.codacy.com/gh/laravel-bridge/slim)[![Latest Stable Version](https://camo.githubusercontent.com/0a837fd6e8f0b7ef6a64f7440f09d21ef8749b782826613dc11821db4f82bfd4/68747470733a2f2f706f7365722e707567782e6f72672f6c61726176656c2d6272696467652f736c696d2f762f737461626c65)](https://packagist.org/packages/laravel-bridge/slim)[![Total Downloads](https://camo.githubusercontent.com/1bcf05e8fb963fa4e9c4b3bd86c738ff9763aaf1a869449a8ffef9bb393bf637/68747470733a2f2f706f7365722e707567782e6f72672f6c61726176656c2d6272696467652f736c696d2f646f776e6c6f616473)](https://packagist.org/packages/laravel-bridge/slim)[![License](https://camo.githubusercontent.com/bfbf655354063089e72b4cecaf60e0e92ac2ee497ea998e7b58a4f25fedcca87/68747470733a2f2f706f7365722e707567782e6f72672f6c61726176656c2d6272696467652f736c696d2f6c6963656e7365)](https://packagist.org/packages/laravel-bridge/slim)

The bridge for Laravel in Slim framework

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

[](#installation)

Using Composer to install package:

```
composer require laravel-bridge/slim
```

### Using array as container

[](#using-array-as-container)

App params is array, like following code.

```
use Slim\App;

$container = [
    SomeClass::class => function() {},
]

$app = new App($container);
```

Replace class name `Slim\App` to bridge class [`LaravelBridge\Slim\App`](/src/App.php):

```
// Rename use class
use LaravelBridge\Slim\App;
```

It will work on most Slim project. Here has an [example](https://github.com/laravel-bridge/slim-example/tree/using-laravel-bridge) for more detail.

### Using Container

[](#using-container)

App params is Container, like following code.

```
use Slim\App;
use Slim\Container;

$container = new Container();
$container[SomeClass::class] = function() {};

$app = new App($container);
```

Use [`ContainerBuilder`](/src/ContainerBuilder.php) is good for this case. The builder will build an instance of [Scratch Application](https://github.com/laravel-bridge/scratch).

```
use LaravelBridge\Slim\ContainerBuilder;
use Slim\App;

$containerBuilder = new ContainerBuilder();

// Use builder mixin the Scratch Application / Laravel Container
$containerBuilder->singleton(SomeClass::class, function() {});

$containerBuilder->setupDatabase($conncetion)
    ->setupProvider(YourProvider::class);

// Register provider for Slim Framework
$containerBuilder
    ->useLaravelFoundHandler()
    ->useLaravelHttp();

// Build Container and bootstrap
$container = $containerBuilder->buildAndBootstrap();

$app = new App($container);
```

Alternatively, ContainerBuilder can use Pimple / Slim container, too.

```
use LaravelBridge\Slim\ContainerBuilder;
use Slim\App;
use Slim\Container;

$slimContainer = new Container();
$slimContainer['foo'] = 'bar';

$containerBuilder = new ContainerBuilder($slimContainer);

// Build Container and bootstrap
$container = $containerBuilder->buildAndBootstrap();

$container->make('foo') // Will return 'bar'
```

Using Laravel Services
----------------------

[](#using-laravel-services)

`LaravelBridge\Slim\App` will use the Slim default service (e.g. `Slim\Handlers\Error`). If you want to use the Laravel Error handler, you can set the second argument. It will use all Laravel service defined in this bridge.

```
use LaravelBridge\Slim\App;

$app = new App([], true);
```

ContainerBuilder is like Bridge App:

```
use LaravelBridge\Slim\ContainerBuilder;

$app = new ContainerBuilder([], true);
```

### `foundHandler`

[](#foundhandler)

The `foundHandler` in Slim is invoke when the route found.

This bridge implements a auto injection handler for call a callable, names [`RequestResponse`](/src/Handlers/Strategies/RequestResponse.php). Use Laravel Service or call `ContainerBuilder::useLaravelFoundHandler()` can enable handler.

```
$container = (new ContainerBuilder())
    ->useLaravelFoundHandler()
    ->buildAndBootstrap();

$app = new App($container);

$app->get('/', function (IlluminateRequest $request, $args) {
    // Auto-inject Illuminate Request in clousre
});
```

### `callableResolver`

[](#callableresolver)

This bridge implements a auto injection handler for new controller, names [`CallableResolver`](/src/CallableResolver.php). Use Laravel Service or call `ContainerBuilder::useLaravelCallableResolver()` to enable.

```
class SomeController
{
    public function __construct(Dep $dep) {}

    public function __invoke() {}

    public function view() {}
}

$container = (new ContainerBuilder())
    ->useLaravelCallableResolver()
    ->buildAndBootstrap();

$app = new App($container);

// Will call SomeController::__invoke()
$app->get('/', 'SomeController');

// Will call SomeController::view()
$app->get('/', 'SomeController:view');
```

### `settings`

[](#settings)

Laravel Bridge use the `Collection` class default. [Using Laravel Services](#using-laravel-services) or call `useLaravelSettings()` method on ContainerBuilder will use the `Illuminate\Config\Repository` class.

```
$container = (new ContainerBuilder())
    ->setSettings(['foo' => 'bar'])
    ->useLaravelSettings()
    ->buildAndBootstrap();

// Return a Repository instance
$container->get('settings');
```

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 96.3% 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 ~35 days

Recently: every ~58 days

Total

15

Last Release

2021d ago

Major Versions

v0.7.0 → v1.0.02020-03-11

PHP version history (2 changes)v0.1.0PHP &gt;=5.5

v0.2.0PHP ^7.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/20872dcc4b888075f03819d5470db8198ffcc5f9edb791aba5f007e34355a6c9?d=identicon)[MilesChou](/maintainers/MilesChou)

---

Top Contributors

[![MilesChou](https://avatars.githubusercontent.com/u/1258752?v=4)](https://github.com/MilesChou "MilesChou (77 commits)")[![kimisme9386](https://avatars.githubusercontent.com/u/7465652?v=4)](https://github.com/kimisme9386 "kimisme9386 (1 commits)")[![minchao](https://avatars.githubusercontent.com/u/3313639?v=4)](https://github.com/minchao "minchao (1 commits)")[![ycs77](https://avatars.githubusercontent.com/u/38133356?v=4)](https://github.com/ycs77 "ycs77 (1 commits)")

---

Tags

laravelslim-framework

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[laravel/passport

Laravel Passport provides OAuth2 server support to Laravel.

3.4k85.0M531](/packages/laravel-passport)[illuminate/database

The Illuminate Database package.

2.8k52.4M9.3k](/packages/illuminate-database)[moonshine/moonshine

Laravel administration panel

1.3k217.1k59](/packages/moonshine-moonshine)[drupal/core-recommended

Locked core dependencies; require this project INSTEAD OF drupal/core.

6939.5M342](/packages/drupal-core-recommended)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

255.2k](/packages/aedart-athenaeum)[illuminate/mail

The Illuminate Mail package.

5910.1M391](/packages/illuminate-mail)

PHPackages © 2026

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