backdrop-dev / contracts
Backdrop Contracts for Backdrop framework.
v1.0.0
2026-11-08 04:33 UTC
Requires
- php: >=7.4
Requires (Dev)
None
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-11-08 04:38:31 UTC
README
Shared interfaces for the Backdrop framework and its packages.
Requirements
Installation
Use Composer to install Backdrop Contracts:
composer require backdrop-dev/contracts
Contracts
All contracts are in the Backdrop\Contracts namespace.
| Interface | Method | Purpose |
|---|---|---|
Bootable |
boot(): void |
Starts a class after it's created, such as adding its action and filter hooks, so that work stays out of the constructor. |
Displayable |
display(): void |
Prints an HTML string. The output should already be escaped. |
Renderable |
render(): string |
Returns an HTML string ready for output. The string should already be escaped. Use a different method name, such as get(), for raw data. |
use Backdrop\Contracts\Bootable; class Component implements Bootable { public function boot(): void { add_action( 'init', [ $this, 'init' ] ); } }
Compatibility
Backdrop framework 1.0 includes its own copies of these interfaces with the same names and method signatures. A site that loads both (for example, a theme using framework 1.0 and a plugin using this package) uses whichever copy loads first, so the method signatures won't change in 1.x.
Copyright and License
This project is licensed under the GNU General Public License, version 2 or later.
Copyright © 2019–2026 Benjamin Lu