genesis-php/genesis
Composer 安装命令:
composer require genesis-php/genesis
包简介
README 文档
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
genesis-php/genesis 适用场景与选型建议
genesis-php/genesis 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 2.17k 次下载、GitHub Stars 达 1, 最近一次更新时间为 2016 年 03 月 02 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 genesis-php/genesis 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 genesis-php/genesis 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 2.17k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-03-02