PHPackages                             wwwision/neos-features - 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. [Admin Panels](/categories/admin)
4. /
5. wwwision/neos-features

ActiveNeos-package[Admin Panels](/categories/admin)

wwwision/neos-features
======================

Feature System for Neos including backend module to manage feature states

1.1.0(2w ago)130MITPHPPHP &gt;=8.4CI passing

Since Jul 3Pushed 2w agoCompare

[ Source](https://github.com/bwaidelich/Wwwision.Neos.Features)[ Packagist](https://packagist.org/packages/wwwision/neos-features)[ GitHub Sponsors](https://github.com/sponsors/bwaidelich)[ Fund](https://www.paypal.me/bwaidelich)[ RSS](/packages/wwwision-neos-features/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (2)Dependencies (16)Versions (3)Used By (0)

Features for Neos
=================

[](#features-for-neos)

[Neos](https://neos.io) package providing a feature system including a backend module to activate, configure and deactivate global features of an installation

[![Screenshot of the Features backend module](screenshot.png)](screenshot.png)

How it works
------------

[](#how-it-works)

- Features are **declared** in `Settings.yaml` with an id, name, description, icon and optional group and dependencies
- Each feature is backed by a **PHP implementation** that reacts to the feature lifecycle (`activate` / `updateOptions` / `deactivate`) – for example by writing overrides to the dedicated `Settings.Features.yaml` and `NodeTypes.Features.yaml` configuration files
- Feature **states** (active flag and configured options) are stored in a YAML file underneath the `Data/` folder
- Features can **depend on each other**: dependencies are activated along with a feature (in the correct order) and a feature cannot be deactivated while active features still depend on it
- Relevant **caches are flushed** automatically whenever a feature state changes

Usage
=====

[](#usage)

1. Install the package via composer:

```
composer require wwwision/neos-features
```

2. Grant access to the backend module to the corresponding roles via `Policy.yaml`:

```
roles:
  'Neos.Neos:Administrator':
    privileges:
      - privilegeTarget: 'Wwwision.Neos.Features.Module:FeaturesModule'
        permission: GRANT
```

3. Declare a first feature via `Settings.yaml`:

```
Wwwision:
  Neos:
    Features:
      features:
        'dark-mode':
          name: 'Dark mode'
          description: 'Enables the dark theme in the site frontend'
          icon: 'moon'
```

Note

A feature that declares neither an `objectName` nor a `factoryClassName` is a *noop feature*: activating it merely records the state without further side effects. See [Feature implementations](#feature-implementations) below for features that actually do something.

4. Navigate to the new backend module

Log in as Neos administrator and navigate to the new "Features" module underneath the "Administration" main module, or head straight to `/neos/administration/features`

Declaring features
==================

[](#declaring-features)

Features and feature groups are declared underneath the `Wwwision.Neos.Features` settings:

```
Wwwision:
  Neos:
    Features:
      featureGroups:
        'marketing':
          name: 'Marketing'
          description: 'Marketing & tracking related features'
          icon: 'bullhorn'
      features:
        'maintenance-mode':
          name: 'Maintenance mode'
          description: 'Shows a maintenance page to visitors'
          icon: 'wrench'
          objectName: 'Some\Package\Features\MaintenanceModeFeature'
        'testimonials':
          name: 'Testimonial documents'
          description: 'Allows editors to create testimonial pages'
          icon: 'quote-right'
          group: 'marketing'
          factoryClassName: 'Wwwision\Neos\Features\Model\CommonFeatures\ActivateNodeTypeFeatureFactory'
          options:
            nodeType: 'Some.Package:Document.Testimonial'
        'testimonial-carousel':
          name: 'Testimonial carousel'
          description: 'Renders a carousel of testimonials on the homepage'
          group: 'marketing'
          dependsOn: ['testimonials']
```

Every feature supports the following settings:

- `name` – label displayed in the backend module (defaults to the feature id)
- `description` – optional description displayed in the backend module
- `icon` – optional [Font Awesome](https://fontawesome.com/v5/search) icon name
- `group` – optional id of a group declared underneath `featureGroups`
- `dependsOn` – optional list of feature ids this feature depends on
- `position` – optional position of the feature within its group, supporting the usual `start`/`end`/`before `/`after ` syntax
- `objectName` – optional class name of a [feature implementation](#feature-implementations)
- `factoryClassName` – optional class name of a [feature factory](#feature-factories) (mutually exclusive with `objectName`)
- `options` – optional *factory options*, only allowed in combination with `factoryClassName`

The dependency graph is validated eagerly: unknown `dependsOn` references, dependency cycles and unknown `group` references all fail at load time with a corresponding exception.

Feature implementations
=======================

[](#feature-implementations)

The behavior of a feature is provided by a PHP class implementing one of two interfaces:

- `OptionlessFeatureImplementation` – for features without configuration: `activate(context)` / `deactivate(context)`
- `ConfigurableFeatureImplementation` – for features with typed options: `activate(context, options)` / `updateOptions(context, previous, new)` / `deactivate(context, previousOptions)`

Optionless features
-------------------

[](#optionless-features)

The following example enables/disables a (fictional) dark mode setting of the site package by writing to the shared [settings file](#the-feature-context):

```
