PHPackages                             kirschbaum-development/laravel-preflight-checks - 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. kirschbaum-development/laravel-preflight-checks

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

kirschbaum-development/laravel-preflight-checks
===============================================

Preflight Checklist before deployment or development

0.5.0(1y ago)334.1k↓37.5%1MITPHPPHP ^8.0

Since Feb 23Pushed 1y ago14 watchersCompare

[ Source](https://github.com/kirschbaum-development/laravel-preflight-checks)[ Packagist](https://packagist.org/packages/kirschbaum-development/laravel-preflight-checks)[ Docs](https://github.com/kirschbaum-development/laravel-preflight-checks)[ RSS](/packages/kirschbaum-development-laravel-preflight-checks/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (7)Versions (12)Used By (0)

Laravel Preflight Checks
========================

[](#laravel-preflight-checks)

[![Laravel Supported Versions](https://camo.githubusercontent.com/556b8a6eacc5a5c41ef45b958491549409d0a92e8dd520fec9a771585a49536b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c61726176656c2d362e782f372e782f382e782f392e782f31302e782f31312e782d677265656e2e737667)](https://camo.githubusercontent.com/556b8a6eacc5a5c41ef45b958491549409d0a92e8dd520fec9a771585a49536b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c61726176656c2d362e782f372e782f382e782f392e782f31302e782f31312e782d677265656e2e737667)[![MIT Licensed](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)

Performs pre-flight checks to ensure configuration and setup for deployment or development.

This package is particularly useful for automated deployments where configuration is managed separately (such as containerized deployments via Docker, K8s, etc). It can also be used as a go/no-go check for setting up local and/or dev environments.

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

[](#installation)

You can install the package via composer:

```
composer require kirschbaum-development/laravel-preflight-checks
```

Setup
-----

[](#setup)

After requiring the composer package, publish the config file

```
php artisan vendor:publish --provider="Kirschbaum\PreflightChecks\PreflightChecksServiceProvider"
```

Configure the `config/preflight_checks.php` file with the configuration necessary for your app. Some defaults are provided (commented out) based on typical environments.

The config file is structured like so: `'checks'` &gt; `environment name` &gt; `array of checks`

```
return [
    'checks' => [
        'production' => [
            // Database::class,
            // Redis::class,
            // Configuration::class => [
            //     // Essential production keys here
            // ],
        ],

        'anyEnvironmentName' => [
            // Any class(es) extending Kirschbaum\PreflightChecks\Checks\PreflightCheck::class
        ],

        // ...
    ],
];
```

Every check can be specified with options, for example:

```
'production' => [
    Database::class => [
        'connection' => 'db2'
    ],
]
```

Or with the fully explicit syntax:

```
'production' => [
    [
        'check' => Database::class,
        'options' => [
            'connection' => 'db2'
        ]
    ],
]
```

If you need to repeat checks (for example, when using multiple database connections), you will need to use the full syntax.

Available Checks
----------------

[](#available-checks)

### Database

[](#database)

`Kirschbaum\PreflightChecks\Checks\Database`

Checks that the database connection can be established, via the PDO, and that the required config keys are set. It outputs some server info and version information.

OptionDescription`connection`The name of the connection in `config/database.php`### Redis

[](#redis)

`Kirschbaum\PreflightChecks\Checks\Redis`

Checks that Redis connection can be established, and that the required config keys are set.

OptionDescription`connection`The name of the connection in `config/database.php`### Configuration

[](#configuration)

`Kirschbaum\PreflightChecks\Checks\Configuration`

Checks that the specified config keys are set. This checks the `config` values, NOT the `env` values to ensure that in higher environments the correct detection is taking place. As such, make sure to specify the same keys you'd use for `config(...)`.

The accepted options for the `Configuration` preflight check is a list of config keys to check. For example:

```
'production' => [
    Configuration::class => [
        'services.payment.key',
        'services.mail.key',
        // ...
    ]
]
```

You may also pass a hint (recommended for local development only) that will be shown if the key is not set. For example:

```
'local' => [
    Configuration::class => [
        'services.payment.key' => 'In dashboard as "Super Secret API Token Key Thing"',
        'services.mail.key',
        // ...
    ]
]
```

When a new dev sets up their environment and is missing that config value, they will get that nice friendly message helping them find the key.

You can also specify optional config values and provide a hint as well with the `OptionalConfiguration` class, which operates the same way, but does not cause the command to fail.

### Write Your Own!

[](#write-your-own)

If you have a special startup consideration you'd like to make, feel free write your own check, extending `Kirschbaum\PreflightChecks\Checks\PreflightCheck`.

Specify any necessary config keys on the `$requiredConfig` property.

Implement the `check` method, which should perform your check and mark the `$result` as pass/fail.

Example:

```
/**
 * Performs the preflight check.
 *
 * This method should set a pass/fail on the result.
 */
public function check(Result $result): Result
{
    try {
        // Check something is up/ready/willing/etc
    } catch (Exception $e) {
        return $result->fail($e->getMessage(), $e);
    }

    return $result->pass('Woohoo! It didn\'t fail!', $dataFromTheCheck);
}
```

Usage
-----

[](#usage)

Basic usage is via the Artisan command:

```
php artisan preflight:check
```

If you would like to see the info on successful checks (not just the failures), add a verbose flag `-v`.

You may test other environment by specifying the artisan environment (`--env`).

For higher and/or automated environments (such as CI/CD), you may want to use the `--show-only-failures` flag to cut down on noise.

### Kubernetes

[](#kubernetes)

In Kubernetes deployments, this can be used in a startup probe (1.20+):

```
startupProbe:
  exec:
    command:
    - php
    - artisan
    - preflight:check
    - --show-only-failures
  failureThreshold: 30
  periodSeconds: 10
```

You could also set this up for a readiness probe, but keep in mind that probe is still run throughout the entire lifecycle of the container (we are establishing connections to Redis or the DB, which are not insignificant to consider).

### Containerized Environments

[](#containerized-environments)

In containerized environments (including K8s), you may want to "block" container startup (e.g. `php-fpm`) with this command, to ensure the correct environment was loaded and cached properly. For the standard `php-fpm` docker container, you can use a startup script such as:

```
#!/bin/bash
set -e

php artisan optimize
php artisan preflight:check -v
php-fpm
```

### Local Environment

[](#local-environment)

The `preflight:check` command can also provide a concrete method of assuring all the appropriate environment configuration has taken place. This can be especially helpful when bringing on new developers, as simply running `php artisan preflight:check` can give them a good indication of what's left to setup/configure before their environment is live.

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

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

### Security

[](#security)

If you discover any security related issues, please email  or  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Zack Teska](https://github.com/zerodahero)

Sponsorship
-----------

[](#sponsorship)

Development of this package is sponsored by Kirschbaum Development Group, a developer driven company focused on problem solving, team building, and community. Learn more [about us](https://kirschbaumdevelopment.com) or [join us](https://careers.kirschbaumdevelopment.com)!

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance32

Infrequent updates — may be unmaintained

Popularity31

Limited adoption so far

Community17

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

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

Recently: every ~170 days

Total

11

Last Release

693d ago

PHP version history (2 changes)0.2.0PHP ^7.4|^8.0

0.5.0PHP ^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/2eabd98e880412f6caf8e816eaa1ccddb7645724aa3b5f604addeb6273ae72c1?d=identicon)[zerodahero](/maintainers/zerodahero)

---

Top Contributors

[![zerodahero](https://avatars.githubusercontent.com/u/6423168?v=4)](https://github.com/zerodahero "zerodahero (17 commits)")[![victorsfleite](https://avatars.githubusercontent.com/u/13879052?v=4)](https://github.com/victorsfleite "victorsfleite (15 commits)")[![luisdalmolin](https://avatars.githubusercontent.com/u/403446?v=4)](https://github.com/luisdalmolin "luisdalmolin (3 commits)")[![patricksamson](https://avatars.githubusercontent.com/u/1416027?v=4)](https://github.com/patricksamson "patricksamson (3 commits)")[![eric-famiglietti](https://avatars.githubusercontent.com/u/751204?v=4)](https://github.com/eric-famiglietti "eric-famiglietti (1 commits)")

---

Tags

laravel

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/kirschbaum-development-laravel-preflight-checks/health.svg)

```
[![Health](https://phpackages.com/badges/kirschbaum-development-laravel-preflight-checks/health.svg)](https://phpackages.com/packages/kirschbaum-development-laravel-preflight-checks)
```

###  Alternatives

[timokoerber/laravel-one-time-operations

Run operations once after deployment - just like you do it with migrations!

6481.7M11](/packages/timokoerber-laravel-one-time-operations)[spatie/laravel-prometheus

Export Laravel metrics to Prometheus

2651.3M6](/packages/spatie-laravel-prometheus)[thebytelab/vapor-multi-region-deploy

An artisan command to assist deploying your Laravel Vapor app to multiple AWS regions

162.2k](/packages/thebytelab-vapor-multi-region-deploy)

PHPackages © 2026

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