thangnm93/yii2-decomposer A Yii2 package to decompose your installed packages, their dependencies, your app & server environment

993323

Decomposer Extension for Yii 2

  1. Introduction
  2. Requirements
  3. Installation
  4. Usage
  5. Testing
  6. Contributing
  7. Security
  8. Credits

For license information check the LICENSE-file.

Latest Stable Version Total Downloads License PRs

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.

Credits

0 0
1 follower
17 downloads
Yii Version: 2.0
License: MIT
Category: User Interface
Developed by: Thang Nguyen
Created on: Jul 18, 2022
Last updated: 19 days ago
Packagist Profile
Github Repository

Related Extensions