composer-phpautoloadpsr-0

Composer/PSR - How to autoload functions?


How can I autoload helper functions (outside of any class)? Can I specify in composer.json some kind of bootstrap file that should be loaded first?


Solution

  • You can autoload specific files by editing your composer.json file like this:

    "autoload": {
        "files": ["src/helpers.php"]
    }
    

    (thanks Kint)