PHPackages                             yard/nutshell - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. yard/nutshell

ActivePackage[Utility &amp; Helpers](/categories/utility)

yard/nutshell
=============

Package to enable Acorn in child themes

v2.1.1(7mo ago)01.4k↓37%[2 issues](https://github.com/yardinternet/nutshell/issues)[1 PRs](https://github.com/yardinternet/nutshell/pulls)MITPHPPHP &gt;=8.1CI passing

Since Dec 12Pushed 1mo ago2 watchersCompare

[ Source](https://github.com/yardinternet/nutshell)[ Packagist](https://packagist.org/packages/yard/nutshell)[ RSS](/packages/yard-nutshell/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (8)Dependencies (8)Versions (13)Used By (0)

Nutshell: Enhanced Acorn Support for WordPress Themes
=====================================================

[](#nutshell-enhanced-acorn-support-for-wordpress-themes)

[![Code Style](https://github.com/yardinternet/skeleton-package/actions/workflows/format-php.yml/badge.svg?no-cache)](https://github.com/yardinternet/skeleton-package/actions/workflows/format-php.yml)[![PHPStan](https://github.com/yardinternet/skeleton-package/actions/workflows/phpstan.yml/badge.svg?no-cache)](https://github.com/yardinternet/skeleton-package/actions/workflows/phpstan.yml)

**Nutshell** is a feature-rich package designed to extend [Acorn](https://roots.io/acorn/) for WordPress themes. It provides a flexible foundation for advanced theme development, including configuration inheritance, Sentry integration, Vite asset support, and more.

Features
--------

[](#features)

- **Child Theme Configuration Inheritance**:
    - Allows child themes to override parent configuration files without directory scans.
    - Uses a custom configuration repository to support unsetting and merging config values.
- **Vite Asset Support**:
    - Integrates with Vite for modern asset bundling and hot reloading.
- **Sentry Integration**:
    - Seamless error reporting via Sentry for Laravel.
- **Custom View Composers**:
    - Manual registration of view composers for fine-grained control.
- **Custom Console Commands**:
    - Register custom Artisan commands via configuration.

Requirements
------------

[](#requirements)

- PHP &gt;= 8.1
- [Acorn](https://github.com/roots/acorn) ^4.3
- Composer

Installation
------------

[](#installation)

1. Install this package with composer

    ```
    composer require yard/nutshell
    ```
2. Ensure your project's `composer.json` uses PSR-4 autoloading for your theme and childtheme and remove any redundant autoloading from the theme itself.

    ```
    "autoload": {
       "psr-4": {
       "App\\": "web/app/themes/sage/app/",
    +   "ChildTheme\\App\\": "web/app/themes/child-theme/app/",
       }
    },
    ```

Configuration
-------------

[](#configuration)

Important

After this change:

- View Composers in the app/View/Composers directory will no longer be loaded automatically. To ensure they are registered, you have to configure them manually.
- Console Commands in the app/Console/Commands directory will no longer be loaded automatically. To ensure they are register, you have to configure them manually.

1. **Child Theme Setup**

    - Create a child theme with Sage as the parent theme. See [WordPress Child Themes](https://developer.wordpress.org/themes/advanced-topics/child-themes/#how-to-create-a-child-theme).

        Example `style.css`:

        ```
        /**
           * Theme Name:         Sage Child Theme
           * Template:           sage
           * Theme URI:          https://www.example.com/sage-child/
           * Description:        Sage child theme
           * Version:            1.0.0
           * Author:             Example Inc.
           * Author URI:         http://www.example.com/
           * Text Domain:        sage
           * License:            MIT License
           * License URI:        https://opensource.org/licenses/MIT
           * Requires PHP:       8.1
           * Requires at least:  5.9
           */
           ```
        ```
    - Place your configuration files in `config/` within your child theme directory. These will be merged with the parent configuration where child theme configuration takes precedence. To unset a configuration option from the parent theme in the child theme you can pass an empty array for that configuration option.
2. **Update Acorn Bootloader**

    - In your theme's `functions.php`, use the `Yard\Nutshell\bootloader()` helper to bootstrap Acorn with Nutshell's enhancements.

        ```
        -\Roots\bootloader()->boot();
        +define('ACORN_BASEPATH', __DIR__);
        +\Yard\Nutshell\bootloader()->boot();
        ```
3. **Update app config**

    - In your themes `config/app.php' replace Acorn's ServiceProvider with Nutshell's ServiceProvider

        ```
        -use Roots\Acorn\ServiceProvider;
        +use Yard\Nutshell\ServiceProvider;
        ```
4. **Register View Composers**

    - Add your view composers to `config/view.php` under the `composers` key. Automatic discovery is disabled for explicit control.

        ```
        -  'composers' => [],
        +  'composers => [
        +    'app' => App\View\Composers\App::class,
        +    'comments' => App\View\Composers\Comments::class,
        +    'post' => App\View\Composers\Post::class,
        +  ],
        ```
5. **Register Console Commands**

    - Add custom Artisan commands to `config/console.php` under the `commands` key.

        ```
        +  'commands => [
        +    'test' => App\Console\Commands\Test::class,
        +  ],
        ```
6. **Vite Integration**

    - Vite is enabled by default. Use the provided `Yard\Nutshell\Assets\Vite` class for asset management.
7. **Sentry Integration**

    - Sentry is automatically integrated if `sentry/sentry-laravel` is installed and configured.

Usage
-----

[](#usage)

- **Configuration Inheritance**: Any config file in your child theme's `config/` directory will override the parent. Empty config files will unset the corresponding configuration.
- **View Composers**: Register all composers manually in `config/view.php`.
- **Console Commands**: Register all commands manually in `config/console.php`.
- **Vite**: Use the `@vite` directive or helper as usual; Nutshell ensures correct asset paths.
- **Sentry**: Errors and exceptions are reported to Sentry automatically.

About us
--------

[](#about-us)

[![banner](https://raw.githubusercontent.com/yardinternet/.github/refs/heads/main/profile/assets/small-banner-github.svg)](https://www.yard.nl/werken-bij/)

###  Health Score

44

—

FairBetter than 92% of packages

Maintenance79

Regular maintenance activity

Popularity20

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~42 days

Total

8

Last Release

227d ago

Major Versions

v1.2.0 → v2.0.02025-06-24

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/62775?v=4)[Anton Zhuravsky](/maintainers/Yard)[@yard](https://github.com/yard)

---

Top Contributors

[![ictbeheer](https://avatars.githubusercontent.com/u/14947039?v=4)](https://github.com/ictbeheer "ictbeheer (30 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (23 commits)")[![YvetteNikolov](https://avatars.githubusercontent.com/u/48315669?v=4)](https://github.com/YvetteNikolov "YvetteNikolov (4 commits)")[![FreakyWizard](https://avatars.githubusercontent.com/u/114140418?v=4)](https://github.com/FreakyWizard "FreakyWizard (2 commits)")[![dtakken](https://avatars.githubusercontent.com/u/2066447?v=4)](https://github.com/dtakken "dtakken (1 commits)")[![SimonvanWijhe](https://avatars.githubusercontent.com/u/41121933?v=4)](https://github.com/SimonvanWijhe "SimonvanWijhe (1 commits)")

###  Code Quality

Static AnalysisPHPStan

### Embed Badge

![Health badge](/badges/yard-nutshell/health.svg)

```
[![Health](https://phpackages.com/badges/yard-nutshell/health.svg)](https://phpackages.com/packages/yard-nutshell)
```

###  Alternatives

[supermundano/sage-the-events-calendar

1724.5k](/packages/supermundano-sage-the-events-calendar)[mwdelaney/sage-fonts-preload

Automatically preload fonts from the Sage mix manifest

188.3k](/packages/mwdelaney-sage-fonts-preload)[tombroucke/sage-bootstrap-components

Bootstrap 4 components for Sage

113.1k1](/packages/tombroucke-sage-bootstrap-components)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
