Makefile for php scripts -
i have order create multiple php scripts reads data stdin. have put source files ftp in special folder , make called makefile php. cannot find documentation it. can please give me informations it? sorry bad english
nowadays, couple of approaches come mind:
1. composer (dependency manager)
if you've never used it: use it. tool don't want miss, unless have dependency management process in place (i.e. git submodules).
the first working , well-established dependency manager, allowing split , require (+ autoload) php components in comprehensive manner. every active php project on github has composer.json, may expand custom script hooks, may reside in seperate build class , call whatever build process have implemented.
note: driving build process strictly speaking not in domain of dependency management, may other alternatives
anyway, works - , can easy
composer.json:
... "require-dev": { "phpunit/phpunit": "4.1.*" }, "autoload": { "psr-0": { "build": "" }, }, "scripts": { "post-autoload-dump": [ "build::afterupdateinstall" ] } ... build.php (in project root):
use composer\script\event; class build { public static function afterupdateinstall(event $event) { if(true === $event->isdevmode()) { passthru(./vendor/bin/phpunit test); } } } one can see how such trigger - in case runs test suite after every development install, update of dependencies or when class autoloader updated. more complex tasks, guess actual build system like
2. phing
have not used yet - it's php-based build system configured via xml files, similar ant (see below or earlier post 2 cents on phing vs. ant).
3. roll own cli executable (/ framework)
write own deploy scripts in php - there libraries available boring stuff (parameter checking, output formatting, documentation output, etc...) focus on implementing cli commands needed (https://github.com/jlogsdon/php-cli-tools). i'd compile php archive executable , included dependency in main project.
and of course can break out of php world , use, (e.g.)
1. ant
dominant in java world. well, if you're advanced ant-user , love working - have business case apply default build manager php projects. personally, glad stop wrapping head around it, there is
2. grunt
nodejs based build system massively growing number of plugins of varying code quality. philosophy emphasizes configuration, partially reason there's many grunt-plugins - each of them abstracts tasks purely configured via json dictionary object. hard find grunt plugin doesn't exist yet!
3. gulp
if relationship grunt getting stale or its' (compared ant) awesome build speed not enough - there gulp. nodejs based, similar grunt in ways - different in 2 others:
a. performance: more speed - less memory-consumption because of
b. approach: centered around piping data stream through stages of build process, avoiding generation of intermediate / temporary files on disc or serialisation of objects in memory while passing them different plugins asynchronously (like grunt does).
some people (like me) keep falling on coordination of several asynchronously happening callbacks, commonly found in non-blocking nodejs, found easier implement first complex gulp script - other people's mileage may vary...
Comments
Post a Comment