PHPackages                             eznix86/pest-plugin-testcontainers - 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. [DevOps &amp; Deployment](/categories/devops)
4. /
5. eznix86/pest-plugin-testcontainers

ActiveLibrary[DevOps &amp; Deployment](/categories/devops)

eznix86/pest-plugin-testcontainers
==================================

Pest plugin for testing containers

v2.0.0(3mo ago)17321↓82.1%[1 issues](https://github.com/eznix86/pest-plugin-testcontainers/issues)[1 PRs](https://github.com/eznix86/pest-plugin-testcontainers/pulls)MITPHPPHP ^8.3CI passing

Since Feb 11Pushed 2w agoCompare

[ Source](https://github.com/eznix86/pest-plugin-testcontainers)[ Packagist](https://packagist.org/packages/eznix86/pest-plugin-testcontainers)[ RSS](/packages/eznix86-pest-plugin-testcontainers/feed)WikiDiscussions main Synced yesterday

READMEChangelog (10)Dependencies (14)Versions (13)Used By (0)

Pest Plugin Testcontainers
==========================

[](#pest-plugin-testcontainers)

`eznix86/pest-plugin-testcontainers` is a Laravel-focused Pest plugin that starts containers directly from your tests.

Why use this plugin?
--------------------

[](#why-use-this-plugin)

- Test your own containers to ensure it runs smoothly with the expected behavior.
- Spin up services (Postgres, Redis, Meilisearch, MinIO, and more) in tests with minimal setup.
- Integrates with Laravel (`database`, `cache`, `scout`, `storage`) in one fluent chain.

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

[](#table-of-contents)

- [Requirements](#requirements)
- [Install](#install)
- [Quick Start (Laravel + Pest)](#quick-start-laravel--pest)
- [Function API](#function-api)
- [Laravel Helpers](#laravel-helpers)
    - [Database (`asDatabase`)](#database-asdatabase)
    - [Cache (`asCache`)](#cache-ascache)
    - [Search (`asSearch`)](#search-assearch)
    - [Storage (`asStorage`)](#storage-asstorage)
- [Expectations](#expectations)
- [API Reference](#api-reference)
- [Docker Comparison](#docker-comparison)
- [Local Development](#local-development)
- [Troubleshooting](#troubleshooting)
- [Notes](#notes)
- [Credits](#credits)

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

[](#requirements)

- PHP 8.3+
- Docker running locally
- PestPHP v4

Install
-------

[](#install)

```
composer require --dev eznix86/pest-plugin-testcontainers
```

The plugin autoloads itself and auto-registers the helper functions, expectations, and `InteractsWithContainers` trait for Pest tests.

Quick Start (Laravel + Pest)
----------------------------

[](#quick-start-laravel--pest)

### 1) Make Pest use your Laravel base test case

[](#1-make-pest-use-your-laravel-base-test-case)

`tests/Pest.php`

```
