Skip to content

How to autoload a non-class .php file #11260

Answered by stof
ahmu83 asked this question in Q&A / Support
Discussion options

You must be logged in to vote

PHP does not have an autoloader for functions. They must be loaded before usage.

However, it is possible to tell composer to load some files at the time vendor/autoload.php is included, which is useful for files defining functions (but they will be loaded early, not only when they are used). For that, use the files key under autoload in your config: https://getcomposer.org/doc/04-schema.md#files

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Seldaek
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants