FriendsOfSymfony / FOSRestBundle

This Bundle provides various tools to rapidly develop RESTful API's with Symfony
http://symfony.com/doc/master/bundles/FOSRestBundle/index.html
MIT License
2.79k stars 708 forks source link

WIP: Allow installation with Symfony 7 #2396

Closed alexander-schranz closed 5 months ago

alexander-schranz commented 8 months ago

I want to use this as a discussion point how we can keep this bundle compatibilty with the latest Symfony Version. The hardest part mostly will be the deprecation of the Symfony FrameworkExtraBundle.

Some background from our side we @sulu use highly the FOSRestBundle and even still use RestRoutingBundle. We are not using any FrameworkExtraBundle so one solution from our side is also skip the ExtraBundle related features when the ExtraBundle is not installed.

Requires

TODO

mbabker commented 8 months ago

Minimum effort that I think is needed to make this PR mergeable:

With this, it at least makes this bundle partially functional on Symfony 7, even if a couple of its biggest features aren't available yet. At the same time, though, a part of me wonders if it's even worth the effort to release in that state.

mbabker commented 8 months ago
  • Decide which min Version for PHP (7.4 would currently be required by the php-cs-fixer shim)

I prefer making decisions based on real life data on this stuff, so let's go to the Packagist stats. The number of installs with PHP 7.2 or 7.3 is so minuscule that bumping to 7.4 should be a no brainer.

alexander-schranz commented 8 months ago

Like your ideas thank you @mbabker.

With this, it at least makes this bundle partially functional on Symfony 7, even if a couple of its biggest features aren't available yet. At the same time, though, a part of me wonders if it's even worth the effort to release in that state.

From @sulu point of view we plan to Support Symfony 7 for our current @sulu 2.x Version. We only use a very minimal set of the RestBundle features:

all other features are not used by us. So if the decision would be not to Support Symfony 7 in the official Bundle I mostly would cherrypick our used features into a Fork to avoid BC breaks in our minor release. But maybe other projects could benifit if we make a Symfony 7 release and like Sulu get a longer Time to migrate away from FOSRestBundle to directly use the Serializers and avoid BC breaks in there services.

mbabker commented 6 months ago

I've got a more complete PR at #2400 but unfortunately, a lot of tests have to be disabled because of the FOS\RestBundle\Controller\Annotations\View annotation extending from Sensio\Bundle\FrameworkExtraBundle\Configuration\Template which breaks anything trying to parse annotations/attributes when it runs without sensio/framework-extra-bundle installed. Now to go rewrite that entire component to work without the Sensio bundle 😅

alexander-schranz commented 6 months ago

@mbabker when I got some time I can also test @sulu against your branch. There we also dont use the sensio extra bundle.

alexander-schranz commented 5 months ago

closing this in favor of https://github.com/FriendsOfSymfony/FOSRestBundle/pull/2400