laravel / pennant

A simple, lightweight library for managing feature flags.
https://laravel.com/docs/pennant
MIT License
482 stars 49 forks source link

[1.x] Add a new `@featureany` directive #122

Closed ryangjchandler closed 2 months ago

ryangjchandler commented 2 months ago

Similar to the @canany directive that Laravel provides, this new directive allows you to check the status of multiple features at once with boolean OR behaviour with the @featureany directive.

@featureany(['foo', 'bar'])
    foo or bar is active
@else
    foo and bar are inactive
@endfeatureany

I went for the featureany since it is more inline with other directives that do a similar thing, but I also had the idea of adding array support to the regular @feature directive.

There's no value comparison support because it didn't make sense since different features will likely have different values.

Open to feedback of course!

timacdonald commented 2 months ago

Thanks!