0

I have just realised in Laravel 4, we have the commands directory added to app/start/global.php. The directory contains nothing in it. Does this directory replace libraries in Laravel 3? I guess my classes will still work if I placed them in there, but would I be using it for the wrong purpose?

1
  • If your libraries classes are not database models you should create a new directory into your app folder then add it to app/start/global.php in ClassLoader::addDirectories. Commented Jun 3, 2013 at 14:51

1 Answer 1

2

The Laravel 4 commands directory, is like the Laravel 3 tasks directory. So it is not the ideal place for your libraries. What is the recommended way to go? If your libraries classes are database models it should be place under app/models, otherwise you could create a new directory like app/libraries then modify: app/start/global.php and add the new directory path to the array in ClassLoader::addDirectories(...) method call.

Extra information above related to Laravel 4 Commands:

The main differences (advantages) of Laravel 4 Commands over Laravel 3 Tasks are:

  1. Start writing a command is just matter of typing: php artisan command:make MyCommand.
  2. Commands can have a set of arguments and options.
  3. Commands need to be registered in Artisan.

For more information read the docs about Commands.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.