Search by

backdrop-dev / contracts

techkodeninja

Backdrop Contracts for Backdrop framework.

Package info

github.com/backdrop-dev/contracts

Homepage

Issues

pkg:composer/backdrop-dev/contracts

Statistics

Installs: 491

Dependents: 1

Suggesters: 0

Stars: 0

v1.0.0 2026-11-08 04:33 UTC

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