public static function create($name, $type, $extension, $vendor)
    {
        // Prepare the component name
        $componentLabel = $componentName = array_pop($name);
        if (substr($componentName, -9) !== 'Component') {
            $componentName .= 'Component';
        }

        // Prepare the component directory
        $componentPath    = implode(DIRECTORY_SEPARATOR, $name);
        $componentAbsPath = GeneralUtility::getFileAbsFileName(
            'EXT:'.$extension.DIRECTORY_SEPARATOR.'Components'.DIRECTORY_SEPARATOR
            .implode(DIRECTORY_SEPARATOR, $name)
        );
        if (!is_dir($componentAbsPath) && !mkdir($componentAbsPath, 06775, true)) {
            throw new CommandException('Could not create component directory', 1507997978);
        }

        // Prepare the component namespace
        $componentNamespace = rtrim(
            $vendor.'\\'.GeneralUtility::underscoredToUpperCamelCase($extension)
            .'\\Component\\'.implode('\\', $name),
            '\\'
        );

        // Copy the skeleton template
        $substitute       = [
            '###extension###' => $extension,
            '###namespace###' => $componentNamespace,
            '###label###'     => $componentLabel,
            '###tspath###'    => strtolower(implode('.', array_merge($name, [$componentLabel]))),
            '###path###'      => $componentPath,
        ];
        $skeletonTemplate = GeneralUtility::getFileAbsFileName(
            'EXT:tw_componentlibrary/Resources/Private/Skeleton/'.ucfirst($type).'.php'
        );
        $skeletonString   = strtr(file_get_contents($skeletonTemplate), $substitute);
        $skeletonFile     = $componentAbsPath.DIRECTORY_SEPARATOR.$componentName.'.php';
        file_put_contents($skeletonFile, $skeletonString);
        chmod($skeletonFile, 0664);
    }
public static function create($name, $type, $extension, $vendor)
    {
        // Prepare the component name
        $componentLabel = $componentName = array_pop($name);
        if (substr($componentName, -9) !== 'Component') {
            $componentName .= 'Component';
        }

        // Prepare the component directory
        $componentPath    = implode(DIRECTORY_SEPARATOR, $name);
        $componentAbsPath = GeneralUtility::getFileAbsFileName(
            'EXT:'.$extension.DIRECTORY_SEPARATOR.'Components'.DIRECTORY_SEPARATOR
            .implode(DIRECTORY_SEPARATOR, $name)
        );
        if (!is_dir($componentAbsPath) && !mkdir($componentAbsPath, 06775, true)) {
            throw new CommandException('Could not create component directory', 1507997978);
        }

        // Prepare the component namespace
        $componentNamespace = rtrim(
            $vendor.'\\'.GeneralUtility::underscoredToUpperCamelCase($extension)
            .'\\Component\\'.implode('\\', $name),
            '\\'
        );

        // Copy the skeleton template
        $substitute       = [
            '###extension###' => $extension,
            '###namespace###' => $componentNamespace,
            '###label###'     => $componentLabel,
            '###tspath###'    => strtolower(implode('.', array_merge($name, [$componentLabel]))),
            '###path###'      => $componentPath,
        ];
        $skeletonTemplate = GeneralUtility::getFileAbsFileName(
            'EXT:tw_componentlibrary/Resources/Private/Skeleton/'.ucfirst($type).'.php'
        );
        $skeletonString   = strtr(file_get_contents($skeletonTemplate), $substitute);
        $skeletonFile     = $componentAbsPath.DIRECTORY_SEPARATOR.$componentName.'.php';
        file_put_contents($skeletonFile, $skeletonString);
        chmod($skeletonFile, 0664);
    }
public static function create ( $ name , $ type , $ extension , $ vendor ) { // Prepare the component name $ componentLabel = $ componentName = array_pop ( $ name ) ; if ( substr ( $ componentName , - 9 ) !== 'Component' ) { $ componentName .= 'Component' ; } // Prepare the component directory $ componentPath = implode ( DIRECTORY_SEPARATOR , $ name ) ; $ componentAbsPath = GeneralUtility :: getFileAbsFileName ( 'EXT:' . $ extension . DIRECTORY_SEPARATOR . 'Components' . DIRECTORY_SEPARATOR . implode ( DIRECTORY_SEPARATOR , $ name ) ) ; if ( ! is_dir ( $ componentAbsPath ) && ! mkdir ( $ componentAbsPath , 06775 , true ) ) { throw new CommandException ( 'Could not create component directory' , 1507997978 ) ; } // Prepare the component namespace $ componentNamespace = rtrim ( $ vendor . '\\' . GeneralUtility :: underscoredToUpperCamelCase ( $ extension ) . '\\Component\\' . implode ( '\\' , $ name ) , '\\' ) ; // Copy the skeleton template $ substitute = [ '###extension###' => $ extension , '###namespace###' => $ componentNamespace , '###label###' => $ componentLabel , '###tspath###' => strtolower ( implode ( '.' , array_merge ( $ name , [ $ componentLabel ] ) ) ) , '###path###' => $ componentPath , ] ; $ skeletonTemplate = GeneralUtility :: getFileAbsFileName ( 'EXT:tw_componentlibrary/Resources/Private/Skeleton/' . ucfirst ( $ type ) . '.php' ) ; $ skeletonString = strtr ( file_get_contents ( $ skeletonTemplate ) , $ substitute ) ; $ skeletonFile = $ componentAbsPath . DIRECTORY_SEPARATOR . $ componentName . '.php' ; file_put_contents ( $ skeletonFile , $ skeletonString ) ; chmod ( $ skeletonFile , 0664 ) ; }
Kickstart a new component

@param string $name      Component name
@param string $type      Component type
@param string $extension Host extension

@throws CommandException If the provider extension is invalid
Kickstart a new component