public function createPackageName($projectName)
    {
        if (!empty($_SERVER['USERNAME'])) {
            $packageName = $_SERVER['USERNAME'].'/'.$projectName;
        } elseif (true === extension_loaded('posix') && $user = posix_getpwuid(posix_getuid())) {
            $packageName = $user['name'].'/'.$projectName;
        } elseif (get_current_user()) {
            $packageName = get_current_user().'/'.$projectName;
        } else {
            // package names must be in the format foo/bar
            $packageName = $projectName.'/'.$projectName;
        }

        return $this->fixPackageName($packageName);
    }
public function createPackageName($projectName)
    {
        if (!empty($_SERVER['USERNAME'])) {
            $packageName = $_SERVER['USERNAME'].'/'.$projectName;
        } elseif (true === extension_loaded('posix') && $user = posix_getpwuid(posix_getuid())) {
            $packageName = $user['name'].'/'.$projectName;
        } elseif (get_current_user()) {
            $packageName = get_current_user().'/'.$projectName;
        } else {
            // package names must be in the format foo/bar
            $packageName = $projectName.'/'.$projectName;
        }

        return $this->fixPackageName($packageName);
    }
public function createPackageName ( $ projectName ) { if ( ! empty ( $ _SERVER [ 'USERNAME' ] ) ) { $ packageName = $ _SERVER [ 'USERNAME' ] . '/' . $ projectName ; } elseif ( true === extension_loaded ( 'posix' ) && $ user = posix_getpwuid ( posix_getuid ( ) ) ) { $ packageName = $ user [ 'name' ] . '/' . $ projectName ; } elseif ( get_current_user ( ) ) { $ packageName = get_current_user ( ) . '/' . $ projectName ; } else { // package names must be in the format foo/bar $ packageName = $ projectName . '/' . $ projectName ; } return $ this -> fixPackageName ( $ packageName ) ; }
Generates a good Composer project name based on the application name
and on the user name.

@param $projectName

@return string The generated Composer package name
Generates a good Composer project name based on the application name and on the user name .