{"id":1260,"date":"2016-12-22T14:52:08","date_gmt":"2016-12-22T14:52:08","guid":{"rendered":"http:\/\/myprojects.advchaweb.com\/?p=1260"},"modified":"2016-12-22T15:29:47","modified_gmt":"2016-12-22T15:29:47","slug":"php-tools","status":"publish","type":"post","link":"https:\/\/myprojects.advchaweb.com\/index.php\/2016\/12\/22\/php-tools\/","title":{"rendered":"PHP Tools"},"content":{"rendered":"<p>Install some PHP tools:<\/p>\n<ol>\n<li>PHP Coding Standards Fixer (http:\/\/cs.sensiolabs.org\/)<br \/>\nInstallation: (Globally (Composer))<\/p>\n<pre class=\"lang:default decode:true \">teddy@teddy-K43SJ:~$ composer global require friendsofphp\/php-cs-fixer\r\nChanged current directory to \/home\/teddy\/.composer\r\nYou are running composer with xdebug enabled. This has a major impact on runtime performance. See https:\/\/getcomposer.org\/xdebug\r\nUsing version ^2.0 for friendsofphp\/php-cs-fixer\r\n.\/composer.json has been created\r\nLoading composer repositories with package information\r\nUpdating dependencies (including require-dev)\r\n  - Installing sebastian\/diff (1.4.1)\r\n    Loading from cache\r\n\r\n  - Installing symfony\/stopwatch (v3.2.1)\r\n    Downloading: 100%         \r\n\r\n  - Installing symfony\/process (v3.2.1)\r\n    Downloading: 100%         \r\n\r\n  - Installing symfony\/polyfill-php54 (v1.3.0)\r\n    Downloading: 100%         \r\n\r\n  - Installing symfony\/finder (v3.2.1)\r\n    Downloading: 100%         \r\n\r\n  - Installing symfony\/filesystem (v3.2.1)\r\n    Downloading: 100%         \r\n\r\n  - Installing symfony\/event-dispatcher (v3.2.1)\r\n    Downloading: 100%         \r\n\r\n  - Installing psr\/log (1.0.2)\r\n    Loading from cache\r\n\r\n  - Installing symfony\/debug (v3.2.1)\r\n    Downloading: 100%         \r\n\r\n  - Installing symfony\/polyfill-mbstring (v1.3.0)\r\n    Downloading: 100%         \r\n\r\n  - Installing symfony\/console (v3.2.1)\r\n    Downloading: 100%         \r\n\r\n  - Installing friendsofphp\/php-cs-fixer (v2.0.0)\r\n    Downloading: 100%         \r\n\r\nsymfony\/event-dispatcher suggests installing symfony\/dependency-injection ()\r\nsymfony\/event-dispatcher suggests installing symfony\/http-kernel ()\r\nWriting lock file\r\nGenerating autoload files<\/pre>\n<p>Then make sure you have ~\/.composer\/vendor\/bin in your PATH and you&#8217;re good to go:<\/p>\n<pre class=\"lang:default decode:true \">teddy@teddy-K43SJ:~$ export PATH=\"$PATH:$HOME\/.composer\/vendor\/bin\"<\/pre>\n<p>To find out the location of php-cs-fixer<\/p>\n<pre class=\"lang:default decode:true \">teddy@teddy-K43SJ:~$ which php-cs-fixer\r\n\/home\/teddy\/.composer\/vendor\/bin\/php-cs-fixer<\/pre>\n<p>I can use the location for the netbeans plugins needed.<br \/>\nAnother reference: https:\/\/mattstauffer.co\/blog\/using-php-cs-fixer-to-fix-up-your-php-code<\/li>\n<li>PHP CodeSniffer<br \/>\nRef: http:\/\/purencool.com\/install-and-test-phpcodesniffer-on-ubuntu<br \/>\nhttp:\/\/askubuntu.com\/questions\/572956\/adding-a-standard-to-php-codesniffer<br \/>\nInstallation:<\/p>\n<pre class=\"lang:default decode:true \">teddy@teddy-K43SJ:~$ sudo pear install PHP_CodeSniffer\r\n[sudo] password for teddy: \r\nWARNING: channel \"pear.php.net\" has updated its protocols, use \"pear channel-update pear.php.net\" to update\r\ndownloading PHP_CodeSniffer-2.7.1.tgz ...\r\nStarting to download PHP_CodeSniffer-2.7.1.tgz (513,716 bytes)\r\n.....................................................................done: 513,716 bytes\r\ninstall ok: channel:\/\/pear.php.net\/PHP_CodeSniffer-2.7.1<\/pre>\n<p>To find out the location<\/p>\n<pre class=\"lang:default decode:true\">teddy@teddy-K43SJ:~$ which phpcs\r\n\/usr\/bin\/phpcs<\/pre>\n<p>To verify PHP_CodeSniffer is already installed, check like this:<\/p>\n<pre class=\"lang:default decode:true \">teddy@teddy-K43SJ:~$ phpcs -i\r\nThe installed coding standards are PHPCS, Squiz, PSR2, PSR1, PEAR, MySource and Zend<\/pre>\n<p>Ref: https:\/\/wisdmlabs.com\/blog\/how-to-format-php-code-to-wordpress-coding-standards-in-netbeans\/<br \/>\nTo use it in netbeans, click: Source &gt; Inspect&#8230;<\/li>\n<li>PHP Mess Detector &amp; PDepend<br \/>\nRef: https:\/\/phpmd.org\/download\/index.html<br \/>\nhttp:\/\/stackoverflow.com\/questions\/27958289\/what-is-phpmd-and-how-to-use-it<br \/>\nInstallation: (Same way with php cs fixer to use composer globally)<\/p>\n<pre class=\"lang:default decode:true \">teddy@teddy-K43SJ:~$ composer global require phpmd\/phpmd\r\nChanged current directory to \/home\/teddy\/.composer\r\nYou are running composer with xdebug enabled. This has a major impact on runtime performance. See https:\/\/getcomposer.org\/xdebug\r\nUsing version ^2.5 for phpmd\/phpmd\r\n.\/composer.json has been updated\r\nLoading composer repositories with package information\r\nUpdating dependencies (including require-dev)\r\n  - Installing symfony\/dependency-injection (v3.2.1)\r\n    Downloading: 100%         \r\n\r\n  - Installing symfony\/config (v3.2.1)\r\n    Downloading: 100%         \r\n\r\n  - Installing pdepend\/pdepend (2.3.2)\r\n    Downloading: 100%         \r\n\r\n  - Installing phpmd\/phpmd (2.5.0)\r\n    Downloading: 100%         \r\n\r\nsymfony\/dependency-injection suggests installing symfony\/yaml ()\r\nsymfony\/dependency-injection suggests installing symfony\/expression-language (For using expressions in service container configuration)\r\nsymfony\/dependency-injection suggests installing symfony\/proxy-manager-bridge (Generate service proxies to lazy load them)\r\nsymfony\/config suggests installing symfony\/yaml (To use the yaml reference dumper)\r\nWriting lock file\r\nGenerating autoload files<\/pre>\n<p>To find out the location for PHPMD and PDepend:<\/p>\n<pre class=\"lang:default decode:true \">teddy@teddy-K43SJ:~$ which phpmd\r\n\/home\/teddy\/.composer\/vendor\/bin\/phpmd<\/pre>\n<pre class=\"lang:default decode:true \">teddy@teddy-K43SJ:~$ which pdepend\r\n\/home\/teddy\/.composer\/vendor\/bin\/pdepend<\/pre>\n<pre class=\"lang:default decode:true \">teddy@teddy-K43SJ:~$ which phpunit\r\n\/usr\/local\/bin\/phpunit<\/pre>\n<p>&nbsp;<\/li>\n<li>PHP Copy\/Paste Detector (PHPCPD)<br \/>\nRef: https:\/\/github.com\/sebastianbergmann\/phpcpd<br \/>\nNOTE: DONT INSTALL FROM PEAR!<br \/>\nInstallation: (Use composer globally)<\/p>\n<pre class=\"lang:default decode:true \">teddy@teddy-K43SJ:~$ composer global require \"sebastian\/phpcpd=*\"\r\nChanged current directory to \/home\/teddy\/.composer\r\nYou are running composer with xdebug enabled. This has a major impact on runtime performance. See https:\/\/getcomposer.org\/xdebug\r\n.\/composer.json has been updated\r\nLoading composer repositories with package information\r\nUpdating dependencies (including require-dev)\r\n  - Installing theseer\/fdomdocument (1.6.1)\r\n    Downloading: 100%         \r\n\r\n  - Installing phpunit\/php-timer (1.0.8)\r\n    Loading from cache\r\n\r\n  - Installing sebastian\/version (2.0.1)\r\n    Downloading: 100%         \r\n\r\n  - Installing sebastian\/finder-facade (1.2.1)\r\n    Downloading: 100%         \r\n\r\n  - Installing sebastian\/phpcpd (2.0.4)\r\n    Downloading: 100%         \r\n\r\nWriting lock file\r\nGenerating autoload files<\/pre>\n<p>To find out the location:<\/p>\n<pre class=\"lang:default decode:true \">teddy@teddy-K43SJ:~$ which phpcpd\r\n\/home\/teddy\/.composer\/vendor\/bin\/phpcpd<\/pre>\n<p>Please read this: <a href=\"https:\/\/easyengine.io\/tutorials\/php\/code-review-tools\/\" target=\"_blank\">Installation of PHP Code Review Tools<\/a><br \/>\nFor integrating all the above tools in Netbeans!<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>Install some PHP tools: PHP Coding Standards Fixer (http:\/\/cs.sensiolabs.org\/) Installation: (Globally (Composer)) teddy@teddy-K43SJ:~$ composer global require friendsofphp\/php-cs-fixer Changed current directory to \/home\/teddy\/.composer You are running composer with xdebug enabled. This has a major impact on runtime performance. See https:\/\/getcomposer.org\/xdebug Using version ^2.0 for friendsofphp\/php-cs-fixer .\/composer.json has been created Loading composer repositories with package information Updating &hellip; <a href=\"https:\/\/myprojects.advchaweb.com\/index.php\/2016\/12\/22\/php-tools\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;PHP Tools&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[48,17,18],"tags":[],"class_list":["post-1260","post","type-post","status-publish","format-standard","hentry","category-php-2","category-ubuntu","category-ubuntu-14-04"],"_links":{"self":[{"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/posts\/1260","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/comments?post=1260"}],"version-history":[{"count":4,"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/posts\/1260\/revisions"}],"predecessor-version":[{"id":1262,"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/posts\/1260\/revisions\/1262"}],"wp:attachment":[{"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/media?parent=1260"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/categories?post=1260"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/tags?post=1260"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}