A
A
Andrey Filippov2016-04-09 19:11:21
PHP
Andrey Filippov, 2016-04-09 19:11:21

Where to put the helper for my library?

I am developing a library. It can be used both separately and with frameworks. There are a couple of functions that are often used in my lib. Where is the best place to put them? Somehow I don’t want to connect a third-party package because of a small function. And litter the global space too.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Muhammad, 2016-04-09
@andrysha-dev

You can put functions in a separate namespace and connect them via composer.json in the autoload/classmap section.

D
D', 2016-04-09
@Denormalization

For this purpose they came up with Traits
PS
In general, it is not clear what is "There are a couple of functions that are often used in my lib. Where is it better to put them?"
Are the functions dependent on the library?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question