Tuesday, March 4, 2014

Laravel custom application autoloading folder

1. Creating folder in your /app/YOUR_DIRECTORY_NAME
2. Adding this directory to array in /app/start/global.php 
ClassLoader::addDirectories(array(
   app_path().'/commands',
   app_path().'/controllers',
   app_path().'/models',
   app_path().'/database/seeds',
   app_path().'/YOUR_DIRECTORY_NAME',
));
3. Now you can add new classes to your /app/YOUR_DIRECTORY_NAME without any namespace (if this class is not in subfolder)

No comments:

Post a Comment