An open API service indexing awesome lists of open source software.

https://github.com/nazar65/emacs-php-cs-fixer

Wraper for emacs php-cs-fixer
https://github.com/nazar65/emacs-php-cs-fixer

Last synced: 3 months ago
JSON representation

Wraper for emacs php-cs-fixer

Awesome Lists containing this project

README

        

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 [[http://cs.sensiolabs.org/][PHP Coding Standards Fixer]]

* Installation
** System part
Using straight
#+BEGIN_SRC elisp
(use-package php-cs-fixer
:straight (:type git :repo "Nazar65/emacs-php-cs-fixer")
:after php-mode)
#+END_SRC
** 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 :
#+BEGIN_SRC elisp
(add-hook 'php-mode-hook
(lambda ()
(add-hook 'before-save-hook 'php-cs-fixer-before-save)))
#+END_SRC

* 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.