Skip to content

Latest commit

 

History

History
37 lines (29 loc) · 1.31 KB

README.org

File metadata and controls

37 lines (29 loc) · 1.31 KB

A php-cs-fixer wrapper for the Emacs editor.

Features

Allows in the Emacs editor to fix most issues in PHP code when you want to follow the coding standards PSR-1 and PSR-2.

Under the hood, this package provides the customisable Elisp command php-cs-fix wich wraps the command line php-cs-fixer version >=2.0 provided by the powerful PHP Coding Standards Fixer

Installation

System part

Using straight

(use-package php-cs-fixer
  :straight (:type git :repo "Nazar65/emacs-php-cs-fixer")
  :after php-mode)

Emacs part

This package requires that the `cl-lib` package was installed.

Usage

Try `M-x php-cs-fix [ret]` when editing a PHP file.

If you want an automatic fix when saving all php files, place this code in your Emacs configuration file the line :

(add-hook 'php-mode-hook
            (lambda ()
              (add-hook 'before-save-hook 'php-cs-fixer-before-save)))

Customisable variable

  • php-cs-fixer-rules-config-file the ‘php-cs-fixer’ –config option value (default is nil) value is th path to .php-cs-fixer.dist.php file
  • php-cs-fixer-command : the ‘php-cs-fixer’ command (default is “php-cs-fixer”) ;

Try `M-x customize-group [ret] php-cs-fixer [ret]` to modify the values of these variables.