genesis-php / genesis
Installs: 2 084
Dependents: 1
Suggesters: 0
Security: 0
Stars: 1
Watchers: 3
Forks: 3
Open Issues: 1
Requires
- php: >= 5.4
- nette/neon: *
Requires (Dev)
- nette/tester: ^1.7
- phpunit/phpunit: ^4.8
This package is not auto-updated.
Last update: 2024-12-21 20:14:08 UTC
README
Genesis is lightweight, smart and easy to use CLI tool, for building (mainly) PHP applications. Usage is similar to Phing, but Genesis is much easier. For configuration is used an .neon file, which is very similar to YAML.
Installation
Preferred installation is with Composer.
composer require genesis-php/genesis
Compatibility
This software is developed primarily for UNIX systems (Linux, OSX), but it works also on Windows.
Quick example
Look at the example which gives you quick introduction.
Don't worry, it will take only minute.
Getting started
Initialize build directory in your project:
(path to your vendor directory may differ!)
../vendor/bin/genesis self-init
An 'build' directory will be created, with these files:
- Build.php
- PHP class with runXyz() methods
- every public method starting with 'run' is an "Task"
- in task you can run any code you want
- there is public method 'setup', it runs slightly after Build class is constructed
- for example
- PHP class with runXyz() methods
- config.neon
- config in NEON format (very similar to YAML)
- define parameters and services
- you can include another configs directly in NEON file:
includes:
- include.neon
- if you don't want to merge any config variable, add ! (exclamation mark), eg:
myParam!: unoverrided value
- for example
- bootstrap.php (optional)
- to load Build class and other classes
- for example
- build (optional)
- shell script which is only shortcut into vendor directory with genesis
Look at the skeleton, how can build directory looks like.
CLI
This tool is intended to use via CLI only.
Run it by (path to your vendor directory may differ!):
../vendor/bin/genesis mytask
OR via shortcut, which creates self-init (you may need to edit path to vendor dir in file 'build/build'):
./build/build mytask
You can use any working directory with parameter "--working-dir":
Supported options:
--working-dir /var/www/myproject
- use specified working directory--colors 0
- disable colored output--config myconfig.neon
- use specified config
All arguments are passed to build:
../vendor/bin/genesis mytask foo
Arguments mytask and foo will be available in your build class (property $arguments)
Commands
Commands are intended to use them in Tasks. In namespace Genesis\Commands are default commands and of course you can create and use your own commands.
Common
- [Exec](https://github.com/genesis-php/genesis/blob/master/src/commands/Exec.php) - executes shell command - returns an [ExecResult](https://github.com/genesis-php/genesis/blob/master/src/commands/ExecResult.php) including return code and output - [Git](https://github.com/genesis-php/genesis/blob/master/src/commands/Git.php) - executes Git command & can clone any repository - returns an [ExecResult](https://github.com/genesis-php/genesis/blob/master/src/commands/ExecResult.php) including return code and output - [Help](https://github.com/genesis-php/genesis/blob/master/src/commands/Help.php) - prints list of available tasks to output - list is given in simple array - [NodeJs](https://github.com/genesis-php/genesis/blob/master/src/commands/NodeJs.php) - can install packages (npm install) in any directory - [PhpUnit](https://github.com/genesis-php/genesis/blob/master/src/commands/PhpUnit.php) - can run PHPUnit tests in any directory & provides some setup - [NetteTester](https://github.com/genesis-php/genesis/blob/master/src/commands/NetteTester.php) - can run Nette Tester tests in any directory & provides some setupAssets
- [Assets\Gulp](https://github.com/genesis-php/genesis/blob/master/src/commands/assets/Gulp.php) - Running gulp, usually to build frontend - You can setup gulpfile location - [Assets\Less](https://github.com/genesis-php/genesis/blob/master/src/commands/assets/Less.php) - if you want only compile LESS files on build, you can use this command - using NodeJs lessc toolFilesystem
- [Filesystem\Filesystem](https://github.com/genesis-php/genesis/blob/master/src/commands/filesystem/Filesystem.php) - configurable object, intended to use as service - [Filesystem\Directory](https://github.com/genesis-php/genesis/blob/master/src/commands/filesystem/Directory.php) - provides set of methods for manipulating with directories - creating, cleaning (purging), reading - [Filesystem\File](https://github.com/genesis-php/genesis/blob/master/src/commands/filesystem/File.php) - provides set of methods for manipulating with files - creating, copying - [Filesystem\Symlink](https://github.com/genesis-php/genesis/blob/master/src/commands/filesystem/Symlink.php) - creating symlinksTest
This set of commands may be useful, if you want to check system some system requirements, usually at the beginning of the build. - [Test\NodeJs](https://github.com/genesis-php/genesis/blob/master/src/commands/test/NodeJs.php) - tests NodeJs version - [Test\Php](https://github.com/genesis-php/genesis/blob/master/src/commands/test/Php.php) - tests PHP ini settings - tests if desired extension present - [Test\NodeJs](https://github.com/genesis-php/genesis/blob/master/src/commands/test/Programs.php) - tests if desired programs is installed (on UNIX)Integration
An bootstrap.php in build directory can return instance of Genesis\Config\Container
which will be merged into Container created from config.neon