EllisLab/CodeIgniter — pull request #841 by jamierumbelow (2011-12-27 10:49:38+00:00)
Title: Autoload directories

There are times in a developer's life where we need to load a bunch of arbitrary files, either when we're working with third-party code or when we want to extend out our application past the basic set of libraries and helpers. For example, presenters [(see the blog post)](jamieonsoftware.com/journal/2011/12/26/codeigniter-view-presenters.html) would really benefit from being able to be automatically loaded.

This can also be useful when wanting to load all the files in a directory that might change regularly -- so maintaining an array to load everything would be tiresome.

I've alleviated this problem by adding a `$this->load->directory()` method to the Loader, as well as adding an `$autoload['directories']` type to the *autoload.php* file. I'm using `glob()` to do the searching, so devs can use rather complex patterns to get nice and specific.