PHP build/integration tools: Do you use them? [closed]

南楼画角 提交于 2019-12-02 19:10:20

I have used both Phing and Ant and prefer the latter much more. I initially went with Phing due to it being written in PHP but to be honest it isn't as mature as Ant. In the end, having a mature buildsystem with a large community is worth more.

Things done with Ant/Phing:

  1. From a base checkout loalize to a specific language, ensure dependencies are there (other libs, directories, etc)
  2. if you have them, compile templates, etc
  3. Bring target database up to the required version, depending on the checked out code version
  4. run unit tests, etc
Matt Whipple

A large issue that I see with Phing is that it creates a needless layer of indirection. PHP is a scripting language, and therefore could be run directly. Phing's use of XML configuration is a poor fit for the language: it does provide a more readable declarative configuration, but at the cost of sacrificing any of the flexibility of the language. With Ant (the inspiration for that route) it makes sense since Java did not have that flexibility as it is less dynamic and requires compilation.

Unfortunately I haven't seen many good alternatives in the PHP space, and unlike other languages build tools are not as essential or a part of the culture so the evolution of another well supported option may not happen any time soon.

I'd therefore stick to options that are closer to what PHP could do from cultures that more aggressively support build tools. I normally use Gradle. Rake also does a great job depending on with which language you want to cheat (and there may be other similar options). You should also weigh things like Webdriver support if you're into that type of thing. Otherwise creating a lightweight solution using PHP and/or BASH should cover everything while maintaining transparency

I looked at at Phing at it looks pretty awesome. For the project I'm working on I'm actually using Apache's Ant. I use it to do a several things:

  1. Combine and compress Javascript and CSS (compression done using the YUI Compressor
  2. Replace standard config files with production config files (e.g. rename config.php.production to config.php)
  3. Remove un-needed files (such as the ant build file, build.xml)

I think Phing is worth looking at over Ant because it's native PHP, which could be nice. Also if you are doing anything more than just copy/moving files around look out for performance issues when you move to the production environment. I had an issue where the YUI compressor ran fine on my local machine but on the relatively small VPS it was super slow.

On a project I'm working on now we're using phpUnderControl to run tests and get fast feedback when something's broken. We plan to use it to run other tests as well such as some written in Watir.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!