PHP code example of brightnucleus / boilerplate

1. Go to this page and download the library: Download brightnucleus/boilerplate library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

brightnucleus / boilerplate example snippets


protected static function getExtraKey()
{
    return 'brightnucleus-boilerplate';
}

$placeholders = [
    // [...]
    // The placeholder tag that Mustache will look for.
    'greeting'      => [
        // The name of the placeholder displayed when the user is asked for values.
        'name'        => 'Greeting',
        // The description of the placeholder displayed when the user is asked for values.
        'description' => 'The greeting you want to send within your HelloWorld app.',
        // The validation callable that will either return the validate value or throw an exception.
        'validation'  => function ($placeholder) { return Validation::validateTrimmed($placeholder); },
        // The default value to use if the user doesn't provide one.
        'default'     => 'Hello World',
    ],
];

interface SetupTask
{

    /**
     * Get the name of the current task.
     *
     * @since 0.1.0
     *
     * @return string Name of the task.
     */
    public function getName();

    /**
     * Complete the setup task.
     *
     * @since 0.1.0
     *
     * @return void
     */
    public function complete();
}

 namespace BrightNucleus\Boilerplate\Scripts\Task;

/**
* Class DisplayBoilerplateLogo.
*
* @since   0.1.0
*
* @package BrightNucleus\Boilerplate\Scripts\Task
* @author  Alain Schlesser <[email protected]>
*/
class DisplayBoilerplateLogo extends AbstractTask
{

    /**
    * Complete the setup task.
    *
    * @since 0.1.0
    *
    * @return void
    */
    public function complete()
    {
        $logo = <<<LOGO
         ____        _ _                 _       _
        | __ )  ___ (_) | ___ _ __ _ __ | | __ _| |_ ___
        |  _ \ / _ \| | |/ _ \ '__| '_ \| |/ _` | __/ _ \
        | |_) | (_) | | |  __/ |  | |_) | | (_| | |_  __/
        |____/ \___/|_|_|\___|_|  | .__/|_|\__,_|\__\___|
                                  |_|
LOGO;

        $this->io->write("<info>$logo</info>");
    }
}

 namespace BrightNucleus\Boilerplate\Scripts;

class Setup
{

    // [...]

    protected static function getSetupTasks(Event $event)
    {
        return [
            DisplayBoilerplateLogo::class, // <-- We've added our new task step here.
            AskAboutProjectParameters::class,
            VerifyProjectParameters::class,
            RemoveExistingRootFiles::class,
            ReplacePlaceholdersInTemplateFiles::class,
            MoveTemplateFilesToRootFolder::class,
            RemoveConfigFolder::class,
            RemoveTemplatesFolder::class,
            RemoveOriginalVCSData::class,
            InitializeVCS::class,
        ];
    }
}