From b5ea685bde05dc45679d6102eae4230e0c0b6fb9 Mon Sep 17 00:00:00 2001 From: Harish Date: Thu, 2 Mar 2017 18:52:00 +0530 Subject: [PATCH] Quick dependency fix --- README.md | 2 ++ src/controllers/DecomposerController.php | 7 ++++--- src/views/index.blade.php | 4 +++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 80ef34a..f7ff3a2 100644 --- a/README.md +++ b/README.md @@ -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** diff --git a/src/controllers/DecomposerController.php b/src/controllers/DecomposerController.php index 6e30d06..4c3211b 100644 --- a/src/controllers/DecomposerController.php +++ b/src/controllers/DecomposerController.php @@ -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') { @@ -30,7 +31,7 @@ public function index() } } - $laravelEnv = $this->getLaravelEnv($packagesArray); + $laravelEnv = $this->getLaravelEnv($packagesArray,$DevPackagesArray); $serverEnv = $this->getServerEnv(); @@ -42,7 +43,7 @@ public function index() * @return array */ - private function getLaravelEnv($packagesArray) + private function getLaravelEnv($packagesArray,$DevPackagesArray) { return [ 'version' => App::version(), @@ -50,7 +51,7 @@ private function getLaravelEnv($packagesArray) '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())) ]; } diff --git a/src/views/index.blade.php b/src/views/index.blade.php index 6a535be..b591930 100644 --- a/src/views/index.blade.php +++ b/src/views/index.blade.php @@ -51,6 +51,9 @@ #txt-report { margin: 10px 0; } + #report-wrapper { + display: none; + } @@ -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(); });