Your web browser is out of date. Update your browser for more security, speed and the best experience on this site.

Update your browser

Jan 13, 2020 • By Jake Dohm

Quick Start: Developing a Craft 3 Plugin

An illustration of a big old piece of machinery

Creating a plugin for Craft CMS can be intimidating, but if you’re comfortable developing with Craft, we believe you’re 100% ready to take the leap! The following guide is a step-by-step process for creating and installing a Craft 3 plugin in just minutes.

Creating Your Plugin

Step #1: Create a plugin skeleton

Plugin Factory is an amazing tool that allows users to create a basic plugin framework that you can build on, and we highly recommend using it as a starting point. If you'd rather build out your plugin from scratch, you can refer to the Craft docs to set up the basic plugin structure.

Step #2: Register your plugin with Composer

When developing a plugin you’ll want to work on it locally, without registering it with something like Packagist, so that you don't have to push releases every time you make a change. To install a local plugin as a package you'll need to make a few changes to your composer.json file. Add the following to your composer.json (replacing the "url" with the relative path to the plugin):

  "minimum-stability": "dev",
  "prefer-stable": true,
  "repositories": [
      "type": "path",
      "url": "./plugins/my-plugin-name"

Step #3: Require your plugin

While Composer now knows where to find your plugin, it still hasn't been installed by Composer. We can "require" our plugin with Composer, just like we would a published package using the plugin's package name. To find the package name look at the composer.json file inside of your plugin folder. The name property is the package name. Once you've found the package name, run composer require package-name to add your plugin.

Tip: Your plugin's name should look something like this: simplygoodwork/my-plugin-name

Because of the configuration we added in the above step, Composer will create a symlink to your plugin instead of attempting to download it from the registry like it normally would.

Step #4: Install your plugin

Your plugin should now be successfully installed by Composer, but we still need to install it with Craft. Login to your Control Panel, navigate to Settings > Plugins, and install the plugin.

Tip: To test whether your plugin is working, place some "dump and die" code within your plugin's init method, like this:

      /* File: ./plugins/barracuda/src/Barracuda.php */

// ...

public function init() {
  print("Testing Plugin!");

// ...

If your plugin is properly installed it should show ​“Testing Plugin” on a blank page when you try to visit your website or Control Panel.

Step #5: Profit

You’re done! When you’re ready to publish your plugin to be publicly accessible, follow this guide in the Craft docs: https://​docs​.craftcms​.com/​v​3​/​e​x​t​e​n​d​/​p​l​u​g​i​n​-​s​t​o​r​e​.html

Plugins allow you to extend the core functionality of your Craft website, and there are hundreds already available through Craft’s plugin store (including some of our favorites). However, there are times when creating your own plugin can not only solve your own needs, but hopefully provide a valuable tool for other Craft websites. Hopefully this guide kickstarts that process!

An illustration of an old location closing soon and a new location opening

Further Reading

Mar 01, 2019 • By Garrett Winder

Updating your website to Craft CMS 3

Since 2012 Craft CMS has rapidly increased in popularity and been adopted by an ever-growing list of household brands. Craft's modern approach to content management, and extreme design flexibility, has garnered high praise from both developers and content editors. It offers users an expanding roadmap of modern features and has a thriving community …

Don’t let chaotic web projects get you down.

Get a web project — and a development process — that wows.

Sign up for our newsletter.

We send a few emails every month with helpful articles and resources for people who make and manage websites.