Skip to content

Start a project

To start a new plugin project using this boilerplate, run:

Terminal window
composer create-project syntatis/wp-starter-plugin -s dev

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:

Terminal window
npm install
npm run start

(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:

  1. Set up the project details: project name, plugin name, plugin slug, and PHP namespace.:

    Terminal window
    composer syntatis:project init
  2. Scope Composer dependencies to prevent class name collisions:

    Terminal window
    composer scope

For more information, see Creating a repository from a template.