PHPackages                             shel/fusion-match - 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. shel/fusion-match

Abandoned → [neos/fusion](/?search=neos%2Ffusion)Neos-plugin

shel/fusion-match
=================

Match helper to simplify string matching in Neos Fusion

0.1.0(5y ago)5954GPL-3.0-or-laterPHP

Since Nov 30Pushed 4y ago1 watchersCompare

[ Source](https://github.com/Sebobo/Shel.Fusion.Match)[ Packagist](https://packagist.org/packages/shel/fusion-match)[ RSS](/packages/shel-fusion-match/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependencies (1)Versions (2)Used By (0)

Neos Fusion helper to simplify string matching
==============================================

[](#neos-fusion-helper-to-simplify-string-matching)

[![Latest Stable Version](https://camo.githubusercontent.com/f3caaf743d3c97c1e1baa507b27a4ec4678511a2c4f168dbfb83d64ea29f4456/68747470733a2f2f706f7365722e707567782e6f72672f7368656c2f667573696f6e2d6d617463682f762f737461626c65)](https://packagist.org/packages/shel/fusion-match)[![Total Downloads](https://camo.githubusercontent.com/6e48725eebb03c4289498d056706d123758794d212d57424f815bad0a0ea1603/68747470733a2f2f706f7365722e707567782e6f72672f7368656c2f667573696f6e2d6d617463682f646f776e6c6f616473)](https://packagist.org/packages/shel/fusion-match)[![License](https://camo.githubusercontent.com/283fb560f08550a6366930a2fcc0f0f195b1277ba1fa78acf70dc59955c7e2c0/68747470733a2f2f706f7365722e707567782e6f72672f7368656c2f667573696f6e2d6d617463682f6c6963656e7365)](https://packagist.org/packages/shel/fusion-match)

This package provides a Fusion object to simplify common string matching.

Inspired by the [PHP 8 match expression](https://www.php.net/manual/tr/control-structures.match.php).

The goal for this plugin is to provide the given functionality to [Neos CMS](https://www.neos.io) &gt;= 4.3 ⚠️ The features this package provides is included in Neos 7.3. Therefore this package will not be developed further.

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

[](#installation)

Run the following command in your site package:

```
composer require --no-update shel/fusion-match

```

Then run composer update in your project root.

Examples
--------

[](#examples)

### Basic

[](#basic)

The following Fusion code is very verbose and has repetitions:

```
rowClass = Neos.Fusion:Case {
    case1 {
      condition = ${q(node).property('columns') == "one"}
      renderer = "d-flex col-12 col-md-6 col-lg-12"
    }
    case2 {
      condition = ${q(node).property('columns') == "two"}
      renderer = "d-flex col-12 col-md-6 col-lg-6"
    }
    case3 {
      condition = ${q(node).property('columns') == "three"}
      renderer = "d-flex col-12 col-md-6 col-lg-4"
    }
    case4 {
      condition = ${q(node).property('columns') == "four"}
      renderer = "d-flex col-12 col-md-6 col-lg-3"
    }
}

```

With the `Match` object this becomes compact and readable:

```
rowClass = Shel.Fusion:Match {
    @subject = ${q(node).property('columns')}
    one = 'd-flex col-12 col-md-6 col-lg-12'
    two = 'd-flex col-12 col-md-6 col-lg-6'
    three = 'd-flex col-12 col-md-6 col-lg-4'
    four = 'd-flex col-12 col-md-6 col-lg-3'
}

```

### Providing a default

[](#providing-a-default)

You can also provide a default via `@default`:

```
rowClass = Shel.Fusion:Match {
    @subject = ${q(node).property('layout')}
    @default = ''
    left = 'my-module--left'
    right = 'my-module--right'
}

```

### Matches with same values

[](#matches-with-same-values)

Sometimes you have a Fusion case that would match to several strings with the same return value. You can solve this more explicit like this:

```
myVar = Shel.Fusion:Match {
    @subject = ${q(node).property('layout')}
    left = 'my-module--left'
    right = 'my-module--right'
    top = ${this.left}
    bottom = ${this.left}
}

```

### Other return types

[](#other-return-types)

```
myVar = Shel.Fusion:Match {
    @subject = ${q(node).property('someProperty')}
    @default = ''
    case1 = afx`
        hello world
    `
    case2 = 2
    case3 = Neos.Fusion:Value {
        value = 'hello world'
    }
    case4 = Neos.Fusion:DataStructure {
        my = 'array'
    }
}

```

Make sure all cases return the same type, or you will get into trouble 😉

### Usage in AFX

[](#usage-in-afx)

```
myVar = 'test'
renderer = afx`

            Hello world
            No match found

`

```

Type checking and error handling
--------------------------------

[](#type-checking-and-error-handling)

The object expects to find a match. Either one of the provided cases or the default. If no case matches and no default has been provided an exception will be raised.

The `subject` will be casted to a string. If a `subject` is provided that cannot be casted to a string it will also cause an error.

The matchable cases also will be cast to a string. So you can use strings or numbers.

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity43

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

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

Unknown

Total

1

Last Release

1989d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/5c9f106db319e8698dcb4aedfe8034f0442d379ebbd78fcd67b884999b2236f1?d=identicon)[Sebobo](/maintainers/Sebobo)

---

Top Contributors

[![Sebobo](https://avatars.githubusercontent.com/u/596967?v=4)](https://github.com/Sebobo "Sebobo (5 commits)")

---

Tags

fusionneoscmsFUSIONNeos CMS

### Embed Badge

![Health badge](/badges/shel-fusion-match/health.svg)

```
[![Health](https://phpackages.com/badges/shel-fusion-match/health.svg)](https://phpackages.com/packages/shel-fusion-match)
```

###  Alternatives

[yoast/yoast-seo-for-neos

Yoast SEO for Neos CMS

24164.8k](/packages/yoast-yoast-seo-for-neos)[suffle/snapshot

Snapshot Testing of standalone fusion components

135.1k](/packages/suffle-snapshot)[carbon/includeassets

Include your assets (css, js) in an easy way into Neos

14228.6k10](/packages/carbon-includeassets)[shel/critical-css

Allows inlining and optimising styles for components in Neos CMS

102.5k](/packages/shel-critical-css)[sandstorm/plumber

Profiling Toolkit for Neos Flow and Neos

384.9k](/packages/sandstorm-plumber)[shel/blog

A blog package for Neos CMS based on fusion AFX. Also supports atom feeds and AMP.

125.2k](/packages/shel-blog)

PHPackages © 2026

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