In this lab, you will build your first custom WordPress Starter plugin from scratch. This plugin will be used as a sandbox tester for the lab work you will do here on Know the Code. It’s a starter plugin that gives you a testing environment away from your other plugins and theme.
This plugin will include:
- Composer – Dependency Manager for PHP
- Kint – a modern and powerful PHP debugging helper
- Whoops – PHP errors for cool kids
Options if you don’t want to build this plugin
Throughout the labs in our libraries, we use this plugin for testing and writing code snippets. But this plugin requires Composer. Maybe you don’t want to install Composer on your machine. Okay, in that case, you don’t have to build this plugin. Instead, you can do the testing in Hello Dolly.
But you will need Kint. It’s an awesome tool that replaces doing print_r
and var_dump
. Once you use it, you are going to love it like I do. You have choices for getting Kint into your workflow.
- Easiest: Install my Kint PHP Debugger plugin, available through the Plugin Directory.
- Gives you Composer + Kint: Install Composer as shown in this lab and then you’ll be able to install Kint using Composer.
- Professional Setup: Install Composer and then use UpDevTools plugin.
The choice is yours.
Prerequisites
You will need the following things before you can start on this lab:
- Composer – Before you get started, make sure you have Composer installed on your development machine. Not to worry if you need some help, as we have labs for you
- Local web server, such as WAMP, MAMP, Vagrant, or DesktopServer.
- Editor – Use a professional editor. I use PhpStorm
- Terminal – for command line utility – Windows | Mac – I use PhpStorm in the videos.
Your best friend is code, Tonya is making the introductions.
Episodes
Total Lab Runtime: 01:01:34
- 1 Lab Introductionfree 04:32
- 2 Plugin File and Folder Structurefree 04:07
- 3 Plugin Header DocBlockfree 06:56
- 4 What is a DocBlock?free 07:24
- 5 Setup Composer in Your Pluginfree 11:13
- 6 Introduction to Kintfree 09:34
- 7 Introduction to Whoopsfree 05:28
- 8 Let's Test It Outfree 12:20