Skip to content

WP Packages is our new WPackagist replacement that's 17x faster and updates every 5 minutes

Acorn

Roots is an independent open source org, supported only by developers like you. We’ve been improving the WordPress developer experience since 2011, and your support keeps it independent.

Acorn Application Directory Structure

View as Markdown:

Zero-config setup

Out of the box, Acorn will use its own configs, and it will keep the application cache and logs in the standard WordPress cache directory:

[wp-content]/          # wp-content directory ("app" if you're using Bedrock)
├── cache/
│   └── /acorn/        # Private application storage ("storage" directory)
│       ├── app/       # Files generated or used by the application
│       ├── framework/ # Files generated or used by Acorn (never edit)
│       └── logs/      # Application logs
└── themes/
    └── [theme]/       # Theme directory (e.g., "sage")
        ├── app/       # Core application code
        ├── public/    # Built application assets (never edit)
        ├── resources/ # Uncompiled source assets and views
        │   └── views/ # Application views to be compiled by Blade
        └── vendor/    # Composer packages (never edit)

Traditional setup

Acorn also supports a more traditional Laravel-esque structure. We recommend this approach if you are adding Acorn/Laravel packages and want to have more control over your app.

If you've installed Acorn from your Bedrock project root, Acorn's config/ directory will conflict with Bedrock's. We recommend using Radicle to avoid this.

There are no conflicts with the config/ directory if you've installed Acorn from your theme.

root/              # Base directory for your Acorn application (e.g., "sage")
├── app/           # Core application code
├── config/        # Application configuration
├── public/        # Built application assets (never edit)
├── resources/     # Uncompiled source assets and views
│   └── views/     # Application views to be compiled by Blade
├── storage/       # Private application storage
│   ├── app/       # Files generated or used by the application
│   ├── framework/ # Files generated or used by Acorn (never edit)
│   └── logs/      # Application logs
└── vendor/        # Composer packages (never edit)

You can manually create a config/ directory, or you can automatically set up the traditional structure with WP-CLI (see below).

If you have a config/ directory, you can drop your desired config files in there. any that are missing (such as app.php) will just be pulled from Acorn's config directory.

WP-CLI commands for setting up the traditional structure

You can automatically set up the traditional structure via WP-CLI:

$ wp acorn acorn:init storage && wp acorn vendor:publish --tag=acorn

Alternatively, you can choose to only copy the config files.

$ wp acorn vendor:publish --tag=acorn

Advanced directory modifications

You can modify the path for any Acorn directory by defining the following constants:

  • ACORN_BASEPATH
  • ACORN_APP_PATH
  • ACORN_CONFIG_PATH
  • ACORN_STORAGE_PATH
  • ACORN_RESOURCES_PATH
  • ACORN_PUBLIC_PATH

Last updated