Version 2.3.0 represents a major architectural overhaul of Bad Behaviour. The core logic has been decoupled from platform-specific global variables and bootstrap scripts, transformed into a modern, self-contained Composer package.
- PSR-4 Autoloading: Bad Behaviour is now a standard Composer library (
composer require badbehaviour/badbehaviour). No morerequire_oncechains across your application. - Inversion of Control (Dependency Injection): All host-specific behavior (database queries, escaping, email routing, settings persistence) is now handled via the
BadBehaviour\Core\HostAdapterInterface. - Provided Adapters: Out-of-the-box support for
GenericAdapter,MediaWikiAdapter, andWackoWikiAdapterbridges the gap between the new OOP core and existing platforms. - No Global State Leaks: The library never touches global application variables (like
$dbor$wgDBprefix) without explicit instruction via an adapter. - No Side Effects on Load: Requiring the package via Composer or
use BadBehaviour\Core\BadBehaviour;no longer triggers screening or callsdie(). The host application retains full control over execution flow. Screening only triggers when you explicitly call$bb->run(). - Backwards Compatible Shims: Existing drop-in integrations (
bad-behaviour-generic.php,bad-behaviour-mediawiki.php, etc.) have been retained as thin shims. They now automatically instantiate the new OOP classes internally, meaning existing installs upgrade seamlessly without changing a single line of legacy code. - PHPUnit Ready: The codebase is now fully unit-testable. A testing scaffold is included to verify screening logic without HTTP traffic or live databases.
Full Changelog: 2.2.26...2.3.0