public function generatePsr0ClassUnder($directory, array $args = array())
    {
        $code = "<?php\n" . $this->render($args);
        $classPath = $this->getPsr0ClassPath();
        $path = $directory . DIRECTORY_SEPARATOR . $classPath;
        if ($dir = dirname($path)) {
            if (!file_exists($dir)) {
                mkdir($dir, 0755, true);
            }
        }
        if (file_put_contents($path, $code) === false) {
            return false;
        }
        return $path;
    }
public function generatePsr0ClassUnder($directory, array $args = array())
    {
        $code = "<?php\n" . $this->render($args);
        $classPath = $this->getPsr0ClassPath();
        $path = $directory . DIRECTORY_SEPARATOR . $classPath;
        if ($dir = dirname($path)) {
            if (!file_exists($dir)) {
                mkdir($dir, 0755, true);
            }
        }
        if (file_put_contents($path, $code) === false) {
            return false;
        }
        return $path;
    }
public function generatePsr0ClassUnder ( $ directory , array $ args = array ( ) ) { $ code = "<?php\n" . $ this -> render ( $ args ) ; $ classPath = $ this -> getPsr0ClassPath ( ) ; $ path = $ directory . DIRECTORY_SEPARATOR . $ classPath ; if ( $ dir = dirname ( $ path ) ) { if ( ! file_exists ( $ dir ) ) { mkdir ( $ dir , 0755 , true ) ; } } if ( file_put_contents ( $ path , $ code ) === false ) { return false ; } return $ path ; }
for Foo\Bar class,

$this->generatePsr0ClassUnder('src');

will generate class at src/Foo/Bar.php
for Foo \ Bar class