laravel / pennant

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

Ability to map feature names #86

Closed ahinkle closed 8 months ago

ahinkle commented 8 months ago

This PR adds the ability to map feature names to other names.

This introduces a new method, Feature::enforceNameMap(), which provides a customized string that will get saved to the database. This allows for easy refactoring of class based features and shorter strings in the name column.


Feature::enforceNameMap([
    'admin' => AdministrationFeature::class,
    'old-feature' => NewFeature::class,
]);
timacdonald commented 8 months ago

@ahinkle, I've created a PR to document the existing feature that supports doing this: https://github.com/laravel/docs/pull/9322

ahinkle commented 8 months ago

Thanks! I realized that as soon as I submitted this PR 😆