ylsideas/feature-flags

UPGRADE.md doesn't mention what to do with routes and YlsIdeas\FeatureFlags\Middleware\FeatureFlagState

antonvialibri1 opened this issue ยท 5 comments

What happened?

Hello ๐Ÿ‘‹ ,

From the UPGRADE.md file it is not clear what we should do with YlsIdeas\FeatureFlags\Middleware\FeatureFlagState.

In v1, we added the following line within the $routeMiddleware array in app/Http/Kernel.php like this:

    protected $routeMiddleware = [
        ...
        'feature' => \YlsIdeas\FeatureFlags\Middleware\FeatureFlagState::class,
    ];

FeatureFlagState doesn't exist anymore in v2.
What should we do with it as part of the v2 upgrade? Can we just remove it?

And will all our routes defined like in the example below continue to work seamlessly?

// routes/web.php

...

Route::prefix('some-page')->name('some-page.')->middleware('feature:some-feature')->group(function () {
  ...

Thanks!

How to reproduce the bug

Package Version

2.4.0

PHP Version

8.0.0

Laravel Version

9.0.0

Which operating systems have you found this bug with?

No response

Notes

No response

Another thing. What is this Features Route/Controller mentioned here?

https://github.com/ylsideas/feature-flags/blob/main/UPGRADE.md#removal-of-the-features-controllerroute

I'm not sure how we should check in our codebase if there's anything we need to change because this Features route/controller has been removed.

Thanks!

Hi @antonvialibri1

The middleware is now automatically applied when you install the package unless to decide you want to turn it off.

I'm not sure how we should check in our codebase if there's anything we need to change because this Features route/controller has been removed.

I can only help with this one a little. Unless you can find a reference to that feature controller within your app's routing files, chances are you weren't using it. You can use the php artisan route:list command to list all routes used.

It was a poorly thought-out feature at the time, so I removed it for v2.

@peterfox OK, thanks! The route you mention is called feature? Where is that documented in v1?

It's missing in the v1 docs if I'm honest ๐Ÿ˜…

OK, thank you for the prompt replies! I think we can close this issue.