themeplate/bridge

A connection point for frontend libraries

Installs: 10

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

pkg:composer/themeplate/bridge

v0.8.0 2025-04-01 11:16 UTC

This package is auto-updated.

Last update: 2025-10-01 00:17:01 UTC


README

Usage

$router = new ThemePlate\Bridge\Router( 'test' );

// `<WP_HOME>/test/route`
$router->map(
	'route',
	function (): bool {
		// ...
	}
);

// `<WP_HOME>/test/[path]`
$router->any(
	'[path]',
	function ( string $path ): bool {
		// $path = [path]
	}
);

// `<WP_HOME>/test/[filename]`
$router->load( new Loader( __DIR__ . '/templates' ) );
// only handles .php files
$router->load( new Loader( __DIR__ . '/templates', 'action' ) );
// only handles .action.php files

add_action( 'init', array( $router, 'init' ) );