r/PHPhelp • u/Spiritual_Cycle_3263 • Jul 13 '25
Has anyone done lean-forking of existing projects or frameworks?
Has anyone ever built anything large by lean forking existing libraries or frameworks?
I occasionally grab chunks from Symfony when building WordPress plugins, but these are usually small plugins.
I'm now looking at building a larger app for my other business and rather than use the Symfony framework and have to update it regularly, essentially refactor their components for only what I need to keep things lean, and remove the backwards compatibility since I always keep stable & supported versions of PHP.
2
Upvotes
5
u/obstreperous_troll Jul 13 '25
Symfony is already doing that for you: its components are designed to be reused individually in apps that aren't based on the full framework. Unlike Wordpress which is obsessed with running on versions of PHP that should rightfully be long-dead, the compatibility code in Symfony usually doesn't hold the framework back much. Scant use of enums is really the only exception I can think of.
You're still updating the pieces regularly, you're just maintaining them by hand instead of letting upstream do so. I'm not seeing much of a payoff in doing that.
2
u/v4vx Jul 13 '25 edited Jul 13 '25
Like other comment say, unless you have a real constraint against it, prefer use composer. But I just want to add that copy code and modify it on your project may violate the licence (for exemple if you copy LGPL code, your code must be LGPL).
12
u/gaborj Jul 13 '25
This is a good idea because...?
9
u/eurosat7 Jul 13 '25
No, and never will.
Not economic, not efficient.
We have packages, composer and rector for a reason.
1
u/przemo_li Jul 13 '25
Vendoring is real strategy. Usually its what big companies do when they have monorepo. Code in monorepo works better with other code in monorepo, so they will suck 3rd party packages in and diverge development from there. Sometimes they will upstream some of that work too.
Portion of vendoring is to break library apart and keep only useful parts.
For anyone but biggest companies I would instead suggest covering app with integration tests. You can plug those into dependabot and get upgrades for (almost) free. When API breaks, look into phprector for automatic upgrades and with passing integration tests its almost-free upgrade too. When new PHP version is released... phprector + integrations tests!
Do I love integration tests? Yes!