Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pivaldi/php-cs-fixer
php-cs-fixer wrapper for the Emacs editor
https://github.com/pivaldi/php-cs-fixer
emacs emacs-configuration php-cs-fixer
Last synced: 3 months ago
JSON representation
php-cs-fixer wrapper for the Emacs editor
- Host: GitHub
- URL: https://github.com/pivaldi/php-cs-fixer
- Owner: pivaldi
- License: bsd-3-clause
- Created: 2015-09-04T07:28:20.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2024-11-03T12:33:11.000Z (3 months ago)
- Last Synced: 2024-11-03T13:25:34.922Z (3 months ago)
- Topics: emacs, emacs-configuration, php-cs-fixer
- Language: Emacs Lisp
- Size: 43 KB
- Stars: 20
- Watchers: 6
- Forks: 13
- Open Issues: 1
-
Metadata Files:
- Readme: README.org
Awesome Lists containing this project
README
* PHP-CS-Fixer Wrapper for Emacs
** 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 partInstall [[https://github.com/FriendsOfPHP/PHP-CS-Fixer][PHP-CS-Fixer]] so that the command line =php-cs-fixer= is
executable in your system.*** Emacs part
**** From Melpa
This package can be installed from [[https://melpa.org/#/php-cs-fixer][Melpa]] : =M-x package-install php-cs-fixer =
**** Manually
This package requires that the =cl-lib= package was installed.
To install =php-cs-fixer.el=, place =php-cs-fixer.el= in a
directory of your choice, add it to your load path and require
=php-cs-fixer= writing this code in your emacs configuration file (aka .emacs) :#+BEGIN_SRC elisp
(add-to-list 'load-path "/place/where/you/put/it/")
(require 'php-cs-fixer)
#+END_SRCEither evaluate both statements with =C-x C-e=, or restart /Emacs/.
** 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 :
#+BEGIN_SRC elisp
(add-hook 'before-save-hook 'php-cs-fixer-before-save)
#+END_SRC** Customisable variables
- =php-cs-fixer-command= is the =php-cs-fixer= command (default is =php-cs-fixer=) ;
- =php-cs-fixer-config-option= is the =php-cs-fixer --config= option value (default is =nil=, see the file
=php-cs-fixer-config.php= for an example of configuration file) ;
- =php-cs-fixer-rules-level-part-options= is the =php-cs-fixer --rules= base part options value (default is '("@Symfony")) ;
- =php-cs-fixer-rules-fixer-part-options= is the =php-cs-fixer --rules= exact rules part options
value (default is =("no_multiline_whitespace_before_semicolons" "concat_space")=).Try =M-x customize-group [ret] php-cs-fixer [ret]= to modify the values of these variables.