I am using Nette Framework which uses its own autoloader. How can I define custom autoloader or just exclude the standard one from composer so I can use my own?
Asked
Active
Viewed 1.1k times
2 Answers
11
Alternatively, if you want an additional autoloader, you can update composer.json
with:
{
"autoload": {
"files": ["src/extra/autoloader.php"]
}
}
Then run composer dump-autoload
to rebuild it. Now when you include vendor/autoload.php
it will also load your autoloader.

mpen
- 272,448
- 266
- 850
- 1,236
3
Simply don't include it if you don't want to use it. Keep in mind you'll have to handle autoloading on your own.
If your autoloader can work with it, you can use namespaces file generated by composer:
Composer provides its own autoloader. If you don't want to use that one, you can just include vendor/composer/autoload_namespaces.php, which returns an associative array mapping namespaces to directories.
Reference: Autoloading in the composer docs.

Jakub Zalas
- 35,761
- 9
- 93
- 125
-
I just wanted to keep my directory structure clean from files I don't need, but if there's no other way, I will just include another file. – Peter Krejci Oct 10 '12 at 08:03