Skip to content

kermorgant/php-cs-fixer.el

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 

Repository files navigation

Emacs wrapper for PHP-CS-Fixer

This package intergates PHP Coding Standards Fixer into Emacs.

NOTICE: This package was started before I discovered https://github.com/OVYA/php-cs-fixer, which you should probably consider using if you’re reading this.

Installation

You need to have PHP-CS-Fixer (https://github.com/FriendsOfPHP/PHP-CS-Fixer) installed

If it is in your path, it should be detected automatically.

configuration with use-package

(use-package php-cs-fixer :ensure nil
   :load-path "~/src/php-cs-fixer.el"
   :config (setq php-cs-fixer--enable nil)) ;; disable it globally if you plan to enable it per folder

fix style on save

With a buffer-local hook :

(add-hook 'php-mode-hook
          (lambda () (add-hook 'before-save-hook #'php-cs-fixer--fix nil 'local)))

In case you setup a before-save-hook, you might want to tune php-cs-fixer--enable to control on which projects it runs.

Usage

Run php-cs-fixer--fix to fix code style for the current buffer. In case a .php_cs or .php_cs.dist file is found in the project root (as guessed by php-project), it will be used.

About

wrapper for PHP-CS-Fixer

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published