Giter Club home page Giter Club logo

php-cs-fixer's Introduction

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

Install 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 Melpa : `M-x package-install <RET> php-cs-fixer <RET>`

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) :

(add-to-list 'load-path "/place/where/you/put/it/")
(require 'php-cs-fixer)

Either 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 the line :

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

Customisable variable

  • /`php-cs-fixer-command`/ : the ‘php-cs-fixer’ command (default is “php-cs-fixer”) ;
  • `php-cs-fixer-config-option`/ : 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`/ : the ‘php-cs-fixer’ –rules base part options value (default is ‘(“@Symfony”)) ;
  • /`php-cs-fixer-rules-fixer-part-options`/ : 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.

php-cs-fixer's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.