Binder is a bundle for Laravel (http://laravel.com) that helps you organize your macros, custom validators, etc. with ease.
Simply add the following to your application's bundles.php:
'binder' => array(
'auto' => true
),
You can use Binder's "binders" directory to organize your files. There is already an example.binder.php file within this directory for you to use as a starting point.
If you want to organize your files outside of Binder you will need to add this to your application's start.php:
Binder::init('app');
The above example assumes you're storing your files in /application/binders/.
Note: Files must end with the .binder.php extension. Any file that does not contain this extension will not be loaded by Binder.
If you only have one Closure to bind within your file all you have to do is the following:
return array(
'html flash' => function()
{
// HTML::flash() functionality
},
);
You can install this bundle by running the following CLI command:
php artisan bundle:install binder
Alternatively you can download it directly from GitHub:
http://github.com/awellis13/laravel-binder