Download the PHP package brightnucleus/boilerplate without Composer

On this page you can find all versions of the php package brightnucleus/boilerplate. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package boilerplate

Bright Nucleus Boilerplate

Latest Stable Version Total Downloads Latest Unstable Version License

Boilerplate package you can use to quickly create a new package from scratch.

Table Of Contents

Basic Usage

To create a new package using composer, use the following command:

This will create a new folder called <package-folder>, clone the brightnucleus/boilerplate package into that folder, and run the setup scripts. These scripts will ask you several questions about the package you want to create.

Customizing The Generated Boilerplate

If you want to use this package for your own purposes, you can either fork it and adapt the workflow and templates with some simple tweaks, or you can require it through Composer to extend it.

Providing A Custom Config File

You can set the configuration file to be loaded through the "extra" key in the composer.json file:

If you want to modify the key that is used for this ("brightnucleus-boilerplate"), you can override the Setup::getExtraKey() method.

Changing The Templates

The templates can be found in the _templates folder and can have an optional .template extension. Each template in that folder will be copied to the root folder, after it has been run through a Mustache renderer that replaces all the placeholders with the actual values you've provided during the script execution.

If there are subfolders within _templates, these subfolders and their content will also be mirrored within the root folder. So, you can build the entire file structure that will later land in your package root folder within this _templates folder.

Adding a new template is just a matter of adding a new file within that structure.

Changing The Placeholders

The placeholders are defined within the _config/defaults.php file.

To add a new placeholder, you can just add a new element to the array referenced by BrightNucleus/Boilerplate/Placeholders.

Example:

This example will add a new placeholder {{greeting}} that you can use within your templates.

The validation value passed to 'validation' needs to be a callable that gets the current value entered by the user, and needs to either return the validated form of that value, or throw an exception if the value does not meet the requirements. The Validation class provides some helper methods to do the actual validation.

The default value passed into 'default' can be either a literal value to use, or a callable that gets the array of placeholders as an argument, and needs to return a value to use. Using this array, you can make one default value depend on the current value of another placeholder, provided that that placeholder has already been set before (ordering within the config file).

Adding A Custom Setup Task

The individual tasks are simple classes that implement the BrightNucleus\Boilerplate\Scripts\SetupTask interface:

In most cases, it is probably preferable to extend BrightNucleus\Boilerplate\Scripts\Task\AbstractTask though, as this provides some convenience functionality.

Here's an example task that displays a "Boilerplate" logo in the console:

Now, to hook this task up to the setup process, you insert the class name into the getSetupTasks() method of the BrightNucleus\Boilerplate\Scripts\Setup class.

The array of classes is executed in the order in which the classes have been added, so if we want to display our new logo as the very first step to be taken, we insert it at the top of the array.

If we now run our composer create-project command, Composer will first download everything it needs, then start the custom setup process by displaying the new logo first.

Contributing

All feedback / bug reports / pull requests are welcome.

License

Copyright (c) 2016 Alain Schlesser, Bright Nucleus

This code is licensed under the MIT License.


All versions of boilerplate with dependencies

PHP Build Version
Package Version
Requires brightnucleus/exceptions Version >=0.2
brightnucleus/config Version >=0.4
composer/composer Version ^1.1
symfony/finder Version ^3.1
mustache/mustache Version ^2.10
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package brightnucleus/boilerplate contains the following files

Collapse All

_config

  defaults.php

_scripts

   Task

    AbstractTask.php
    AskAboutProjectParameters.php
    DisplayBoilerplateLogo.php
    InitializeVCS.php
    MoveTemplateFilesToRootFolder.php
    RemoveConfigFolder.php
    RemoveExistingRootFiles.php
    RemoveOriginalVCSData.php
    RemoveTemplatesFolder.php
    RemoveVendorFolder.php
    ReplacePlaceholdersInTemplateFiles.php
    VerifyProjectParameters.php
  Setup.php
  SetupHelper.php
  SetupTask.php
  Validation.php

_templates

   config

    defaults.php.template

   src

    BoilerplateClass.php.template

   tests

    BoilerplateClassTest.php.template
  .gitignore.template
  CHANGELOG.md.template
  LICENSE.template
  README.md.template
  composer.json.template
  phpunit.xml.template
.gitignore
CHANGELOG.md
LICENSE
README.md
composer.json
composer.lock