Skip to content

Commit

Permalink
Added command to list locally installed packages
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeroen-G committed Nov 17, 2015
1 parent d6720e0 commit b327387
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
45 changes: 45 additions & 0 deletions src/PackagerListCommand.php
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);
}
}
1 change: 1 addition & 0 deletions src/PackagerServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class PackagerServiceProvider extends ServiceProvider
'JeroenG\Packager\PackagerRemoveCommand',
'JeroenG\Packager\PackagerGetCommand',
'JeroenG\Packager\PackagerGitCommand',
'JeroenG\Packager\PackagerListCommand',
];

/**
Expand Down

0 comments on commit b327387

Please sign in to comment.