100%
  • Home
  • Courses
    • View All
Login
  • Home
  • Courses
  • Log In
  • View All
Home WordPress Training Program Coding Standards and Best Practices πŸ’― PHP_CodeSniffer (PHPCS)

Course Lessons

WordPress Training Program

1 Getting started with WordPress πŸ“£
  • What is WordPress
  • Creating a blog and writing daily updates ✍️
  • Installing WordPress
  • WordPress Terminology πŸ“ƒ
  • How WordPress works
  • Understanding WordPress Database Schema
  • Using themes and plugins
2 Setting up Development Environment πŸ‘¨β€πŸ’»
  • Introduction to Git and SVN πŸ”„
  • Setting up an Integrated Development Environment (IDE)
  • Pushing changes to site via Git commits/branches
  • Setting up Z shell and Oh My Zsh for fast command line work
3 Coding Standards and Best Practices πŸ’―
  • WordPress Coding Standards (WPCS)
  • PHP_CodeSniffer (PHPCS)
  • Peer Code Review
  • Security πŸ›‘οΈ
  • WordPress Documentation Schema
4 Plugin Development πŸ› οΈ
  • Introduction to plugin development
  • Hooks: Actions and Filters
  • Custom Post Types and Taxonomies
  • WordPress Core APIs
  • WP_Query (Custom Query)
  • WordPress AJAX
  • Interacting with remote data and APIs
  • Plugin development assignment
5 Theme Development πŸ‘€
  • Anatomy and architecture of a theme
  • Theme Stylesheet and Functions file
  • Template files and hierarchy
  • Customizer
  • Asset Building using Webpack & Babel
  • Child Themes
  • Handling Media in WordPress
  • Theme development assignment
6 Debugging 🐞
  • Introduction to Xdebug
  • EasyEngine site debugging with docker commands
  • How to check Nginx, PHP, and WP Debug logs
7 Advanced Concepts πŸ“œ
  • WP-CLI
  • REST API
  • Roles and Capabilities
  • Caching
  • Custom Database Table Creation
  • Optimization ⚑
  • Users and User metadata
  • Cron β³βš™οΈ
  • Background Processing
  • Internalization and Localization 🌐
  • Multisite
  • Email with WordPress πŸ“§
8 Block Editor (Gutenberg) πŸ—οΈ
  • Default Blocks
  • Creating a block
9 Testing πŸ€“
  • PHPUnit Test
  • JavaScript: QUnit, Jest
  • ESLint, JSLint, JSHint, JSCS
  • CSS: Stylelint
10 Extras πŸ˜ƒ
  • Decoupled
  • GraphQL
  • React and Next.js
  • WooCommerce πŸ›’
  • Accessibility (WCAG 2.0) πŸ”
11 Contributing to WordPress ❀️
12 Server Side πŸ–₯️
  • How to check CPU/Memory/Disk Space on a server
  • Rsync and SSH basics
  • How to sync one site with other using WP-CLI and rsync
  • Tmux basics
13 Congratulations πŸ₯³
Return to WordPress Training Program

Trainer(s)

There is no group/trainer

WordPress Training Program

PHP_CodeSniffer (PHPCS)

If you have set up your IDE in Setting up an Integrated Development Environment (IDE) you can skip this topic. In case you are facing any issue, just go through the below content.

Just like how WordPress follows a set of coding standards, PHP has its own coding standards. Since WordPress is primarily based on PHP, following these coding standards is a must if you want to develop reliable web applications.

You can use PHP_CodeSniffer to check your code against defined coding standards and get alerted you if there are any violations.

PHPCS Installation

If you are not sure if you had installed PHPCS previously, you can check your system by running the which phpcs command. It should return the path of the current PHPCS installation. If nothing was returned, then you probably haven’t installed phpcs before.

You can find the version of PHPCS you are running by running phpcs --version.

Composer Install/Update

Assuming you have PHP and Composer already installed,

Go to composer dir cd ~/.composer

composer global require "squizlabs/php_codesniffer=*"

If you have PHPCS already installed, you can run composer update squizlabs/php_codesniffer to update it.

And you can check the version by running ./vendor/bin/phpcs --version

Add ~/.composer/vendor/bin to $PATH in .bashrc or .zshrc and reload the terminal or open a new tab.

Direct Download

curl -OL https://squizlabs.github.io/PHP_CodeSniffer/phpcs.phar && chmod +x phpcs.phar && mv phpcs.phar /usr/local/bin/phpcs

curl -OL https://squizlabs.github.io/PHP_CodeSniffer/phpcbf.phar && chmod +x phpcbf.phar && mv phpcbf.phar /usr/local/bin/phpcbf

You can also change /usr/local/bin/ to a custom path like ~/.bin and add that custom path to $PATH as mentioned above in the Composer Install/Update section.

Recommended Resources

  • PHP_CodeSniffer on GitHub
  • PHP CodeSniffer for Visual Studio Code
  • Installing and configuring PHP Code Sniffer in PhpStorm
  • WordPress Coding Standards

Fixing PHPCS Errors

Whitelisting code which flags errors

← Previous Topic

Copyright 2017-25 All Rights Reserved | Designed by WisdmLabs