Archive for June, 2012

Joomla and CodeSniffer

June 19, 2012 1 comment

Joomla provides custom coding standard for the PHP CodeSniffer, read more about CodeSniffer. Download Joomla coding standard from here Joomla coding standards for more information see here. Read Joomla coding standards here.

PHP CodeSniffer

June 19, 2012 3 comments

PHP CodeSniffer

PHP_CodeSniffer is a PHP5 script that tokenises and “sniffs” PHP, JavaScript and CSS files to detect violations of a defined coding standard. It is an essential development tool that ensures your code remains clean and consistent. It can also help prevent some common semantic errors made by developers.

Pear install PHP_CodeSniffer. Please follow these steps.
1. Click on start->run->cmd
2. Go to php directory where php.exe
3. Now, write commond ‘pear install PHP_CodeSniffer’

Start PHP_CodeSniffer like this:
1. Click on start->run->cmd
2. Go to php directory where php.exe. E.g c:\wamp\bin\php\php5.3.0
3. Now write command ‘phpcs –standard= e.g

Scan a directory:
c:\wamp\bin\bin\php\php5.3.0>phpcs –standard=PEAR c:\wamp\www\phptest

Scan a file:
c:\wamp\bin\bin\php\php5.3.0>phpcs –standard=PEAR c:\wamp\www\test.php

C:\wamp\bin\php\php5.3.0>phpcs –report=xml –report-file=c:\wamp\www\test.xml c

C:\wamp\bin\php\php5.3.0>phpcs –standard=Zend –report=xml –report-file=c:\wam
p\www\tests.xml c:\wamp\www\codesniffer_test\test.php




%d bloggers like this: