Skip to content
  1. Blog

Creating an Acorn Package

Brandon Nifong Brandon Nifong

Have you been wondering how to get started with developing an Acorn package? We’ve updated the Acorn Package Development documentation and published a acorn-example-package repo to help you get started.

Why create an Acorn package?

Think about Acorn packages similar to any other dependency, like a WordPress plugin. If you ever want to reuse functionality on your Acorn sites, or release functionality as an open-source library, then creating an Acorn package is the ideal way to do so. By extracting your code into a package, you can make it easier to maintain your reusable code.

Packages can be anything from a simple utility class to a complex system with configuration, views, and WP-CLI commands.

Acorn packages are installed by Composer, just like Acorn itself is.

If you aren’t yet familiar with Laravel packages and service providers, make sure to read Laravel’s Package docs.

Getting started with Acorn package development

Visit the acorn-example-page repo on GitHub and then click the Use this template button to create a new repo with the template.

After creating your repo from the template, run the configure script to replace the placeholder names with your own:

$ php configure.php

The script will prompt you for your vendor name, package name, namespace, and other details. See the package development docs for non-interactive and dry-run usage.

You can work on a package locally by defining a local repository for the package on your WordPress project.

Existing packages to reference

There are several packages available for Acorn. Here are the first-party packages from Roots:

And a few community packages worth checking out:

Create your own packages and share them with us on Roots Discourse!

Discuss this post on Roots Discourse

About the author

Brandon Nifong

Brandon is a full-time internet marketer with over 14 years of web development experience. In his free time, he enjoys gaming and traveling with his wife.

Subscribe for updates

Join over 8,000 subscribers on our newsletter to get the latest Roots updates and tips on building better WordPress sites

Looking for WordPress plugin recommendations, the newest modern WordPress projects, and general web development tips and articles?

One last step! Check your email for a verification link.