Skip to Content
Mastering Symfony
book

Mastering Symfony

by Sohail Salehi
April 2016
Intermediate to advanced content levelIntermediate to advanced
290 pages
5h 51m
English
Packt Publishing
Content preview from Mastering Symfony

How to create and load services via autowiring

There are times when we only care about quick and dirty prototyping for a service. We don't know the service details and it is an ongoing job, which means that the service parameters might change over and over again.

It makes the service definition a little tricky. Imagine how many times we would have to refactor the service until we reach the final structure. Luckily, we can create a service with minimal configuration. Introduced in Symfony 2.8, with autowiring, we can ignore details of the service definition and let Symfony find and handle any dependency for us:

services:
   som_service:
      class: some_class
      autowire:true

You can read more about it here:

https://symfony.com/doc/current/components/dependency_injection/autowiring.html ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Persistence in PHP with Doctrine ORM

Persistence in PHP with Doctrine ORM

Kevin Dunglas
PHP Web Services

PHP Web Services

Lorna Jane Mitchell
Mastering PHP 7

Mastering PHP 7

Branko Ajzele
PHP 7: Real World Application Development

PHP 7: Real World Application Development

Doug Bierer, Altaf Hussain, Branko Ajzele

Publisher Resources

ISBN: 9781784390310Supplemental Content