Skip to content

Latest commit

 

History

History
184 lines (134 loc) · 4.99 KB

ide-settings-plugins.md

File metadata and controls

184 lines (134 loc) · 4.99 KB

IDE Settings and Plugins for Drupal Development

Overview

This guide covers IDE configurations, plugins, and settings optimized for Drupal development across popular IDEs and editors.

PhpStorm

Essential Plugins

Drupal-Specific:

Code Quality:

Development Workflow:

PhpStorm Configuration

Setup Drupal namespaces

On the main menu go to Code > Detect Drupal Namespace roots

File Templates

Add Drupal-specific file templates:

Drupal Module (.info.yml):

name: ${MODULE_NAME}
type: module
description: '${DESCRIPTION}'
package: Custom
core_version_requirement: ^9 || ^10 || ^11
dependencies:
  - drupal:node

Drupal Service (.services.yml):

services:
  ${MODULE_NAME}.${SERVICE_NAME}:
    class: Drupal\${MODULE_NAME}\${CLASS_NAME}
    arguments: ['@entity_type.manager', '@current_user']

Code Style Settings

  • Settings → Code Style → PHP
    • Set to "Drupal" coding standards
    • Enable "Use 'use' for classes from the current namespace"
    • Set array formatting to align values

Live Templates

Add custom live templates for Drupal:

// Drupal hook implementation
/**
 * Implements hook_$HOOK$().
 */
function $MODULE$_$HOOK$($PARAMETERS$) {
  $END$
}

// Drupal service injection
public function __construct($PARAMETERS$) {
  parent::__construct($PARAMETERS$);
  $END$
}

Settings Recommendations

Editor → General:

  • Enable "Show whitespaces"
  • Set tab size to 2 spaces
  • Enable "Ensure line feed at file end on Save"

Inspections:

  • Enable all Drupal-specific inspections
  • Configure PHPDoc inspections for Drupal standards

Sublime Text

Essential Packages

Install via Package Control:

  • Drupal - Drupal syntax highlighting and snippets
  • PHP-Twig - Twig template support
  • SublimeLinter-php - PHP linting
  • Composer - Composer support
  • YAML Nav - YAML file navigation

Sublime Text Settings

Preferences.sublime-settings

{
  "tab_size": 2,
  "translate_tabs_to_spaces": true,
  "ensure_newline_at_eof_on_save": true,
  "trim_trailing_white_space_on_save": true,
  "rulers": [80],
  "word_wrap": false
}

General IDE Configurations

Code Style Settings

For all IDEs, configure:

  • Indentation: 2 spaces (no tabs)
  • Line endings: LF (Unix)
  • Character encoding: UTF-8
  • Max line length: 80 characters
  • Trailing whitespace: Remove on save
  • Final newline: Ensure present

File Associations

Configure proper syntax highlighting for Drupal files:

  • .module → PHP
  • .install → PHP
  • .theme → PHP
  • .inc → PHP
  • .info.yml → YAML
  • .libraries.yml → YAML
  • .routing.yml → YAML
  • .services.yml → YAML
  • .twig → Twig/HTML

Indexing Optimization

Exclude unnecessary directories:

  • node_modules/
  • vendor/
  • web/sites/default/files/
  • .git/
  • Build directories (dist/, build/)

Team Development Standards

Shared Configurations

Store team IDE configurations in project:

  • .vscode/settings.json for VS Code
  • .idea/ directory for PhpStorm (selective commits)
  • .editorconfig for cross-IDE consistency

Code Quality Integration

  • PHP_CodeSniffer: Configure Drupal standards
  • PHPStan: Set up Drupal-specific rules
  • ESLint: Configure for Drupal JavaScript
  • Stylelint: Set up for Drupal CSS/SCSS

Resources