V
V
Vladislav2016-09-16 13:23:41
symfony
Vladislav, 2016-09-16 13:23:41

Where do you declare global functions (heplers) in Symfony 3?

Where in Symfony 3 can I describe functions that will be available throughout the application?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Andrey Inishev, 2016-09-16
@MrBikus

That is composer
https://getcomposer.org/doc/04-schema.md#files

M
Maxim, 2016-09-16
@sggr

I am writing a full answer, as it should be in Symfony. Do not try to port the practices of other frameworks like Yii and Laravel to Symfony, they are different products for different purposes.
In the ideology of Symfony there is no concept of a helper as in Yii, ROR, Laravel. You need to combine frequently used functions in a Service (you can call it whatever you like) according to the nature of the functionality, put it in a DI container and inject it into those classes that need this grouped functionality.
And think about it, if you have such helper classes that are used right and left, then you missed the architectural decision. One class, one duty. Understanding SOLID and practicing will help you reach a different level of object design and development in general.

D
Dmitry Balobanov, 2016-09-16
@pchelkin

service?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question