Install some PHP tools:
- PHP Coding Standards Fixer (http://cs.sensiolabs.org/)
Installation: (Globally (Composer))
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647teddy@teddy-K43SJ:~$ composer global require friendsofphp/php-cs-fixerChanged current directory to /home/teddy/.composerYou are running composer with xdebug enabled. This has a major impact on runtime performance. See https://getcomposer.org/xdebugUsing version ^2.0 for friendsofphp/php-cs-fixer./composer.json has been createdLoading composer repositories with package informationUpdating dependencies (including require-dev)- Installing sebastian/diff (1.4.1)Loading from cache- Installing symfony/stopwatch (v3.2.1)Downloading: 100%- Installing symfony/process (v3.2.1)Downloading: 100%- Installing symfony/polyfill-php54 (v1.3.0)Downloading: 100%- Installing symfony/finder (v3.2.1)Downloading: 100%- Installing symfony/filesystem (v3.2.1)Downloading: 100%- Installing symfony/event-dispatcher (v3.2.1)Downloading: 100%- Installing psr/log (1.0.2)Loading from cache- Installing symfony/debug (v3.2.1)Downloading: 100%- Installing symfony/polyfill-mbstring (v1.3.0)Downloading: 100%- Installing symfony/console (v3.2.1)Downloading: 100%- Installing friendsofphp/php-cs-fixer (v2.0.0)Downloading: 100%symfony/event-dispatcher suggests installing symfony/dependency-injection ()symfony/event-dispatcher suggests installing symfony/http-kernel ()Writing lock fileGenerating autoload files
Then make sure you have ~/.composer/vendor/bin in your PATH and you’re good to go:
1teddy@teddy-K43SJ:~$ export PATH="$PATH:$HOME/.composer/vendor/bin"
To find out the location of php-cs-fixer
12teddy@teddy-K43SJ:~$ which php-cs-fixer/home/teddy/.composer/vendor/bin/php-cs-fixer
I can use the location for the netbeans plugins needed.
Another reference: https://mattstauffer.co/blog/using-php-cs-fixer-to-fix-up-your-php-code - PHP CodeSniffer
Ref: http://purencool.com/install-and-test-phpcodesniffer-on-ubuntu
http://askubuntu.com/questions/572956/adding-a-standard-to-php-codesniffer
Installation:
1234567teddy@teddy-K43SJ:~$ sudo pear install PHP_CodeSniffer[sudo] password for teddy:WARNING: channel "pear.php.net" has updated its protocols, use "pear channel-update pear.php.net" to updatedownloading PHP_CodeSniffer-2.7.1.tgz ...Starting to download PHP_CodeSniffer-2.7.1.tgz (513,716 bytes).....................................................................done: 513,716 bytesinstall ok: channel://pear.php.net/PHP_CodeSniffer-2.7.1
To find out the location
12teddy@teddy-K43SJ:~$ which phpcs/usr/bin/phpcs
To verify PHP_CodeSniffer is already installed, check like this:
12teddy@teddy-K43SJ:~$ phpcs -iThe installed coding standards are PHPCS, Squiz, PSR2, PSR1, PEAR, MySource and Zend
Ref: https://wisdmlabs.com/blog/how-to-format-php-code-to-wordpress-coding-standards-in-netbeans/
To use it in netbeans, click: Source > Inspect… - PHP Mess Detector & PDepend
Ref: https://phpmd.org/download/index.html
http://stackoverflow.com/questions/27958289/what-is-phpmd-and-how-to-use-it
Installation: (Same way with php cs fixer to use composer globally)
12345678910111213141516171819202122232425teddy@teddy-K43SJ:~$ composer global require phpmd/phpmdChanged current directory to /home/teddy/.composerYou are running composer with xdebug enabled. This has a major impact on runtime performance. See https://getcomposer.org/xdebugUsing version ^2.5 for phpmd/phpmd./composer.json has been updatedLoading composer repositories with package informationUpdating dependencies (including require-dev)- Installing symfony/dependency-injection (v3.2.1)Downloading: 100%- Installing symfony/config (v3.2.1)Downloading: 100%- Installing pdepend/pdepend (2.3.2)Downloading: 100%- Installing phpmd/phpmd (2.5.0)Downloading: 100%symfony/dependency-injection suggests installing symfony/yaml ()symfony/dependency-injection suggests installing symfony/expression-language (For using expressions in service container configuration)symfony/dependency-injection suggests installing symfony/proxy-manager-bridge (Generate service proxies to lazy load them)symfony/config suggests installing symfony/yaml (To use the yaml reference dumper)Writing lock fileGenerating autoload files
To find out the location for PHPMD and PDepend:
12teddy@teddy-K43SJ:~$ which phpmd/home/teddy/.composer/vendor/bin/phpmd
12teddy@teddy-K43SJ:~$ which pdepend/home/teddy/.composer/vendor/bin/pdepend
12teddy@teddy-K43SJ:~$ which phpunit/usr/local/bin/phpunit
- PHP Copy/Paste Detector (PHPCPD)
Ref: https://github.com/sebastianbergmann/phpcpd
NOTE: DONT INSTALL FROM PEAR!
Installation: (Use composer globally)
1234567891011121314151617181920212223teddy@teddy-K43SJ:~$ composer global require "sebastian/phpcpd=*"Changed current directory to /home/teddy/.composerYou are running composer with xdebug enabled. This has a major impact on runtime performance. See https://getcomposer.org/xdebug./composer.json has been updatedLoading composer repositories with package informationUpdating dependencies (including require-dev)- Installing theseer/fdomdocument (1.6.1)Downloading: 100%- Installing phpunit/php-timer (1.0.8)Loading from cache- Installing sebastian/version (2.0.1)Downloading: 100%- Installing sebastian/finder-facade (1.2.1)Downloading: 100%- Installing sebastian/phpcpd (2.0.4)Downloading: 100%Writing lock fileGenerating autoload files
To find out the location:
12teddy@teddy-K43SJ:~$ which phpcpd/home/teddy/.composer/vendor/bin/phpcpd
Please read this: Installation of PHP Code Review Tools
For integrating all the above tools in Netbeans!