installation.rst 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. ============
  2. Installation
  3. ============
  4. Requirements
  5. ------------
  6. PHP needs to be a minimum version of PHP 7.4.
  7. Installation
  8. ------------
  9. Locally
  10. ~~~~~~~
  11. Download the `php-cs-fixer.phar`_ file and store it somewhere on your computer.
  12. Globally (manual)
  13. ~~~~~~~~~~~~~~~~~
  14. You can run these commands to easily access latest ``php-cs-fixer`` from anywhere on
  15. your system:
  16. .. code-block:: console
  17. wget https://cs.symfony.com/download/php-cs-fixer-v3.phar -O php-cs-fixer
  18. or with specified version:
  19. .. code-block:: console
  20. wget https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/releases/download/v3.13.0/php-cs-fixer.phar -O php-cs-fixer
  21. or with curl:
  22. .. code-block:: console
  23. curl -L https://cs.symfony.com/download/php-cs-fixer-v3.phar -o php-cs-fixer
  24. then:
  25. .. code-block:: console
  26. sudo chmod a+x php-cs-fixer
  27. sudo mv php-cs-fixer /usr/local/bin/php-cs-fixer
  28. Then, just run ``php-cs-fixer``.
  29. Globally (Composer)
  30. ~~~~~~~~~~~~~~~~~~~
  31. To install PHP CS Fixer, `install Composer <https://getcomposer.org/download/>`_ and issue the following command:
  32. .. code-block:: console
  33. composer global require friendsofphp/php-cs-fixer
  34. Then make sure you have the global Composer binaries directory in your ``PATH``. This directory is platform-dependent, see `Composer documentation <https://getcomposer.org/doc/03-cli.md#composer-home>`_ for details. Example for some Unix systems:
  35. .. code-block:: console
  36. export PATH="$PATH:$HOME/.composer/vendor/bin"
  37. Globally (homebrew)
  38. ~~~~~~~~~~~~~~~~~~~
  39. .. code-block:: console
  40. brew install php-cs-fixer
  41. Locally (PHIVE)
  42. ~~~~~~~~~~~~~~~
  43. Install `PHIVE <https://phar.io>`_ and issue the following command:
  44. .. code-block:: console
  45. phive install php-cs-fixer # use `--global` for global install
  46. Update
  47. ------
  48. Locally
  49. ~~~~~~~
  50. The ``self-update`` command tries to update ``php-cs-fixer`` itself:
  51. .. code-block:: console
  52. php php-cs-fixer.phar self-update
  53. Globally (manual)
  54. ~~~~~~~~~~~~~~~~~
  55. You can update ``php-cs-fixer`` through this command:
  56. .. code-block:: console
  57. sudo php-cs-fixer self-update
  58. Globally (Composer)
  59. ~~~~~~~~~~~~~~~~~~~
  60. You can update ``php-cs-fixer`` through this command:
  61. .. code-block:: console
  62. ./composer.phar global update friendsofphp/php-cs-fixer
  63. Globally (homebrew)
  64. ~~~~~~~~~~~~~~~~~~~
  65. You can update ``php-cs-fixer`` through this command:
  66. .. code-block:: console
  67. brew upgrade php-cs-fixer
  68. Locally (PHIVE)
  69. ~~~~~~~~~~~~~~~
  70. .. code-block:: console
  71. phive update php-cs-fixer
  72. .. _php-cs-fixer.phar: https://cs.symfony.com/download/php-cs-fixer-v3.phar