1

In https://stackoverflow.com/a/3313137/569976 ircmaxell says the following:

I use a public static method init() on my static classes that require initialization (or at least need to execute some code). Then, in my autoloader, when it loads a class it checks is_callable($class, 'init'). If it is, it calls that method. Quick, simple and effective...

That post, however, is from 2010 and a lot has changed since then. My question is... does Composer support anything like this?

Community
  • 1
  • 1
neubert
  • 15,947
  • 24
  • 120
  • 212

1 Answers1

2

Composer's autoloader isn't going to automatically call init methods for you, but that doesn't stop you from using your own autoloader instead.


https://getcomposer.org/doc/01-basic-usage.md#autoloading

Note: Composer provides its own autoloader. If you don't want to use that one, you can just include vendor/composer/autoload_*.php files, which return associative arrays allowing you to configure your own autoloader.

user3942918
  • 25,539
  • 11
  • 55
  • 67