Skip to content
This repository has been archived by the owner on Dec 3, 2023. It is now read-only.

[ECS] Remove dependency on symfony/http-kernel #3726

Merged
merged 3 commits into from
Oct 31, 2021

Conversation

TomasVotruba
Copy link
Member

@TomasVotruba TomasVotruba commented Oct 31, 2021

The symfony/http-kernel is a useful package to quickly bootstrap project using Symfony DI.
The disadvantage is that it will many heavy Symfony framework components

  • http-foundation
  • error-handler
  • var-dumper
  • cache
  • event-dispatcher

etc.
We only need to build Dependency Injection container. But unfortunately, there is no component that would only create container from configs. The Dependency Injection component is just a simple package for handling mostly service value object. The container itself is built unfortunately in http-kernel component.

Ideally the container-builder should be separated from http-kernel, that would be light and only build the container. Due to this heavy Symfony pull, all Symplify CLI packages are almost as heavey as any MVC framework application. Imagine PHPUnit using full symfony/symfony, that's not good.

As negative consequence, the downgrade process is slow, heavy and the download of simple ECS results in download of dozens unused Symfony components, just to make http-kernel happy.

To avoid this, this is an attempt to build the missing container-builder package, that only accepts:

  • extensions
  • compiler passes
  • configs paths

And returns compiled Container in the end. Will it work? :)

@TomasVotruba TomasVotruba changed the title tv ecs kernel lighter [ECS] Remove dependency on symfony/http-kernel Oct 31, 2021
@TomasVotruba TomasVotruba force-pushed the tv-ecs-kernel-lighter branch 5 times, most recently from a10655f to d0a973b Compare October 31, 2021 15:56
@TomasVotruba
Copy link
Member Author

cc @matthiasnoback Hi Matthias, I had a struggle with too heavy Symfony, so I've decided to drop anything we don't need from Symfony to build the container. I think you might like this one.

Any feedback appreciated!

Also, if this work, it might get to Rector itself :)

@TomasVotruba TomasVotruba force-pushed the tv-ecs-kernel-lighter branch 2 times, most recently from afafea1 to 61f651f Compare October 31, 2021 16:41
@TomasVotruba TomasVotruba force-pushed the tv-ecs-kernel-lighter branch 6 times, most recently from c02cec7 to dad5ebe Compare October 31, 2021 18:12
@TomasVotruba
Copy link
Member Author

TomasVotruba commented Nov 1, 2021

-390 files 🥳

It took a while to clean whole symplify dependency tree from symfony/http-kernel, but the results are here :)

https://twitter.com/VotrubaT/status/1455104311478951936

@TomasVotruba
Copy link
Member Author

TomasVotruba commented Nov 1, 2021

How much ECS vendor lose weight?

phploc vendor before

Directories                                        504
Files                                             2326


Size
  Lines of Code (LOC)                           263771
  Comment Lines of Code (CLOC)                   91989 (34.87%)
  Non-Comment Lines of Code (NCLOC)             171782 (65.13%)
  Logical Lines of Code (LLOC)                   61606 (23.36%)

Classes                                         2056

phploc vendor after

Directories                                        436
Files                                             1974

Size
  Lines of Code (LOC)                           225756
  Comment Lines of Code (CLOC)                   78870 (34.94%)
  Non-Comment Lines of Code (NCLOC)             146886 (65.06%)
  Logical Lines of Code (LLOC)                   52923 (23.44%)

Classes                                         1768

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants