Skip to content

Instantly share code, notes, and snippets.

@k4zuki02h4t4
Last active October 19, 2023 11:35
Show Gist options
  • Save k4zuki02h4t4/d9bc8179d223954c7385 to your computer and use it in GitHub Desktop.
Save k4zuki02h4t4/d9bc8179d223954c7385 to your computer and use it in GitHub Desktop.
WordPress Development using PhpStorm for Mac

WordPress Development using PhpStorm for OS X

WordPress を使った開発を行う時の、PhpStorm の設定メモ。

Install PHP & Composer & WP-CLI

$ brew install php56
$ brew install composer --ignore-dependencies
$ brew install wp-cli --ignore-dependencies

Install PHP Code Sniffer

$ brew install php-code-sniffer
$ git clone https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards.git --depth=1 /usr/local/Cellar/php-code-sniffer/2.3.4/CodeSniffer/Standards/wpcs
$ phpcs --config-set installed_paths /usr/local/Cellar/php-code-sniffer/2.3.4/CodeSniffer/Standards/wpcs
$ phpcs -i

Download WordPress Scheme

$ cd ${HOME}/Library/Preferences/PhpStorm2017.2/codestyles/
$ curl -LOk https://raw.githubusercontent.com/Automattic/PhpStorm-Resources/master/WordPress.xml

Settings PhpStorm

  • "Preferences > Editor > Inspections > PHP > PHP Code Sniffer validation" にチェックを入れる
  • "Preferences > Editor > Inspections > SQL > No data sources configured(データソースが構成させていません)" のチェックを外す
  • "Preferences > Editor > Inspections > SQL > SQL dialect detection(SQL ダイアレクトの検出)" のチェックを外す
  • Coding standard は WordPress core を選択
  • "Preferences > Editor > Code Style > Scheme" で WordPress を選択
  • "Preferences > Languages & Framework > PHP > WordPress > WordPress installation path" にパスを指定
  • "Preferences > Languages & Framework > PHP > Composer" にパスを指定
  • "Preferences > Tools > Command Line Tool Support" に WP-CLI と Composer を登録
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment