Where can I put laravel 4 filter classes?
laravel, laravel-4, php
Solution
There isn't a default to my knowledge, but you can call `ClassLoader::addDirectories(array(app_path().'/filters'));` to register your filter directory. The correct place to put that is in `app/start/global.php` where you should see some folders already being registered.
There is a 'local.php' which seems a candidate, but this is only meant for specific environments (usually development, provided you add a proper array or closure in `$app->detectEnvironment()`).
Problem
In laravel 4, you can create filter classes instead of putting the entire filter inside a closure -- great. But do these filters have to be entirely in the `app/filters.php` or `app/routes.php`? Generally I like to do one file per class, but I imagine there's something better to do then a bunch of includes in the filters.php file. Where would you put these for laravel to find them automatically? For example: ``` Route::filter('Thing', 'ThingFilter'); # can I put this in its own file and have laravel automatically use it? class ThingFilter { function filter() { ... } } ```