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
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.
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.
Who needs copy/paste? Right. Writing code from scratch is fun!
Total Lab Runtime: 01:01:34
In order to be proficient in PHP, you need to first know variables. It's learn and do time. In this lab, you are focusing on user-defined variables, the data they represent, how they are passed and assigned into function parameters' list, naming, and their scope. For Pro members, you learn more about the PHP internals, how variables are linked to their data, and how memory moves around under the hood.
Check out the PHP Library for more hands-on labs, insights, Docx, and more.