Decomposer Extension for Yii 2
For license information check the LICENSE-file.
Introduction ¶
Yii 2 Decomposer decomposes and lists all the installed packages and their dependencies along with the Yii 2 Framework & the Server environment details your app is running in. All these just on the hit of a single route at your-domain/decomposer
.
The demo of this extension is available at HERE
This extension base on lubusIN/laravel-decomposer wrapper for Laravel user component.
Requirements ¶
Installation ¶
The preferred way to install this extension is through composer.
Either run
composer require thangnm93/yii2-decomposer
or add
"thangnm93/yii2-decomposer": "*"
to the require section of your composer.json
file.
Usage ¶
Once the extension is installed, simply modify your application configuration as follows:
return [
'bootstrap' => ['decomposer'],
'modules' => [
'decomposer' => [
'class' => 'thangnm93\decomposer\Module',
],
// ...
],
...
];
Config common/config/main.php
to use Yii::$app->decompose
`
php
return [
'components' => [
'decompose' => [
'class' => 'thangnm93\decomposer\Decomposer',
],
],
...
];
`
Get Report as an Array
- You might want to access the Decomposer Report in your code so that it could be passed to any third party services like Bugsnag, etc. or maybe you want to log it yourself somewhere if required.
- The
getReportArray()
helper method has been introduced to solve the same requirement. First use the Decomposer class at the top as follows:
`
php use thangnm93\decomposer\helpers\DecomposerHelper;`
Then use the
getReportArray()
helper method as follows:$decomposerStats = DecomposerHelper::getReportArray();
It returns a multi-dimensional associative array with 4 keys: Server Environment, Yii 2 Environment & Installed Packages & Extra stats(If you or a package in your app have added any) having the respective details as an associative array.
Get Report as JSON
- You might want to access the same Decomposer Report as JSON
- The
getReportJson()
helper method has been introduced to solve the same requirement. First use the Decomposer class at the top as follows:
`
php use thangnm93\decomposer\helpers\DecomposerHelper;`
Then use the
getReportJson()
helper method as follows:$decomposerStats = DecomposerHelper::getReportJson();
It returns the report as JSON
Testing ¶
$ ./vendor/bin/phpunit --testdox --coverage-text --coverage-clover=coverage.clover
Contributing ¶
Thank you for considering contributing to the Yii 2 Decomposer. You can read the contribution guide lines here
Security ¶
If you discover any security related issues, please email to contact@thangnm.info.
If you have any questions, please ask in the forum instead.
Signup or Login in order to comment.