PHP code example of alexeevdv / yii2-health

1. Go to this page and download the library: Download alexeevdv/yii2-health 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/ */

    

alexeevdv / yii2-health example snippets


//...
    'modules' => [
        'health' => [
            'class' => alexeevdv\yii\health\Module::class,
            'components' => [
                'database' => alexeevdv\yii\health\components\Database::class,
                'queue' => [
                    'class' => alexeevdv\yii\health\components\Queue::class,
                    'failoverTimeout' => 600, // default is 300
                ],
            ],
        ],
    ],
    'components' => [
        // ...
            'queue' => [
                // Add this to enable last executed job timestamp logging
                'as health' => alexeevdv\yii\health\behaviors\QueueBehavior::class,
            ],
            'urlManager' => [
                'rules' => [
                    // Add url rule to access health status report
                    'api/v1/health' => '/health',
                ],
            ],
        // ...
        
    ],
//...


php composer.phar