Introducing Symfony Autowiring Integration for Spryker

Dmitriy Krainiy
Dmitriy Krainiy Sprykee Posts: 5 🧑🏻‍🚀 - Cadet
edited May 21 in Spryker Development

We’re excited to announce the first step toward integrating Symfony’s powerful autowiring capabilities into the Spryker framework! This initiative aims to reduce boilerplate code, improve developer productivity, and offer a smoother dependency injection (DI) experience—without changing the core architecture of Spryker.

Why Symfony Autowiring in Spryker?

Spryker is built on a robust modular architecture with factories, dependency providers, facades, and plugins. While this design provides flexibility and extensibility, it often requires writing a considerable amount of “glue” code to manage dependencies.

Symfony’s Dependency Injection component, especially autowiring, simplifies this by automatically resolving and injecting dependencies based on type hints — significantly reducing the amount of manual wiring needed.

Our goal is to bring this convenience to Spryker developers without turning Spryker into a Symfony app. We want to keep the existing Spryker infrastructure fully supported, while enabling a cleaner, more modern DI approach.

What’s Included in This First Integration?

  • Supported Application: Yves storefront application.
  • Cross-application and Yves-specific DI configurations are supported via easy-to-edit PHP service files.
  • Codebucket support to keep things organized and maintainable.
  • Autowiring is currently enabled for controllers — all dependencies and nested dependencies are resolved automatically.
  • All Spryker clients are pre-registered in the container, accessible by class or interface.
  • An example module is included to demonstrate how to get started.

You can explore the code and examples here:

GitHub: Symfony Container Integration for Spryker

What’s Next?

This is just a proof of concept — expect further refinements and broader application support in future releases. We’re keen to hear your thoughts and feedback to shape the direction and prioritize features.

We Want to Hear From You!

  • How do you feel about developing modules using Symfony’s DI compared to the native Spryker approach?
  • Does using Symfony’s DI speed up your development process? Why or why not?
  • Which Symfony DI features would you like to see supported out of the box in Spryker?

Your feedback is essential for us to make this integration truly beneficial for the Spryker developer community.

Tagged:

Comments

  • vasily.rodin
    vasily.rodin Freelance Spryker Developer Spryker Solution Partner Posts: 27 ✨ - Novice

    I'm personally very happy to see Autowiring in Spryker 🎉

    I've checked the example module, and it looks more or less exactly how I expected it, thank you!

    The only thing: we usually don't inject classes into controllers. On my current project controllers are quite large, so it means they would have a lot of dependencies. Which is not a nice thing, I know.. But still, I think would be nice to have a generic method available in the controller something like:

    $this->getService(SomeModelInterface::class)->callSomeMethod();
    

    That would help to cover also big controllers without using direct dependencies.

    So, I think it's a really good start, and I'm keen to see the next steps, especially overriding core classes without a need to define factory methods for them ;)

  • Roland
    Roland Senior Application Engineer Posts: 2 🧑🏻‍🚀 - Cadet

    Finally! 😁

    I hope that you will not forget to introduce CLI support with relevant debug commands too 😜
    and hope that you will extend autowiring support for all classes soon.