Recommend this page to a friend! |
Download |
Info | Documentation | Files | Install with Composer | Download | Reputation | Support forum | Blog | Links |
Ratings | Unique User Downloads | Download Rankings | ||||
Not enough user ratings | Total: 51 | All time: 10,677 This week: 455 |
Version | License | PHP version | Categories | |||
lazybeforeafterservi 1.0 | Custom (specified... | 5 | PHP 5, Libraries, Design Patterns |
Description | Author | |
This package can call functions before or after a controller action. |
A service Provider for Silex to call before/after methods automatically.
Your bootstrap may look like this
<?php
$app = new Application();
$app->register(new ServiceControllerServiceProvider());
$app->register(new LazyBeforeAfterServiceProvider());
$app['controller'] = $app->share(function(){
return MyController();
});
$app->get('/','controller:indexAction');
Now you can just add methods like "before", "after","before{MethodName}" and "after{MethodName}" without to specify it in your Router.
This is the same like
$app->get('/','controller:indexAction')
->before(function(){
//some logic
})->after(function(){
//some logic
});
But with the ability to do your checks in a "Base" Controller and extend from it.
The Provider Call the methods in following Order:
Files (18) |
File | Role | Description | ||
---|---|---|---|---|
src (2 files) | ||||
test (1 directory) | ||||
tests (1 directory) | ||||
.travis.yml | Data | Auxiliary data | ||
composer.json | Data | Auxiliary data | ||
composer.lock | Data | Auxiliary data | ||
LICENSE | Lic. | License text | ||
phpunit.xml.dist | Data | Auxiliary data | ||
README.md | Doc. | Documentation |
Files (18) | / | src |
File | Role | Description |
---|---|---|
LazyBeforeAfterEventSubscriber.php | Class | Class source |
LazyBeforeAfterServiceProvider.php | Class | Class source |
Files (18) | / | test | / | Spy |
File | Role | Description |
---|---|---|
BaseControllerSpy.php | Class | Class source |
ControllerOnlyActionSpy.php | Class | Class source |
ControllerWithAfterActionOnlySpy.php | Class | Class source |
ControllerWithAfterOnlySpy.php | Class | Class source |
ControllerWithAllSpy.php | Class | Class source |
ControllerWithBeforeActionOnlySpy.php | Class | Class source |
ControllerWithBeforeOnlySpy.php | Class | Class source |
ControllerWithOrderSpy.php | Class | Class source |
ControllerWithSymfonyResponseSpy.php | Class | Class source |
Files (18) | / | tests | / | integration |
File | Role | Description |
---|---|---|
LazyBeforeAfterServiceProviderTest.php | Class | Class source |
The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page. |
Install with Composer |
Version Control | Unique User Downloads | Download Rankings | |||||||||||||||
100% |
|
|
Applications that use this package |
If you know an application of this package, send a message to the author to add a link here.