-
Notifications
You must be signed in to change notification settings - Fork 189
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added command to list locally installed packages
- Loading branch information
Showing
2 changed files
with
46 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?php | ||
|
||
namespace JeroenG\Packager; | ||
|
||
use Illuminate\Console\Command; | ||
|
||
/** | ||
* Get an existing package from a remote Github repository with its git repository. | ||
* | ||
* @package Packager | ||
* @author JeroenG | ||
* | ||
**/ | ||
class PackagerListCommand extends Command | ||
{ | ||
/** | ||
* The name and signature of the console command. | ||
* | ||
* @var string | ||
*/ | ||
protected $signature = 'packager:list'; | ||
|
||
/** | ||
* The console command description. | ||
* | ||
* @var string | ||
*/ | ||
protected $description = 'List all locally installed packages.'; | ||
|
||
/** | ||
* Execute the console command. | ||
* | ||
* @return mixed | ||
*/ | ||
public function handle() | ||
{ | ||
$composer = json_decode(file_get_contents('composer.json'), true); | ||
foreach ($composer['autoload']['psr-4'] as $package => $path) { | ||
$packages[] = [rtrim($package, '\\'), $path]; | ||
} | ||
$headers = ['Package', 'Path']; | ||
|
||
$this->table($headers, $packages); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters