-
-
Notifications
You must be signed in to change notification settings - Fork 42
Add your extra stats
You can now add your app & package specific custom extra stats to the decomposer report. Any suggestions are welcome to improve this process :)
-
Add the following in your
app/providers/AppServiceProvider's boot() method
after completing Decomposer's installation process -
At the top use:
use Lubusin\Decomposer\Decomposer;
- Then in the
boot()
method you can do:
public function boot()
{
$myArray = [
'DC Extension' => true,
'Some version' => 'v 2.3',
];
Decomposer::addLaravelStats($myArray); // Add to the already existing 'Laravel Env' block
Decomposer::addServerStats($myArray); // Add to the already existing 'Server Env' block
Decomposer::addExtraStats($myArray); // A new block 'Extra Info' will be added containing it
}
- All the 3 methods accept an associative array that will be added to the report, markdown, array & JSON everywhere.
- You may want to form an associative array with the respective logic applied for the respective checks you want to add first somewhere and then just pass it to any 1 of the method as shown, rather than creating it on run time dynamically.
If you are a Laravel package developer and want to add extra stats specifically for your package, for example your package needs a certain extension enabled or check the minimum PHP requirement is meant you can define and append those stats in the Decomposer report so that any user reporting any issue can give you the markdown in the issue section cutting down the extra time it takes in troubleshooting. The steps are as follows:
-
Pull in Decomposer as the dependency in your package using the installation steps
-
In your
package's service provider
add the following at the top
use Lubusin\Decomposer\Decomposer;
- Then in the
boot()
method of your package's service provider add the following:
public function boot()
{
$myArray = [
'DC Extension' => true,
'Some version' => 'v 2.3',
];
Decomposer::addLaravelStats($myArray); // Add to the already existing 'Laravel Env' block
Decomposer::addServerStats($myArray); // Add to the already existing 'Server Env' block
Decomposer::addExtraStats($myArray); // A new block 'Extra Info' will be added containing it
}
- All the 3 methods accepts an associative array that will be added to the report, markdown, array & JSON everywhere.
- You may want to form an associative array with the respective logic applied for the respective checks you want to add first somewhere and then just pass it to any 1 of the method as shown, rather than creating it on run time dynamically.
NEXT: Get Report as Markdown