PHP code example of kirschbaum-development / laravel-preflight-checks

1. Go to this page and download the library: Download kirschbaum-development/laravel-preflight-checks library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

kirschbaum-development / laravel-preflight-checks example snippets


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

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

        // ...
    ],
];

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

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

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

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

/**
 * 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);
}
bash
php artisan vendor:publish --provider="Kirschbaum\PreflightChecks\PreflightChecksServiceProvider"
bash
php artisan preflight:check
bash
#!/bin/bash
set -e

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