Saturday 15 March 2014

Auto-loading Helpers in laravel 4 -


I'm trying to get Laravel 4 into Auto Load Helper files from apps / helpers Directory (I made it, obviously).

I started it in a composer manner: by adding path to composer.json , and then running dump-autoload . It was not working, I then tried with the app / start / global.php file, which did not work either.

Note, I'm not throwing classes into supporting files - that's the same facades and packages. I just need small helpers, which is similar to Laravel's own (in the seller directory). I only say this because it seems that musicians only dump the list classes (with namespace) only.

What can I do to automatically load helpers?

Update

It also seems that ClassLoader :: addDirectories () function does not work for classes - why is it? Do I have to use both this and the composer?

Edit

It seems that my question does not understand. In my app / assistants directory, I have a file named paths.php . I want to be able to call the function within global scope ( theme_path ($ location) ).

Auto-loading is for classes only, depending on your function names you actually create random php files Can not independence.

Your best bet is OOP and your assistants. You will only get the functionality of autoloaded files when needed, and you will do with the rest of the Laurel Community.

But if you still want to use plain old non-object php functions, I think you can start individually () start. From php, but they will all be loaded on every page request

No comments:

Post a Comment