Skip to content

Commit

Permalink
Quick dependency fix
Browse files Browse the repository at this point in the history
  • Loading branch information
introwit committed Mar 2, 2017
1 parent 19d04ac commit b5ea685
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,14 @@

Laravel Decomposer decomposes and lists all the installed packages and their dependencies along with the Laravel & the Server environment details your app is running in. Decomposer also generates a [markdown report](https://github.com/lubusIN/laravel-decomposer/blob/master/report.md) from those details that can be used for troubleshooting purposes. All these just on the hit of a single route as shown below in the gif. This package aims to solve the following hassles:

- This can be used by your non-tech client/user of your laravel app or non-experienced dev who still dosen't uses CLI to generate the system report & send over to you so you can know the entire details of his environment.
- To see the list of all installed packages & their dependencies in the laravel app directly from the browser
- To get the Laravel & Server environment details on the same page with the packages list
- To check whether all the pre configurations & extensions asked by Laravel are applied and loaded or not
- Suppose suddenly or after some changes your app broke, you can install Laravel Decomposer, generate & copy the [report](https://github.com/lubusIN/laravel-decomposer/blob/master/report.md) and paste it in the issue box of the respective repo you are reporting the issue to.
- For package/laravel app developers this can be very useful when collecting the information from the users reporting the issues. As the report gives them complete info about the environment the issue is being raised in.
- It can also help you in other ways like suppose you have a package installed that is using illuminate/support v5.1, and an another package using illuminate/support v5.3, so getting these facts quickly by just hitting to a route can make you aware of possible unstability & conflicts so you can report that to the respective package developer.
- It cuts down the troubleshooting time. For eg: Sometimes after trying all possible solutions at the end the user says 'I forgot to say I am on PHP 4'. Here Decomposer acts as the precaution & removes the dependency of querying the user for every single thing.

**Screenshot**

Expand Down
7 changes: 4 additions & 3 deletions src/controllers/DecomposerController.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public function index()
$json = file_get_contents(base_path('composer.json'));
$composerArray = json_decode($json, true);
$packagesArray = $composerArray['require'];
$DevPackagesArray = $composerArray['require-dev'];

foreach ($packagesArray as $key => $value) {
if ($key !== 'php') {
Expand All @@ -30,7 +31,7 @@ public function index()
}
}

$laravelEnv = $this->getLaravelEnv($packagesArray);
$laravelEnv = $this->getLaravelEnv($packagesArray,$DevPackagesArray);

$serverEnv = $this->getServerEnv();

Expand All @@ -42,15 +43,15 @@ public function index()
* @return array
*/

private function getLaravelEnv($packagesArray)
private function getLaravelEnv($packagesArray,$DevPackagesArray)
{
return [
'version' => App::version(),
'timezone' => config('app.timezone'),
'debug_mode' => config('app.debug'),
'storage_dir_writable' => is_writable(base_path('storage')),
'cache_dir_writable' => is_writable(base_path('bootstrap/cache')),
'decomposer_version' => $packagesArray['lubusin/laravel-decomposer'],
'decomposer_version' => isset($packagesArray['lubusin/laravel-decomposer']) ? $packagesArray['lubusin/laravel-decomposer'] : $DevPackagesArray['lubusin/laravel-decomposer'],
'app_size' => $this->sizeFormat($this->folderSize(base_path()))
];
}
Expand Down
4 changes: 3 additions & 1 deletion src/views/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@
#txt-report {
margin: 10px 0;
}
#report-wrapper {
display: none;
}
</style>
</head>
<body>
Expand Down Expand Up @@ -199,7 +202,6 @@
s = s.replace(/\n /,"\n");
document.getElementById("txt-report").value = s;
$("#report-wrapper").hide();
$('#btn-report').on('click', function() {
$("#report-wrapper").slideToggle();
});
Expand Down

0 comments on commit b5ea685

Please sign in to comment.