• Skip to primary navigation
  • Skip to main content
Sal Ferrarello
  • About Sal Ferrarello
  • Speaking
  • Connect
    Mastodon GitHub Twitter (inactive)
You are here: Home / Draft / PSR-2 EditorConfig

PSR-2 EditorConfig

Last updated on February 25, 2019 by Sal Ferrarello

The editorconfig project allows you to standardize general coding standards on a project.

I was working on a project where I needed to follow the PHP PSR-2 standard. This is the .editorconfig file I used.

# EditorConfig helps keep your project formatting consistent.
# See https://EditorConfig.org
#
# PHP PSR-2 Coding Standards
# http://www.php-fig.org/psr/psr-2/
#
# Author: Sal Ferrarello (@salcode)
#
# You can download this file directly
# to your project from the command-line with
# curl -O https://gist.githubusercontent.com/salcode/18eaa8cfa3b097da2f58b582197906d7/raw/.editorconfig
root = true
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = space
indent_size = 2
[*.php]
indent_size = 4
[*.md]
trim_trailing_whitespace = false
view raw .editorconfig hosted with ❤ by GitHub

For WordPress projects, I use my WordPress .editorconfig.

Sal Ferrarello
Sal Ferrarello (@salcode)
Sal is a PHP developer with a focus on the WordPress platform. He is a conference speaker with a background including Piano Player, Radio DJ, Magician/Juggler, Beach Photographer, and High School Math Teacher. Sal can be found professionally at WebDevStudios, where he works as a senior backend engineer.

Share this post:

Share on TwitterShare on FacebookShare on LinkedInShare on EmailShare on Reddit
Warning! This is a draft, not a finalized post. See full draft disclosure.

Filed Under: Dev Tips, Draft, Programming, Solution Tagged With: editorconfig

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Copyright © 2023 · Bootstrap4 Genesis on Genesis Framework · WordPress · Log in