Start a project
To start a new plugin project using this boilerplate, run:
This command creates a new directory, named wp-starter-plugin
, and downloads the boilerplate files into the directory. It will also prompt a few questions to set up the project details, such as the project name, the plugin name, the plugin slug, and the PHP namespace.
Once we’ve input all these details, it will run a command to scope the plugin dependencies to prevent naming conflicts with other plugins. You can find the scoped dependencies in the dist-autoload
directory.
Once the project setup is complete, run the following command to start compiling the assets, like the stylesheet and the JavaScript files, and watching for the changes within the files:
(Alternative) Use Github template
We can also create a new project from the repository template.
Strat from the Use this template button at the top of this page to create a new repository with the same files.
However, unlike the Composer method, which immediately pulls and sets up the boilerplate, you will need to clone the repository and run the following commands to set up the project:
-
Set up the project details: project name, plugin name, plugin slug, and PHP namespace.:
-
Scope Composer dependencies to prevent class name collisions:
For more information, see Creating a repository from a template.