Skip to content

Instantly share code, notes, and snippets.

@hissy
Created March 12, 2017 10:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hissy/520e26197687e05241bba0b08e0c0726 to your computer and use it in GitHub Desktop.
Save hissy/520e26197687e05241bba0b08e0c0726 to your computer and use it in GitHub Desktop.
[concrete5] [V8] Example of adding a middleware from package
<?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