Description
Q | A |
---|---|
Branch? | master |
Bug fix? | no |
New feature? | yes |
BC breaks? | no |
Deprecations? | yes on version 5.1 |
Fixed tickets | #27479 |
License | MIT |
Goal
Be able to provide a very tiny application with the power of the DIC.
Description
Add ability to use the Dependency Injection factory without HTTP dependencies.
Currently the HttpKernel
component depends on a lot of packages. However, as soon as we remove all HTTP features dependencies becomes fewer:
symfony/config
symfony/dependency-injection
.
One solution is to create the symfony/kernel
to ease the decoupling.
For history: a similar work has been done for the security
component.
Context
Symfony took the path to be tiny and fast. However, CLI applications still required the HttpKernel
and all related HTTP dependencies that is completely overkill. And this only to have the ability to build and instantiate the service container.
There are also other projects that wants to use or initiate the migration to Symfony. Where migrating the business logic to use the dependency injection component is one of the first action to do.
What will this component contain?
All not HTTP related features of the HttpKernel
.
src/Symfony/Component/Kernel/
├── Bundle
│ ├── BundleInterface.php
│ └── Bundle.php
├── CacheClearer
│ ├── CacheClearerInterface.php
│ ├── ChainCacheClearer.php
│ └── Psr6CacheClearer.php
├── CacheWarmer
│ ├── CacheWarmerAggregate.php
│ ├── CacheWarmerInterface.php
│ ├── CacheWarmer.php
│ └── WarmableInterface.php
├── Config
│ └── FileLocator.php
├── DependencyInjection
│ ├── AddAnnotatedClassesToCachePass.php
│ ├── ConfigurableExtension.php
│ ├── Extension.php
│ ├── LoggerPass.php
│ ├── MergeExtensionConfigurationPass.php
│ ├── ResettableServicePass.php
│ └── ServicesResetter.php
├── EventListener
│ └── DumpListener.php
├── KernelInterface.php
├── Kernel.php
├── Log
│ └── Logger.php
└── RebootableInterface.php
Road-map (draft)
- Extract the kernel from the HTTP one
- Provides a back compatibility layer for Symfony4.
- The
symfony/http-kernel
requires and extends the newsymfony/kernel
component.
- Extract, migrate, refactor the documentation
- Trigger deprecation on version 5.1
- Remove BC layer on version 6.0
Next (out of topic)
- Touch the
FrameworkBundle
to follow the same path.
Migration path (draft)
Required
To migrate to Symfony6: rename the namespace for classes moved to the new component.
-namespace Symfony\Component\HttpKernel\*;
+namespace Symfony\Component\Kernel\*;
Optional
- For bundles that do not use HTTP functionality, it will be up to the maintainer to remove the HTTP dependency because the migration will not be required.
Resources
- An experimental repository created there https://github.com/alquerci/kernel.
- The comparison from the version 4.1.6
cc @stof