Skip to content


Allow for namespace prefixes in CLI commands #446

merged 1 commit into from

2 participants


This resolves an issue I had where when using a prefix on the default app, li3 saw the command (and listed it in the help) but couldn't call it.

The replicate, create a command at:

extensions/command/Foo.php that looks like:

namespace foo\bar\baz;

class Foo extends extends \lithium\console\Command {
    public function run() {
        echo "hello world";

Then add to bootstrap/libraries.php:

Libraries::add('qux', array(
    'prefix' => 'foo\bar\baz\\',
    'default' => true,

If you then call li3 it will list the foo command, but when you try to run it with li3 foo it will return: Command 'Foo' not found.

@nateabele nateabele merged commit 5c1a903 into UnionOfRAD:dev
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on May 2, 2012
  1. @dshafik

    Allow for namespace prefixes

    dshafik committed
Showing with 2 additions and 2 deletions.
  1. +2 −2 core/Libraries.php
4 core/Libraries.php
@@ -843,7 +843,7 @@ protected static function _locateDeferred($defer, $paths, $params, array $option
foreach (static::_searchPaths($paths, $library, $params) as $tpl) {
- $params['library'] = $library;
+ $params['library'] = rtrim($config['prefix'], '\\');
$class = str_replace('\\*', '', String::insert($tpl, $params));
if (file_exists($file = Libraries::path($class, $options))) {
@@ -1055,4 +1055,4 @@ protected static function _params($type, $name = "*") {
Something went wrong with that request. Please try again.