An open API service indexing awesome lists of open source software.

https://github.com/themeplate/bridge

A connection point for frontend libraries
https://github.com/themeplate/bridge

Last synced: 4 months ago
JSON representation

A connection point for frontend libraries

Awesome Lists containing this project

README

          

# ThemePlate Bridge

## Usage

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

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

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

// `/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' ) );
```