PHPackages                             jonpitch/laxative - 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. [Database &amp; ORM](/categories/database)
4. /
5. jonpitch/laxative

ActiveLibrary[Database &amp; ORM](/categories/database)

jonpitch/laxative
=================

A Codeception extension for facilitating easy dumps.

v1.0.0(10y ago)2281MITPHPPHP &gt;=5.4.0

Since Jun 20Pushed 10y ago1 watchersCompare

[ Source](https://github.com/jonpitch/laxative)[ Packagist](https://packagist.org/packages/jonpitch/laxative)[ Docs](https://github.com/site5/phantoman)[ RSS](/packages/jonpitch-laxative/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (1)Versions (2)Used By (0)

Laxative
========

[](#laxative)

A [Codeception](http://codeception.com/) extension to easily manage dump files from the [Db](http://codeception.com/docs/modules/Db) Module.

What It Does
------------

[](#what-it-does)

Laxative makes managing the dump file from the Codeception Db module a snap. It's particularly useful for teams with rapidly changing data models. Laxative eliminates the need for developers maintaining the dump file by always starting from scratch. Laxative will use the developers local codebase to create a fresh database for testing.

Minimum Requirements
--------------------

[](#minimum-requirements)

- Codeception 1.6.4
- PHP 5.4

Installation using [Composer](https://getcomposer.org)
------------------------------------------------------

[](#installation-using-composer)

```
$ composer require jonpitch/laxative
```

Be sure to enable the extension in `codeception.yml` as shown in [configuration](#configuration) below.

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

[](#configuration)

All enabling and configuration is done in `codeception.yml`.

### Enabling Laxative

[](#enabling-laxative)

```
extensions:
    enabled:
        - Codeception\Extension\Laxative
    config:
      Codeception\Extension\Laxative:
        backup: true|false
        backup_path: 'path/to/your/backup/file.backup'
        host: 'database host IP|URL'
        database: 'database-name'
        login: 'database-login'
        migrations: 'your migrate command'
        seed: 'your seed command'
```

### Create An Empty Database

[](#create-an-empty-database)

Laxative needs a consistent point to start from. The easiest way to do this is to leverage the Codeception Db module to do this for us.

- Create an empty database
- Create a dump file, for example: `pg_dump -h 192.168.10.10 -d my-database -U my-user`
- Configure your Codeception Db module to use this empty database

### Available options

[](#available-options)

#### Basic

[](#basic)

- `backup: {backup}`
    - Enable backup and restore your database before and after a suite runs.
    - Default: false
- `backup_path: {backup_path}`
    - Relative path to store your database backup.
    - Default: `tests/_data/local.backup`
- `host: {host}`
    - The location of your database.
    - Example: '192.168.1.10'
- `database: {database}`
    - The name of your database.
- `login: {login}`
    - The database user login.
- `migrations: {migrations}`
    - A command to execute database migrations.
    - Example: 'php artisan migrate'
- `seed: {seed}`
    - A command to populate your database with data.
    - Example: 'php artisan db:seed'

Usage
-----

[](#usage)

Once installed and enabled, before and after any suite with the Db module enabled, Laxative will:

- Backup your local database (if enabled)
- Use Codeception Db to restore from your empty database (see above)
- Run your migrations command
- Run your seed command
- Re-configure your Db module to use the fresh dump file.

Your tests will then run as normal from a fresh database. If you have the `backup` option enabled, when the suite is finished your database will be restored to how it was before the tests.

Note(s)
-------

[](#notes)

- For now, Laxative is specific to Postgres. If you require something different, issue a pull request or send me an email.

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity58

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

Unknown

Total

1

Last Release

3985d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/3db0f664e663eb50a44835bf624d94504dedda738a8f8cdbb600de31bd34121d?d=identicon)[jonpitch](/maintainers/jonpitch)

---

Top Contributors

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

---

Tags

codeceptiondatabasedumpextension

### Embed Badge

![Health badge](/badges/jonpitch-laxative/health.svg)

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

###  Alternatives

[spatie/db-dumper

Dump databases

1.2k25.9M69](/packages/spatie-db-dumper)[rah/danpu

Zero-dependency MySQL dump library for easily exporting and importing databases

64401.8k10](/packages/rah-danpu)[dmstr/yii2-db

Database extensions

19618.8k6](/packages/dmstr-yii2-db)[hzhihua/yii2-dump

Generate the schema from an existing database

1828.5k1](/packages/hzhihua-yii2-dump)

PHPackages © 2026

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