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
- Host: GitHub
- URL: https://github.com/themeplate/bridge
- Owner: ThemePlate
- License: gpl-3.0
- Created: 2025-03-07T14:46:27.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-04-01T11:22:48.000Z (about 1 year ago)
- Last Synced: 2025-08-25T01:47:54.118Z (10 months ago)
- Language: PHP
- Homepage:
- Size: 82 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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' ) );
```