A community in which webmasters can ask for help with topics such as PHP coding , MySQL , IT jobs, web design, IT security.
Current location:homephp forumphp talk in 2009 yearWhat do you recommend for a PHP Coding Standards tool/system/program? - page 1
User InfoPosts
What do you recommend for a PHP Coding Standards tool/system/program?#1
I(m working on a PHP project with several developers, each who has their own style. The styles differ significantly, and can make the code really hard to read, and everyone is in agreement that we need to standardize our style.

The issue I(m having is that I can(t find any good program or system to help enforce standards for PHP. I(ve used a number of programs in the past for C++ and Java, and I(m a huge checkstyle fan, but I can(t find anything so elegant for PHP.

What program, tool, or system would you recommend to help developers adhere to a common set of PHP coding standards? Additionally, it would be great if the solution also handled PHP embedded in XHTML, but that is not a requirement.

posted date: 2009-04-14 05:08:00


Re: What do you recommend for a PHP Coding Standards tool/system/program?#2
I had made out the solution of this problem. click to view my topic...

hope that hepls.

posted date: 2009-04-14 05:08:01


Re: What do you recommend for a PHP Coding Standards tool/system/program?#3
I've found a few but none were good enough to recommend. +Staring in case you find out.

posted date: 2009-04-14 05:10:00


Re: What do you recommend for a PHP Coding Standards tool/system/program?#4
PHP_CodeSniffer seems like a great tool. A project I was affiliated with used the Zend Framework coding standard as a basis for our own, and we looked into using it.However, our deadline did not allow much leeway for experimenting with new tools, so we never got into using it past initial testing.

posted date: 2009-04-14 05:15:00


Re: What do you recommend for a PHP Coding Standards tool/system/program?#5
I used in the past phpCodeBeautifier. It does not have lots of options, but it gets the job done to certain point and helps keeping standard code.It(s run from command line and, provided your IDE supports external formatters, you could integrate with that, or create a script to run on all your files.Alternatively, if you use Eclipse or you don(t but plan to run this occasionally, you could use Eclipse with its PHP plugin. You can re-format code inside folders with just a couple of clicks.

posted date: 2009-04-14 05:16:00


Re: What do you recommend for a PHP Coding Standards tool/system/program?#6
I(ve used coding standard part of Zend in the past and it has worked pretty good for me. You can find it at Zend Coding Standard providing you are using Zend to develop your code.

posted date: 2009-04-14 05:20:00


Re: What do you recommend for a PHP Coding Standards tool/system/program?#7
I faced the same problem before, but not after I use Zend Studio for Eclipsehttp://www.zend.com/en/products/studio/Using Zend Studio gives the following benefits:Code that is 100% free from syntax errorsCode that is formatted using PHP or Zend Standard. Just Press Ctrl+Shift+F and everything formats nicely.Detect potential warning, such as security warning for variable files inclusion, such as:include $file;You can find a lot more details on their website. Now I can(t work without Zend Studio.

posted date: 2009-04-14 05:25:00


Re: What do you recommend for a PHP Coding Standards tool/system/program?#8
I find the ZF coding standard very useful even if you don't use ZF otherwise. It has good arguments for most of its cases, and moreover: it's already there: lot less trouble getting your teammates to using it, compared to fighting over your own standard.

posted date: 2009-04-14 05:26:00


Re: What do you recommend for a PHP Coding Standards tool/system/program?#9
Good point Jukka. I have written coding standards in the past and it took over two years to get it adopted by the department because people argued about everything I put in there. I even had a few people argue that it was not a good idea to put a default in every case statement...

posted date: 2009-04-14 05:36:00


Re: What do you recommend for a PHP Coding Standards tool/system/program?#10
If you have several developers, you must be using some sort of version control and continuous integration, right? I use PHP_CodeSniffer (with Zend rules and automatic tab-to-spacing changes) to watch for coding violations and report them using phpUnderControl. If you aren(t using continuous integration, there is a great guide over at iBuildings about setting it up along with PHP_CodeSniffer, phpUnit, and phpDocumetor: http://techportal.inviqa.com/2009/03/03/getting-started-with-phpundercontrol/

posted date: 2009-04-14 05:41:00


Re: What do you recommend for a PHP Coding Standards tool/system/program?#11
+1, good point about combining codesniffer with UnderControl. Will have to give it a go someday soon.

posted date: 2009-04-14 05:44:00


select page: « 1 »
Copyright ©2008-2017 www.momige.com, all rights reserved.