PHPStorm and PHP_CodeSniffer on XAMPP

By Sinh Pham → Monday 8 September 2014

I have heard and read so many positive reviews on PhpStorm IDE in the past. So I am working on windows and xampp,so on.
If  PEAR is absent, follow the steps below to get it installed.

1 .Download PEAR’s installation PHAR file, copy and paste it to your PHP server installation directory (i.e. where php.exe resides).
2. Open windows command prompt: Start -> type in ‘cmd’ -> press Enter.
3. CD into your php server folder (in XAMPP, the folder is C:\path\to\xampp\php) like this:

cd c:\path\to\php\server\folder
4 .Run the following command to start the PEAR installation.



php go-pear.phar

5. Follow the on-screen instructions to complete the installation.
If like me, you use XAMPP, you don’t need to install PEAR and PHP_CodeSniffer because they ship with XAMPP by default.

To confirm that CodeSniffer is installed, run the following command phpcs -i and you should see a list of installed Coding standard otherwise run the pear command below to get it installed.

pear install PHP_CodeSniffer

Now that we have CodeSniffer installed, next is to set it up in PhpStorm alongside the WordPress Coding Standards.

The list of installed Coding standard on my XAMPP doesn’t include that of WordPress hence the installation.

I will use XAMPP as the base of our Phpstorm Code Sniffer setup.

1 .Download the CodeSniffer WordPress standard.
2. Unpack the downloaded archive, copy the WordPress folder and paste it to XAMPP CodeSniffer’s “Standard” folder located at path\to\xampp\php\pear\PHP\CodeSniffer\Standards
3. Navigate to PhpStorm settings via File -> Settings or Ctrl + Alt + S
4 .Configure PHP Code Sniffer by providing the path (path\to\xampp\php\phpcs.bat) in Settings | PHP | Code Sniffer.
Click the Validate button to check if the Code Sniffer tool can be reached.


5. Go to Settings | Inspections | PHP | PHP Code Sniffer validation. Select WordPress or the available coding standard in the list (use the refresh button if needed). Click OK.


Now your code is inspected by PHP Code Sniffer with the selected Coding Standard.

In addition to PhpStorm’s inspections, you will see notifications marked phpcs in the editor.


If you run batch inspections with Code | Inspect Code PHP Code Sniffer, the results of PHP Code Sniffer inspections will be listed in the section PHP | PHP Code Sniffer validation.

source:google.com

Free Apple App

I'm Free Apple App. A full time web designer. I enjoy to make modern template. I love create blogger template and write about web design, blogger. Now I'm working with http://free-apple-apps.blogspot.com/. You can contact me.

No Comment to " PHPStorm and PHP_CodeSniffer on XAMPP "