Download the PHP package codenamephp/installer without Composer
On this page you can find all versions of the php package codenamephp/installer. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download codenamephp/installer
More information about codenamephp/installer
Files in codenamephp/installer
Package installer
Short Description Installer that uses template folders to setup projects, e.g. from a github template repository
License Apache-2.0
Informations about the package installer
Installer
Installer that uses template folders to setup projects, e.g. from a github template repository
Installation
Easiest way is via composer. Just run composer require codenamephp/installer
in your cli which should install the latest version for you.
Usage
The idea is to have a start script in a subfolder. The script itself just sets up the installer and the dependencies and by that also what the installer is actually doing. The reason to put it in its own folder is so the files are clearly separated from the rest of the files so the installer can easily remove itself.
First require the installer package using composer so we can start using its classes.
Best practice is to create a .installer
folder and an install.php
. The following example will render the files in the
.installer/templates
folder into the parent folder replacing all eisting files and replacing all variables in the templates with the variables form the array.
Once this is done the .installer
folder is deleted.
There's also variable replacement in paths. In this example, a framed replacer is used so common folder names that also might appear as variable are not
replaced by accident (like "vendor" in this example). The default for the prefix and suffix is '' so if a file
`.installer/templates/files/vendor/componentName__.jsonwould exist it would end up in
files/codenamephp/some.component.json`
so you can change the final structure on the fly (e.g. have a folder structure that matches your namespace).
.installer/install.php
:
.installer/templates/composer.json
:
.installer/templates/README.md
:
This example could be part of a GitHub template repository. After the repository was created on GitHub the repo can be cloned to local and after
running composer install && php .installer/install.php && composer update
the repo would be ready for development.
This example can be adapted to the repository needs. Since the installer itself only executes steps custom steps can be added in the repository by implementing
the \de\codenamephp\installer\steps\iStep
interface and adding it to the installer.