mazahaler / project-connection-checker
The extension allows to check connection to db, mail operation and secrets.json for compliance
Installs: 70
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 1
Forks: 0
Open Issues: 0
Type:extension
Requires
- php: >=7.4
- yiisoft/yii2: ~2.0.0
This package is auto-updated.
Last update: 2024-09-12 14:30:22 UTC
README
The extension allows to check for compliance secrets.json file and secrets in the project. The extension also allows to check db connections and mailing.
Requirements:
- PHP 7.4. and higher;
- Yii 2.0. and higher.
Installation:
The preferred way to install this extension is through composer.
Either run
php composer.phar require --prefer-dist mazahaler/project-connection-checker
or add
"mazahaler/project-connection-checker": "*"
to the require section of your composer.json.
Usage:
<?php use mazahaler\ProjectConnectionChecker\ProjectConnectionChecker; /** * Check secrets, db connections and mailing * @param 1: Root path of the project * @param 2: Path to secrets.json * @param 3: \yii\swiftmailer\Mailer class * @param 4: Array of db connections in format: ['Your connection title(used for error output)' => [Instance of \yii\db\Connection | \yii\mongodb\Connection]] */ ProjectConnectionChecker::checkAll(\Yii::getAlias('@app'), \Yii::getAlias('@app') . '/secrets/secrets.json', \Yii::$app->mailer, ['mysql' => [\Yii::$app->db], 'mongodb' => [\Yii::$app->mongodb]]); // OR check it separately: ProjectConnectionChecker::checkSecrets(\Yii::getAlias('@app'), \Yii::getAlias('@app') . '/secrets/secrets.json'); ProjectConnectionChecker::checkMailing(\Yii::$app->mailer); ProjectConnectionChecker::checkConnections(['mysql' => [\Yii::$app->db], 'mongodb' => [\Yii::$app->mongodb]]);