PHPackages                             bentools/pest-symfony-kernel - 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. [Testing &amp; Quality](/categories/testing)
4. /
5. bentools/pest-symfony-kernel

ActiveLibrary[Testing &amp; Quality](/categories/testing)

bentools/pest-symfony-kernel
============================

Symfony Kernel and dependency injection for Pest

1.2.1(4mo ago)23.6k↓62.9%1MITPHPPHP &gt;=8.2CI passing

Since Jun 3Pushed 4mo ago1 watchersCompare

[ Source](https://github.com/bpolaszek/pest-symfony-kernel)[ Packagist](https://packagist.org/packages/bentools/pest-symfony-kernel)[ RSS](/packages/bentools-pest-symfony-kernel/feed)WikiDiscussions main Synced yesterday

READMEChangelog (4)Dependencies (7)Versions (7)Used By (1)

Symfony DI Container for Pest
=============================

[](#symfony-di-container-for-pest)

[![Tests](https://github.com/bpolaszek/pest-symfony-kernel/actions/workflows/tests.yml/badge.svg)](https://github.com/bpolaszek/pest-symfony-kernel/actions/workflows/tests.yml)[![Old Symfony Versions](https://github.com/bpolaszek/pest-symfony-kernel/actions/workflows/tests-old-versions.yml/badge.svg)](https://github.com/bpolaszek/pest-symfony-kernel/actions/workflows/tests-old-versions.yml)[![Coverage](https://camo.githubusercontent.com/8cf45391c5b14b6028da6bb93877beccb01df87925a2989003c81f6ce3781a3e/68747470733a2f2f636f6465636f762e696f2f67682f62706f6c61737a656b2f706573742d73796d666f6e792d6b65726e656c2f6272616e63682f6d61696e2f67726170682f62616467652e737667)](https://codecov.io/gh/bpolaszek/pest-symfony-kernel)

Symfony Kernel and dependency injection for [Pest PHP](https://pestphp.com/).

This library provides a simple way to access the Symfony kernel, container, and services in your Pest tests, making it easier to write integration tests for Symfony applications.

Requirements
------------

[](#requirements)

- PHP 8.2+
- Pest PHP 2.35+, 3.0+ or 4.0+
- Symfony 6.4+ or 7.x

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

[](#installation)

```
composer require --dev bentools/pest-symfony-kernel
```

Usage
-----

[](#usage)

```
use Symfony\Component\Routing\RouterInterface;
use function BenTools\Pest\Symfony\inject;

it('injects my router! 🤯', function () {
    $router = inject(RouterInterface::class); // Fetch router from the service container
    expect($router)->toBeInstanceOf(RouterInterface::class); // ✨
});
```

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

[](#how-it-works)

This library provides three main functions under the `BenTools\Pest\Symfony` namespace:

1. `app()`: Creates and returns a Symfony kernel instance for testing
2. `container()`: Gets the test service container from the kernel
3. `inject()`: Retrieves a service from the container by its ID

These functions make it easier to work with Symfony's dependency injection container in Pest tests, allowing for simpler access to the application kernel, container, and services.

Contributing
------------

[](#contributing)

Contributions are welcome! Please feel free to submit a Pull Request.

1. Fork the repository
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
3. Commit your changes (`git commit -m 'Add some amazing feature'`)
4. Push to the branch (`git push origin feature/amazing-feature`)
5. Open a Pull Request

License
-------

[](#license)

MIT.

###  Health Score

44

—

FairBetter than 90% of packages

Maintenance74

Regular maintenance activity

Popularity24

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 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 ~82 days

Total

4

Last Release

147d ago

### Community

Maintainers

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

---

Top Contributors

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

###  Code Quality

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/bentools-pest-symfony-kernel/health.svg)

```
[![Health](https://phpackages.com/badges/bentools-pest-symfony-kernel/health.svg)](https://phpackages.com/packages/bentools-pest-symfony-kernel)
```

###  Alternatives

[easycorp/easyadmin-bundle

Admin generator for Symfony applications

4.3k17.9M388](/packages/easycorp-easyadmin-bundle)[symfony/web-profiler-bundle

Provides a development tool that gives detailed information about the execution of any request

2.3k160.5M1.2k](/packages/symfony-web-profiler-bundle)[rcsofttech/audit-trail-bundle

Enterprise-grade, high-performance Symfony audit trail bundle. Automatically track Doctrine entity changes with split-phase architecture, multiple transports (HTTP, Queue, Doctrine), and sensitive data masking.

1189.8k](/packages/rcsofttech-audit-trail-bundle)[2lenet/crudit-bundle

The easy like Crud'it Bundle.

1616.4k14](/packages/2lenet-crudit-bundle)

PHPackages © 2026

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