Skip to main content
Home

Main navigation

  • Home
  • Blogs
  • Team
  • Jobs
  • Contact

Right Menu

  • Hire

Configuring Drupal Coding Standards: Step-by-Step Guide

You can configure the Drupal conding standing by following the below steps:

Step 1:
 - Create the drupal directory 
 - Set its ownership
 - Clone the coder repo 

sudo mkdir -p /drupal

sudo chown $USER /drupal 

cd /drupal
git clone --branch 8.3.x http://git.drupal.org/project/coder.git 
 
cd coder && composer install 

Step 2:
 - Download the additional packages for analyze deprecated code.

composer require  --dev phpstan/phpstan \
  phpstan/extension-installer \
  mglaman/phpstan-drupal \
  phpstan/phpstan-deprecation-rules

Step 3:
 - Set the bin path to use the available commands

echo "export PATH=\"$PATH:/drupal/coder/vendor/bin\"" > ~/.profile 

Step 4:
 - Create the command aliases

# Add below aliases in the bashrc 
alias drupalcs="phpcs --standard=Drupal --extensions='php,module,inc,install,test,profile,theme,css,info,txt,md,yml'"
alias drupalcsp="phpcs --standard=DrupalPractice --extensions='php,module,inc,install,test,profile,theme,css,info,txt,md,yml'"
alias drupalcbf="phpcbf --standard=Drupal --extensions='php,module,inc,install,test,profile,theme,css,info,txt,md,yml'"
alias drupalstan="phpstan analyze --memory-limit=-1 --configuration=/drupal/coder/phpstan.neon"

Step 5:

- Execute the below command in terminal

source ~/.bashrc 

 
 

About us

We are a web development company. We have vast excperience in building web sites in Drupal CMS. We develop simple website to complex system to meet the client requirements.

 

Follow us

  facebook twitter instagram linkedin