Skip to content

Latest commit

 

History

History
64 lines (47 loc) · 1.37 KB

README.md

File metadata and controls

64 lines (47 loc) · 1.37 KB

WP Beautiful PHP

Fix your Wordpress PHP code with PHP CS Fixer bin (https://github.com/FriendsOfPHP/PHP-CS-Fixer).

How to install

wp package install [email protected]:opsone/wp-beautiful-php.git

Commands and examples

  • wp beautiful php --what=core: Fix all php files in the Wordpress Core. (exclude : wp-content/themes/)

  • wp beautiful php --what=themes: Fix all php files in wp-content/themes folder.

  • wp beautiful php --what=themes --themename=mytheme: Fix all php files in 'mytheme' theme folder.

Options

You can create a wp-cli.yml file to add some options to commands. For example, you can exclude some files or folders.

php-fixer:
  excludes:
    files:
      - 'index.php'
      - ...
    folders:
      - 'wp-includes'
      - 'wp-admin'
      - ...

Default options

Some Wordpress files and folders are excluded by default :

wp-content/plugins
wp-config.php

You can set some files or folders to exclude with the wp-cli.yml option file.

Some PHP CS Fixer options are set by default :

'single_quote'       => true
'trim_array_spaces'  => true
'no_useless_else'    => true
'elseif'             => true
'align_double_arrow' => true
'align_equals'       => true

Please refer to the PHP CS Fixer Github documentation to get more informations about that.

Uninstall

wp package uninstall opsone/wp-beautiful-php