-
-
Notifications
You must be signed in to change notification settings - Fork 487
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
Symfony webapps and their hard reliance on Stimulus #1089
Comments
Thank you for opening this discussion. To be clear, you are getting all that boilterplate you complain about when you use the symfony new --webapp my-new-app What exactly is a webapp? Or rather, what is a good skeleton for a webapp? You probably realize that if you ask ten developers this question, you will get eleven answers. At least. That webapp switch is opinionated by design and if we changed what it does, we would just implement someone else's opinion. If you omit that switch, you get a minimal project to which you can add only what you need. As long as you don't install any Stimulus-related packages, you should not get Stimulus-related boilerplate. I myself hardly use What's stopping you from starting with the minimal app like I do? |
No, the alternative is simply not installing anything that is going to have heavily different opinions. Not having an opinion is not the same as having different opinions. Everything else that is installed with a webapp project is fairly vanilla stuff, everything else it includes is either part of Symfony's own ecosystem (Forms, Mailer, Messenger, etc) or it's a massively popular external project that despite being external is still the most popular solution to a problem that will need solving in every webapp (Doctrine, Twig). Stimulus does not fit that description. It is not a logical default to force on people. I would have understood if you had picked React or Vue, being as popular as they are, but with Stimulus I am willing to bet that the vast majority of all your users are either removing it or are simply not aware it's being included and leave it in there unused.
Because that would change the process from having to remove things to get to a reasonable starting point to having to add things to get to a reasonable starting point. Prior to Stimulus being added into the recipes I would say you had a very good starting point. And you still do, all of the default choices other than Stimulus seem reasonable. |
That's basically the minimal app. People have different opinions on ORMs (or databases in general), template engines, mail clients, serializers, … You have accepted our choices here, but not everybody does.
Okay, first of all, nobody's forcing anything on anyone. Secondly, it is if you want to work with the Symfony UX components which is currently our recommendation for building a frontend for a webapp.
As an Angular user, I feel locked out. But seriously, I don't see how the exact same argument would not be brought up if we installed Vue.
How's that worse? What would you need to start from the minimal app instead?
So you basically need an easy way to install everything but the Stimulus-related packages? |
Sorry, but no. Doctrine and Twig are indeed opinions/choices I have accepted, but the mailer and serializer as well as the messenger and other components do not have any opinions on which mail server, which serializer or which messaging stack you should use. The components are there but they don't enforce any opinion. Doctrine and Twig are the only packages included in the webapp project that are.
Symfony UX is not included in the webapp project. This particular opinionated choice seems to come from the Webpack Encore package, and it does not belong there. I would follow your line of reasoning if it was
I would have to look up or be aware of all the boilerplate stuff every time I start a new project even though 99% of it is stuff that you have a perfect recipe for that somehow includes things it shouldn't have an opinion on. It is not hard, it's just unnecessary extra work, just like removing Stimulus is not hard, just annoying.
That would help me, but I firmly believe that from a design perspective Symfony should not be "telling me" to use Stimulus or to set up Stimulus for me except when I ask for it explicitly. I would be making the same argument if Symfony started setting up RabbitMQ because you decide that this is the MQTT service you want to recommend or if Symfony started setting up MongoDB because that's the NoSQL database you recommend. Webpack and Webpack Encore have everything on board to get started with your project and your frontend frameworks of choice. Symfony should not be making this decision. |
I don't really get the part why it's installed with the symfony/webpack-encore-bundle. The sass-loader isn't installed by default either, but stimulus seems to be treated as a special case. Most defaults symfony suggests are logical, but for some reason it was decided that stimulus would be a logical default for all symfony applications when using the webpack encore bundle. It would be nice to at least understand why symfony would push something like this. |
Choices you have accepted. That's my point. Especially developers who choose not to use an SQL database would want to remove most of the Doctrine stuff.
Okay, that's a very good point. Maybe @weaverryan can give us some insights here. The fact that Stimulus is installed with WebpackEncoreBundle is indeed surprising.
No, the boilerplate is installed by Flex if you install the corresponding Composer packages. You can lookup the packages that You could even publish your own pack with only the dependencies you want by default. Start from the minimal app, install your pack afterwards and you should be good to go. If you weren't aware of that, please feel free to submit a PR to the documentation to help others who are in the same situation.
Again, that's not what's happening.
That's probably something worth working on. Let's put the discussion on tl:dr: I think it's fine to get a basic Stimulus setup when using |
I'll just quote and respond to this one part because I don't think it's productive to discuss about semantics too much. I've basically said how I feel about the other things and whether or not you agree with them it's not going to be productive if I repeat them in other words.
This is indeed the main problem I see. If we could at least get some clarification about why this coupling exists that would already help, because right now I just don't understand it. And if there isn't a good reason for it I would suggest putting that part of the recipe where it makes more sense. If see no objections to it being in |
This was done for two reasons:
I understand that the inclusion of Stimulus with the WebpackEncoreBundle recipe isn't perfect. However, the only decisions I see are: A) Create a fake B) Include the Stimulus recipe files with WebpackEncoreBundle as they are done now. This inconveniences people who don't want to use it, as they need to (a) remove a few packages from I strongly vote for (B), which is what we have now. But I know that we cannot make everyone happy, and I think that you bring up valid points. Cheers! |
Actually, let me update with one more thought. IF there were a way to have a However, I believe there are some roadblocks in Flex to get this. First, I think (?) that since a pack is added then uninstalled immediately, its recipe may be added then removed immediately. Second, the EncoreBundle recipe would need to run first so that the |
So what you're saying is that you wanted to make a clearly unpopular opinionated choice (Stimulus has 184k weekly downloads while much popular choices like React, Vue and Angular each have millions) and because you made that choice you had to go for an imperfect solution that installs things people don't want combined with a package it should not be in? Did I summarize that correctly? Because if I did I very strongly don't agree that this choice is a wise one or even a remotely desirable one. I could have understood if we were talking about any of the more popular frameworks I just mentioned but as is Stimulus is a very weird choice to pre-install and pre-configure for people who just want to create a Symfony project from scratch. By far most of your users will have zero experience with it, it makes no sense for this to be the default. Nor does it make sense for there to be a default at all in the first place, but as you said in your first bullet point you already knew people would disagree on that. |
We have meta packages for that purpose (e.g.
Flex is already capable of optionally updating docker-compose setups IIRC. Could we do something similar with package.json? Like promting the user that the recipe foo/bar likes to add dependencies to package.json, giving them the choice to accept or reject that? |
@NMe84 I would really appreciate it if we could discuss this matter on a less emotional level. |
@derrabus Yes, I think the metapackage idea would be the way to go. I think this setup would work: A) B) C) For users, the install would be
I think you have brought up a valid point with this. But please keep the conversation respectful. |
I'm not sure how I'm being disrespectful when I point out flaws in an argument. You made the decision to be opinionated on something that I strongly believe Symfony should not be opinionated on at all and after deciding to do that ended up with having to enforce that opinion in a place where it doesn't belong because of technical limitations. The more logical choice would be to then simply not go for the addition, at least in my opinion. I meant no disrespect and I'm sorry if I came across that way. But I do feel very strongly about some of the choices that were made here and I'll be honest: I'm still entirely unsure about why they were made in the first place. Having said all that, I'm glad you're thinking about this and are looking into better solutions. I won't pretend that I know enough about the essential details here so I'll let you do your thing without making the process harder by further repeating things I've already said. |
I very much support the proposed changes, as I have also faced the surprise of default recipes including the Stimulus boilerplate that I had to strip and delete right away. The purpose of the recipes was always to facilitate the vast-majority scenarios, and as such out-of-the-box choices like Twig and Doctrine are perfectly defendable. Stimulus does not hold the same status inside or outside the Symfony community. And totally offtopic - I didn't see any disrespect in this entire topic, and was surprised to suddenly see references to 'disrespectful' behavior coming up. Objectively disagreeing with someone's technical choices based on solid objective arguments is not disrespectful and bringing 'respect' up in it only diverts needlessly from the case at hand. In the end we're all 'nerds' trying to improve our favorite tech tool. |
Yesterday, Ryan did work on the things proposed in this issue: #1090 Let's refocus this issue on the technical discussion, thank you :) |
I agree with @NMe84 , when doing a new angular project for example, it will let you decide to use which css processor (less, scss, etc) instead of choosing one. It would be nice if Symfony could do the same. :) |
We can close this issue now. The Stimulus integration was removed from the webpack-encore recipe in 2.0 and a new SymfonyStimulusBundle is created (with recipe) to integrate Stimulus in an application. The webapp skeleton comes with the stimulus bundle installed, as we believe this is a good starting point if you're starting a new webapp in 2024, but you can remove it (which will also remove the asset files related to Stimulus). Thanks for starting and participating in this discussion! |
I tried removing the stimulus from composer and did update, but still didn't remove the files. I had to manually do it. This still doesn't solve the issue of it coming preinstall does it? Can there not be an option to select which one? (Like angular does when selecting CSS processor) |
Before closing this issue, I tried this myself and the files were removed when uninstalling the stimulus bundle and ux-turbo packages. Maybe you don't have the Symfony Flex Composer plugin installed? If you want more help with this, feel free to ask your question in one of the community support channels. We prefer not to make the process more complex. Each question during install increases the complexity exponentially for maintenance. Besides that, we also don't want to overwhelm new people by having to make lots of decisions about topics they don't know enough yet to make a good decision. For this reason, we ship 2 skeletons:
|
I get it. Any chance for a 3rd option? |
I still don't understand how pre-installing client-side frameworks in general is a "sensible" choice, let alone a package that no one has ever heard of. I could understand if you were opinionated and chose a framework that a good chunk of people were using, but there is basically no ecosystem for this framework. I always go for a webapp initialization because other than Stimulus I need everything else in it, and it's incredibly frustrating to always have to go in and manually remove this software bloat. I understand that you don't want too many options but I don't think it's unreasonable at all to at least differentiate between a webapp skeleton that isn't opinionated on the javascript side and one that is, if you absolutely have to push this framework no one uses. |
To be fair - there has been a lot of changes in Symfony UX and Stimulus since the start of the discussion.
I feel like Symfony chose a flexible, lightweight and easy to learn framework with Stimulus for those, who don't have any experience in more sophisticated frameworks, providing an good starting point for a lot of basic use cases. And you probably could create a custom fork of the skeleton, make you own template and use it with |
I'll put it this way: even if Stimulus would be the best thing since sliced bread, there is barely any ecosystem for it. No one with any desire for maintainability will want to use it because you'd constantly be having issues with dependencies not being up to date, or with dependencies being written in Vanilla JS, in which case I wonder why you'd even want a framework in the first place.
Now you're overwhelming them by installing something most of them won't want (or even recognize) without any explanation of what it is or how to get rid of it, in the skeleton that is meant to get them going more quickly. |
@NMe84 Like me. I'm the new user of this stimulus stuff, and I had to go out of my way to find out how to get rid of it and what it was. Perhaps if they're not willing to budge with the inclusion, perhaps we could persuade them to include a --without-ux for the --webapp ? Edit: The removing of the composer items did not work for me to remove the boilerplate. |
Just to clarify: Stimulus is around 10 years old and has been used by the Ruby on Rails community that entire time. It is well-maintained and has a broad ecosystem. You can still choose to not use it - but I didn't want the above comment to mislead people :).
To help others:
This handles the removal. The only things left are 3 entries in |
I'm sorry if this is a stupid question, I never used |
This comment was marked as off-topic.
This comment was marked as off-topic.
Hi @Raghav9888! Please use one of the Symfony support channels for support questions like this. We use the issue tracker purely to track bugs and feature requests. |
This has been bugging me for a while and I never really knew where to bring this issue up. I ran into it again today and decided that instead of just staying quiet I should just decide on a place to bring this up and start a discussion, so here we are.
I'll just get right to the point: I don't understand why, when creating a new webapp project, Symfony is opinionated on which Javascript libraries to use. Nowadays when you create a new webapp, Symfony includes Stimulus and the Stimulus-bridge (which is fine) but then after that the default recipe also creates the setup for Stimulus in Webpack's config and actually includes the folder and file structure for it.
I think this is a fundamentally bad idea. I don't have anything against Stimulus and I understand that the option should be there, but it should definitely not be on by default. If I want to use React, Angular, Vue, Svelte or any other option I first have to remove all the boilerplate that the recipe added and in recent times that's literally what my process looks like whenever I start a new project: I install Symfony, then go back manually and remove anything Stimulus related. Ever single time. It's annoying and unnecessary and I can't for the life of me understand why any of it is enabled by default in a framework that otherwise says it's as unopinionated as it can be. And I can't be the only person who has this issue, the other frameworks I mentioned are by far more popular than Stimulus has ever been and most likely more popular than it ever will be.
Can someone enlighten me and explain what I'm missing? And would you be willing to reconsider this default behaviour?
The text was updated successfully, but these errors were encountered: