15.
Autoloading: Where did require/include go?
Keep on Learning!
If you liked what you've learned so far, dive in! Subscribe to get access to this tutorial plus video, code and script downloads.
If you liked what you've learned so far, dive in! Subscribe to get access to this tutorial plus video, code and script downloads.
Whoops, an error! Please, try again later.
3 Comments
Sorry but I have a tricky question.
There is a file called /app/bootstrap.php.cache which contains all Symfony Components classes for the purpose of faster loading.
But what if I want to add all /vendor/ classes to this cache? Any possible way to do that?
Yo Ivan!
Cool question :). There is and is not a way to do this. This file specifically is static - you can't control what goes in there. However, there is another file called
var/cache/dev/classes.phpthat is just like this, and this one is dynamic. Currently, you need to create a dependency injection extension class to add more stuff to this: http://symfony.com/doc/current/bundles/extension.html#creating-an-extension-class. Then, you can add classes to it viaaddClassesToCompilehttp://symfony.com/doc/current/bundles/extension.html#adding-classes-to-compileJust make sure you don't put TOO much inside there :). It does speed things up a little bit, but it can come at a cost: if you add a class to this file, but you do not need that class on every request, then it is unnecessarily loaded into memory.
Have fun!
Wow! That's a good and very useful answer. Thanks.
"Houston: no signs of life"
Start the conversation!