php - Laravel 4 App Utility class -


i'm developing app in laravel-4 php mvc framework

i'm wanting develop kind of utility class, general coding tasks carry out.

such as: image uploading, image re-sizing etc... general application tasks

is best practice put in base controller class? im thinking not, or defining separate

utill::utilityfunction();  // or  app:utilityfunction(); 

i'm not sure of best way structure , keep within best practice?

you're talking helper class, right? better create classes whatever need them do, need have meaning on app, need specific, there's no problem creating small class image stuff , 1 small upload files, 1 utility class both not good. take @ articles: http://guru-php.com/blog/2008/08/128003/ , http://blogs.msdn.com/b/nickmalik/archive/2005/09/06/461404.aspx.

using same logic: should add methods basecontrollers pertinent controllers.

to create utility classes, can create new directory (like app/library), create classes inside , add path app/start/global.php, in classloader::adddirectories() list, laravel 4 autoload them automatically you. or can add them composer.json, using autoload/classmap section , run coposer dump-autoload autoload them.


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -