Created
March 12, 2017 10:09
-
-
Save hissy/520e26197687e05241bba0b08e0c0726 to your computer and use it in GitHub Desktop.
[concrete5] [V8] Example of adding a middleware from package
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Concrete\Package\YourPackage; | |
use Acme\Http\Middleware\YourMiddleware; | |
use Concrete\Core\Http\ServerInterface; | |
use Concrete\Core\Package\Package; | |
class Controller extends Package | |
{ | |
public function on_start() | |
{ | |
/** @var ServerInterface $server */ | |
$server = $this->app->make(ServerInterface::class); | |
$server->addMiddleware($this->app->make(YourMiddleware::class)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment