beporter / betablockermiddleware
A single-file PSR-15 Middleware class that implements http cookie-based gatekeeping on a PHP app.
Package info
github.com/beporter/betablockermiddleware
Type:cakephp-plugin
pkg:composer/beporter/betablockermiddleware
Requires
- php: >=7.4
- cakephp/http: ^5.4
- psr/http-message: ^2.0
Requires (Dev)
- ext-xdebug: *
- beporter/coverage-ensure: ^1.1
- cakephp/cakephp: ^5.4
- cakephp/cakephp-codesniffer: ^5.3
- phpstan/phpstan: ^2.1
- phpunit/phpunit: ^13.2
README
A single-file PSR-15 Middleware class that implements cookie-based gatekeeping on a PHP app in a single file.
Also provides a completely optional CakePHP plugin wrapper.
Usage
- From your PHP project, run
composer require beporter/betablockermiddleware.
From here, the process diverges a bit depending on the host application.
General
- Wherever your app defines the Middlware stack,
use Beporter\BetaBlockerMiddleware\Middleware\BetaBlockerMiddleware;$yourMiddlewareQueue->add(new BetaBlockerMiddleware(['cookie_value' => 'some pass']));
CakePHP
-
Run
bin/cake plugin load beporter/betablockermiddleware. -
Review the settings that were added to
config/plugins.php. In particular, make sure the['middleware' => true]key is set. -
Add at least the following key to your
config/app.php:'BetaBlockerMiddleware' => [ 'cookie_value' => 'some password you want to give people', ],
Optional config keys
'BetaBlockerMiddleware' => [ 'expiration' => '+1 month', 'redirect_url' => 'https://your.app.com/some/specific/destination', 'beta_form' => '<form ...>override the password entry page here</form>', ],
Requirements
- PHP v7.4+
- A PSR-7 / PSR-15 compatible http request handling stack.
Contributing
Code of Conduct
Participation with this project requires compliance with our code of conduct.
Reporting Issues
Please use GitHub Isuses for listing any known defects or issues.
Development
Please fork this repository, create a new topic branch, and submit a pull request for your work.
Setup
TODO
License
Copyright
Copyright © 2026 Brian Porter