spatie / laravel-enum

Laravel support for spatie/enum
https://spatie.be/open-source
MIT License
344 stars 37 forks source link

Does laravel-enum v2 require laravel-framework v8? #56

Closed kevindb closed 4 years ago

kevindb commented 4 years ago

I am trying to install spatie/laravel-enum 2.1 in my project running laravel-framework 7.19.1. (full error below) composer require spatie/laravel-enum --update-with-dependencies

My guess is that spatie/laravel-enum requires illuminate/http ^8.0 and that is only available in Laravel 8? If so, does that mean that laravel-enum v2 is only compatible with laravel-framework v8?

  Problem 1
    - Installation request for spatie/laravel-enum ^2.1 -> satisfiable by spatie/laravel-enum[2.1.0].
    - Conclusion: remove laravel/framework v7.19.1
    - Conclusion: don't install laravel/framework v7.19.1
    - spatie/laravel-enum 2.1.0 requires illuminate/http ^8.0 -> satisfiable by illuminate/http[8.x-dev, v8.0.0, v8.0.1, v8.0.2, v8.0.3, v8.0.4, v8.1.0, v8.10.0, v8.11.0, v8.11.1, v8.11.2, v8.12.0, v8.12.1, v8.2.0, v8.3.0, v8.4.0, v8.5.0, v8.6.0, v8.7.0, v8.7.1, v8.8.0, v8.9.0].
    - don't install illuminate/http 8.x-dev|don't install laravel/framework v7.19.1
    - don't install illuminate/http v8.0.0|don't install laravel/framework v7.19.1
    - don't install illuminate/http v8.0.1|don't install laravel/framework v7.19.1
    - don't install illuminate/http v8.0.2|don't install laravel/framework v7.19.1
    - don't install illuminate/http v8.0.3|don't install laravel/framework v7.19.1
    - don't install illuminate/http v8.0.4|don't install laravel/framework v7.19.1
    - don't install illuminate/http v8.1.0|don't install laravel/framework v7.19.1
    - don't install illuminate/http v8.10.0|don't install laravel/framework v7.19.1
    - don't install illuminate/http v8.11.0|don't install laravel/framework v7.19.1
    - don't install illuminate/http v8.11.1|don't install laravel/framework v7.19.1
    - don't install illuminate/http v8.11.2|don't install laravel/framework v7.19.1
    - don't install illuminate/http v8.12.0|don't install laravel/framework v7.19.1
    - don't install illuminate/http v8.12.1|don't install laravel/framework v7.19.1
    - don't install illuminate/http v8.2.0|don't install laravel/framework v7.19.1
    - don't install illuminate/http v8.3.0|don't install laravel/framework v7.19.1
    - don't install illuminate/http v8.4.0|don't install laravel/framework v7.19.1
    - don't install illuminate/http v8.5.0|don't install laravel/framework v7.19.1
    - don't install illuminate/http v8.6.0|don't install laravel/framework v7.19.1
    - don't install illuminate/http v8.7.0|don't install laravel/framework v7.19.1
    - don't install illuminate/http v8.7.1|don't install laravel/framework v7.19.1
    - don't install illuminate/http v8.8.0|don't install laravel/framework v7.19.1
    - don't install illuminate/http v8.9.0|don't install laravel/framework v7.19.1
    - Installation request for laravel/framework (locked at v7.19.1, required as ^7.0) -> satisfiable by laravel/framework[v7.19.1].
Gummibeer commented 4 years ago

Hey, yes, yes, yes and yes.

I'm sorry but this is because of the changes in the Castable trait. https://github.com/spatie/laravel-enum/blob/006fe3b00cf8ba82ec41ca4511bb2612b9867a12/src/Enum.php#L14-L21

As the castUsing() with arguments is a super useful feature we've used the Laravel 8 only approach. If you fear to upgrade yourself - spend the 9$ and let shift upgrade your app for you. 😉

kevindb commented 4 years ago

Oh, don't get me wrong, I am extremely eager to get the project onto Laravel 8. It's a matter of getting it prioritized in the "product timeline". #CorporateLife

Would you like a PR to make the requirement clearer in the Readme?

Gummibeer commented 4 years ago

In general we don't highlight such requirements as they are clearly described in the composer.json and increase the maintenance effort we have to do every 6months (Laravel release cycle). We had such notes during Laravel 5/6 and we always forgot to update the README when we've updated the composer.json.

kevindb commented 4 years ago

Maybe I'm not looking in the right place. Where is the Laravel requirement in composer.json?

Gummibeer commented 4 years ago

https://github.com/spatie/laravel-enum/blob/006fe3b00cf8ba82ec41ca4511bb2612b9867a12/composer.json#L29-L33 It's not the Laravel you require as an app developer. But you should know the illuminate namespace. Illuminate is the components namespace for all the different Laravel components.

kevindb commented 4 years ago

Fair enough. I didn't realize until today that the Illuminate version numbers are in sync with the Laravel version numbers.

Thank you for the explanation! I'll double down trying to prioritize our upgrade to Laravel 8.

djam90 commented 4 years ago

I too have just hit this problem. Slightly annoying as I love and trust Spatie software but equally I don't have the capacity nor the desire to upgrade to Laravel 8 just yet regardless of whether Shift makes it easier or not.

Just to add to what @kevindb was saying, I too would not think to look in composer.json immediately, I kind of assumed this enum package would work on at least the second most recent version of Laravel. I doubt everyone is using 8.0 just yet.

Oh what the hell. I'm upgrading to Laravel 8.0 now, thanks for giving me extra work to do at 2.30am!

OK - upgraded to Laravel 8.0, package installed, you can ignore this comment! 👍

Thank you for your incredible packages Spatie!!