Easy to use closures container for Laravel. First register the closure then use it anywhere.
lachezargrigorov/laravel-closures-container is a Laravel package for easy to use closures container for laravel. first register the closure then use it anywhere..
It currently has 0 GitHub stars and 9 downloads on Packagist (latest version v1.0.1).
Install it with composer require lachezargrigorov/laravel-closures-container.
Discover more Laravel packages by lachezargrigorov
or browse all Laravel packages to compare alternatives.
Last updated
Easy to use closures container. First register the closure then use it anywhere.
Via Composer
$ composer require lachezargrigorov\laravel-closures-container
If you do not run Laravel 5.5 (or higher), then add the service provider in config/app.php:
Lachezargrigorov\ClosuresContainer\ClosuresContainerServiceProvider::class,
If you do not run Laravel 5.5 and want to use the facade, add this to your aliases in app.php:
"Closures" => Lachezargrigorov\ClosuresContainer\Facades\Facade::class,
//using Facades
Closures::register("sumTwoNumbers",function($a,$b)
{
return $a + $b;
});
$sum = Closures::sumTwoNumbers(1,2); //3
$bool = Closures::isRegistered("sumTwoNumbers");
//using IOC
$closures = app("closures");
$closures->register("sumTwoNumbers",function($a,$b)
{
return $a + $b;
});
$sum = $closures->sumTwoNumbers(1,2); //3
$bool = $closures->isRegistered("sumTwoNumbers");
Please see CHANGELOG for more information on what has changed recently.
$ composer test
Please see CONTRIBUTING , ISSUE_TEMPLATE and PULL_REQUEST_TEMPLATE for details.
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.