Acorn v5.0.0-beta.0 released

acorn v5.0.0-beta.0 released

What’s Changed

New Contributors

Full Changelog: https://github.com/roots/acorn/compare/v5.0.0-alpha.1...v5.0.0-beta.0

3 Likes

:information_source: We’ve been running Acorn v5 on the roots.io site since the beginning of June and haven’t hit any critical bugs

Want to try out Acorn v5 (Laravel v11)? Here’s some upgrade notes that will eventually be added to the upgrade guide:

General

  • PHP 8.2 is required
  • You should probably delete config/app.php if it exists
  • Run composer require roots/acorn ^5.0 -W
    • If any packages/dependencies have conflicts while updating, try removing and then re-requiring them after Acorn is bumped to 5.x
If you're using Sage

Replace your functions.php file with:

<?php

use Roots\Acorn\Application;

/*
|--------------------------------------------------------------------------
| Register the Auto Loader
|--------------------------------------------------------------------------
|
| Composer provides a convenient, automatically generated class loader for
| our theme. We will simply require it into the script here so that we
| don't have to worry about manually loading any of our classes later on.
|
*/

if (!file_exists($composer = __DIR__ . '/vendor/autoload.php')) {
    wp_die(__('Error locating autoloader. Please run <code>composer install</code>.', 'sage'));
}

require $composer;

/*
|--------------------------------------------------------------------------
| Configure and boot the Acorn application
|--------------------------------------------------------------------------
|
| The first thing we will do is schedule a new Acorn application container
| to boot when WordPress is finished loading the theme. The application
| serves as the "glue" for all the components of Laravel and is
| the IoC container for the system binding all of the various parts.
|
*/

if (!class_exists(Application::class)) {
    wp_die(
        __('You need to install Acorn to use this theme.', 'sage'),
        '',
        [
            'link_url' => 'https://roots.io/acorn/docs/installation/',
            'link_text' => __('Acorn Docs: Installation', 'sage'),
        ]
    );
}

Application::configure()
    ->withProviders([
        App\Providers\ThemeServiceProvider::class,
    ])
    ->boot();

/*
|--------------------------------------------------------------------------
| Register Sage Theme Files
|--------------------------------------------------------------------------
|
| Out of the box, Sage ships with categorically named theme files
| containing common functionality and setup to be bootstrapped with your
| theme. Simply add (or remove) files from the array below to change what
| is registered alongside Sage.
|
*/

collect(['setup', 'filters'])
    ->each(function ($file) {
        if (!locate_template($file = "app/{$file}.php", true, true)) {
            wp_die(
                /* translators: %s is replaced with the relative file path */
                sprintf(__('Error locating <code>%s</code> for inclusion.', 'sage'), $file)
            );
        }
    });

If you're using Radicle

Replace your public/content/mu-plugins/00-acorn-boot.php file with:

<?php

use Roots\Acorn\Application;
use Roots\Acorn\Configuration\Exceptions;
use Roots\Acorn\Configuration\Middleware;

add_action('after_setup_theme', function () {
    Application::configure()
        ->withProviders([
            App\Providers\ThemeServiceProvider::class,
        ])
        ->withMiddleware(function (Middleware $middleware) {
            //
        })
        ->withExceptions(function (Exceptions $exceptions) {
            //
        })
        ->withRouting(
            web: base_path('routes/web.php'),
        )
        ->boot();
}, 0);
3 Likes