Friday, November 13, 2015

PHP-CS-Fixer in PHPStorm with File Watcher

First of all, install php-cs-fixer:


wget http://get.sensiolabs.org/php-cs-fixer.phar -O php-cs-fixer
sudo chmod a+x php-cs-fixer
sudo mv php-cs-fixer /usr/local/bin/php-cs-fixer



Second have a project-specific php-cs config file. As an example take a look here.


In PHPStorm click "File" -> "Settings" -> "Tools" -> "File Watchers"

Fill out the provided view:

Name: PHP CS Fixer
Description: fixes php code style
Show console: Error
File type: PHP
Scope: Project Files
Program: /usr/local/bin/php-cs-fixer
Arguments: --config-file=$ProjectFileDir$/.php_cs fix $FileDir$/$FileName$ -v --diff --dry-run
Working directory: $ProjectFileDir$

It should look like this:

PHPStorm Settings


Hint: You can also ommit the --dry-run option, to let PHP-CS-Fixer automatically fix your code.

23 comments:

  1. Replies
    1. Great Article Cloud Computing Projects

      Networking Projects

      Final Year Projects for CSE

      JavaScript Training in Chennai

      JavaScript Training in Chennai

      The Angular Training covers a wide range of topics including Components, Angular Directives, Angular Services, Pipes, security fundamentals, Routing, and Angular programmability. The new Angular TRaining will lay the foundation you need to specialise in Single Page Application developer. Angular Training

      Delete
  2. thx, one think yet: why should the wather not fix directly the violation at lookup?

    ReplyDelete
  3. Thanks for sharing the valuable post. Kanhasoft is the well known Custom PHP Web Developer in India. We providing outsourcing services to USA, UK, Europe, Canada, Germany, UAE, Dubai, Australia, France, Brazil, Turkey, Singapore, Japan, Saudi Arabia, Ukraine, Spain, Belgium, Netherlands, Luxembourg, New Zealand, Argentina, South Africa, Greece, Denmark, Poland, Switzerland and more. Visit our site to know more.

    ReplyDelete

  4. This is an awesome post. Really very informative and creative contents. This concept is a good way to enhance knowledge. I like it and help me to development very well. Thank you for this brief explanation and very nice information. Well, got good knowledge.
    best web design company in Chennai

    ReplyDelete

  5. Contract PHP engineer capable in creating E-trade sites, shopping baskets, dynamic sites and customization of many open source applications. CakePHP Application Development

    ReplyDelete
  6. Instead of HTML, PHP can develop relationship with databases, can make flat HTML code and you can even set your server to process all HTML archives with PHP so the real source code of your site can't be copied or seen.Why use Laravel

    ReplyDelete
  7. The great information that you shared. It will help all of them. Thanks for posting. Keep maintain the updates
    PHP Development Company
    |
    ERP Solution
    |
    magento ecommerce
    |

    ReplyDelete
  8. This permits the maker to keep another substance from replicating the program and there is commonly no compelling reason to enroll code with the end goal for it to be copyrighted. itools crack 2020

    ReplyDelete
  9. Thank you so much for sharing all this wonderful information !!!! It is so appreciated!! You have good humor in your blogs. So much helpful and easy to read!
    Software Testing course in Pune

    ReplyDelete

  10. I recently came across your article and have been reading along. I want to express my admiration of your writing skill and ability to make readers read from the beginning to the end. I would like to read newer posts and to share my thoughts with you. Job Oriented Courses

    ReplyDelete
  11. Thanks for sharing the information with us ,keep writing
    Visit us
    Software Testing Training in Pune

    ReplyDelete
  12. Such a Nice post.#Thanks For sharing this kind of information phpstorm-crack// You can also visit my Website crackinges.com

    ReplyDelete
  13. This site have particular software articles which emits an impression of being a significant and significant for you individual, able software installation.This is the spot you can get helps for any software installation, usage and cracked.
    https://crackexe.net/https://crackexe.net/
    phpstorm-crack
    malwarebytes-premium-crack
    apowerrec-crack
    garmin-basecamp-crack
    beecut-crack
    netbalancer-crack
    debut-video-capture-crack
    openshot-video-editor-crack

    ReplyDelete
  14. Such a Nice post. Thanks for Awesome tips Keep it up
    crackandpatch.com

    ReplyDelete


  15. Many thanks for sharing such incredible knowledge. It's really good for your website.
    The info on your website inspires me greatly. This website I'm bookmarked. Maintain it and thanks again.
    I'm really impressed with your writing skills, as smart as the structure of your weblog.
    PhpStorm Crack

    ReplyDelete
  16. สำหรับมือใหม่ที่กำลังมองหาเว็บไซต์สล็อตทอดทดลองเล่นฟรี slotxo ท่านเองสามารถที่จะเข้ามาสมัครเป็นสมาชิกกับทางเว็บไซต์พวกเรา เว็บ สล็อต แล้วต่อจากนั้นให้เลือกโหมดทดสอบเล่นฟรีเพื่อเข้าไปฝึกซ้อมความสามารถการเล่นได้ ท่านสามารถเล่นเกมสล็อตได้ฟรี askmebet ไม่ต้องเสียเงินเสียทองแม้กระทั้งบาทเดียว สามารถเลือกเล่นได้ทุกเกมแบบไม่จำกัด สล็อต 888 มีวงเงินทดสอบให้กับคุณมากยิ่งกว่า 10,000 บาท ให้แก่ท่านเองได้ฝึกซ้อมตนเองจนถึงกำเนิดความชำนิชำนาญแล้วนั้นค่อยกลับมาใช้เงินจริงๆ

    ReplyDelete
  17. Thanks for sharing your knowledge to install & crack the Time Tables, but you need to update
    it now. because there is a 2021 version available now: you can get it here
    crackregister.com
    netbalancer-crack
    eset-nod32-antivirus-crack

    ReplyDelete
  18. Thanks for sharing your knowledge to install & crack the Time Tables, but you need to update
    it now. because there is a 2021 version available now: you can get it here

    crackregister.com

    netbalancer-crack

    eset-nod32-antivirus-crack

    advanced-installer-architect-crack

    pc-cleaner-pro-crack

    iobit-uninstaller-pro-crack

    ReplyDelete
  19. Such a Nice post. Thanks for Awesome tips Keep it up
    phpstorm-crack

    ReplyDelete