Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support PHP 8.1 #138

Closed
lindyhopchris opened this issue Nov 22, 2021 · 10 comments
Closed

Support PHP 8.1 #138

lindyhopchris opened this issue Nov 22, 2021 · 10 comments
Labels
enhancement New feature or request
Milestone

Comments

@lindyhopchris
Copy link
Contributor

Need to update the automated testing to check this package works with PHP 8.1, which is imminently about to be released.

There is definitely one breaking change required, see this issue:
laravel-json-api/eloquent#21

@lindyhopchris lindyhopchris added the enhancement New feature or request label Nov 22, 2021
@plunkettscott
Copy link

I understand 8.1 requires a breaking change, thus a 2.x release. Any idea when you plan to do this or what you want to accomplish before the next major release?

@lindyhopchris lindyhopchris added this to the 2.x milestone Jan 2, 2022
@lindyhopchris
Copy link
Contributor Author

So I wanted to get the Octane changes in (#83), as they are technically breaking but are unlikely to break most people's apps. So wanted to get them in the next major release rather than having to do yet another one for Octane. I've sorted that out today.

I was thinking I'd hold off 2.0 until Laravel 9 came out as that is imminent. However, I'm starting to think that maybe I just do 2.0 now for Laravel 8 and if Laravel 9 introduces anything breaking I end up doing a 3.0 release just for that.

I'm looking through Laravel JSON:API issues today and tomorrow, so will make a decision tomorrow about the 2.0 release.

@lindyhopchris
Copy link
Contributor Author

So an update on this now that I've spent a bit of time this Bank Holiday weekend looking at Laravel JSON:API issues.

It turns out the main thing I need to sort out before tagging 2.0 for PHP 8.1 is that my use of internal interfaces (e.g. ArrayAccess, IteratorAggregate etc) will need to add return type-hints so that they aren't triggering depraction messages in 8.1. At the moment I don't have PHPUnit throwing these deprecation messages, so I need to sort that out so we can reliably hunt down all the deprecations and fix them.

My plan is now to tag v2 as Laravel 8, PHP 7.4 -> PHP 8.1. Hopefully I'll get that tagged by the time Laravel 9 is released (Jan 25th apparently), so that I can then also tag v3. v3 will be Laravel 9, and will drop PHP 7.4 as Laravel are dropping that.

Going forward, v1 will not be supported any more as the upgrade to v2 will be exceptionally simple. v2 and v3 will both be supported for bugfixes and minor (non-breaking) improvements/features.

Any new breaking features will only go into v3. However it's worth noting that I'm not expecting any of those any time soon as I need to work through the backlog of issues that can be fixed in the currently supported releases before I move on to any features that will require breaking changes.

@lindyhopchris
Copy link
Contributor Author

For anyone wanting to use the dev version with PHP 8.1, set the minimum-stability in your composer.json to dev, then run the following commands:

composer require laravel-json-api/laravel:^2.0 --no-update
composer up laravel-json-api/* cloudcreativity/*

albertosgz added a commit to albertosgz-kooomo-coding/kooomo-code-challenge that referenced this issue Jan 15, 2022
According (this thread)[laravel-json-api/laravel#138], updating to version 2 is enough to support php 8 and above.
@zlodes
Copy link

zlodes commented Jan 16, 2022

I see that 2.0 versions have quite stable code. Good job! ❤️
Is it possible to release beta tags? Now our

It's very difficult to update all the packages with their CI settings and minimum-stability.
Also it will affect global app stability (there are a lot of packages with unstable dev branches).

@lindyhopchris
Copy link
Contributor Author

I see that 2.0 versions have quite stable code. Good job! heart Is it possible to release beta tags?

I'm so close to just tagging 2.0 proper that it's not really worth my very limited time going through and tagging beta first.

It's very difficult to update all the packages with their CI settings and minimum-stability. Also it will affect global app stability (there are a lot of packages with unstable dev branches).

If you combine minimum-stability as dev with prefer-stable as true, it will only pull in the dev versions where it has to, rather than pulling in dev versions for everything.

@X-Coder264
Copy link
Contributor

Just wanted to leave an update here that Laravel 9 release date got pushed from January 25th to February 8th -> laravel/docs@48aef38

@lindyhopchris
Copy link
Contributor Author

Thanks for flagging that - anyone know why it has been pushed back?!

Worth giving an update here. The untagged 2.x branch now has support for Laravel 8 and 9, i.e. based on the current version of Laravel 9 I was able to get everything working without any breaking changes. Which is ideal from my perspective, that I can support both 8 and 9 on one release.

I am however really hesitant tagging 2.0 before Laravel 9 is tagged as 9.0 - because I've had bad experiences in the past of them introducing breaking things late on.

So are people ok with me waiting until Feb 8th?! Or are people getting desperate for PHP 8.1 support on production?!

@X-Coder264
Copy link
Contributor

I don't know anything else about that decision, that commit was the only reference to it that I could find.

Speaking for myself, I'm fine with waiting for PHP 8.1 support until Laravel 9 is tagged.

@lindyhopchris
Copy link
Contributor Author

I've tagged 2.0.0. I haven't updated the docs website yet or written an upgrade guide. But the upgrade is pretty straightforward, so the adventurous amongst you should find that you can update without an upgrade guide, particularly if you've got an ace test suite.

Hoping to update the docs website tomorrow evening (UK time).

@lindyhopchris lindyhopchris unpinned this issue Feb 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants