https://github.com/imponeer/smarty-sunrise-http-router
Smarty extensions to use with amazing router from @sunrise-php
https://github.com/imponeer/smarty-sunrise-http-router
hacktoberfest smarty smarty-plugins
Last synced: about 2 months ago
JSON representation
Smarty extensions to use with amazing router from @sunrise-php
- Host: GitHub
- URL: https://github.com/imponeer/smarty-sunrise-http-router
- Owner: imponeer
- License: mit
- Created: 2021-11-03T22:28:18.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-08-01T11:48:13.000Z (10 months ago)
- Last Synced: 2024-10-02T18:16:58.027Z (8 months ago)
- Topics: hacktoberfest, smarty, smarty-plugins
- Language: PHP
- Homepage:
- Size: 58.6 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](LICENSE)
[](https://github.com/imponeer/smarty-sunrise-http-router/releases) [](http://php.net)
[](https://packagist.org/packages/imponeer/smarty-sunrise-http-router)# Smarty Sunrise HTTP Router Extensions
This library adds some `url` function that generates named route for [Sunrise HTTP Router](https://github.com/sunrise-php/http-router).
## Installation
To install and use this package, we recommend to use [Composer](https://getcomposer.org):
```bash
composer require imponeer/smarty-sunrise-http-router
```Otherwise, you need to include manually files from `src/` directory.
## Registering in Smarty
If you want to use these extensions from this package in your project you need register them with [`registerPlugin` function](https://www.smarty.net/docs/en/api.register.plugin.tpl) from [Smarty](https://www.smarty.net). For example:
```php
$smarty = new \Smarty();
$urlPlugin = new \Imponeer\Smarty\Extensions\SunriseHTTPRouter\UrlFunction($router);
$smarty->registerPlugin('function', $urlPlugin->getName(), [$urlPlugin, 'execute']);
```## Using from templates
To generate url for named route:
```smarty
go there
````attributes` can be used also as shortcut `attr` or not used at all. This param maybe needed depending on a route.
## How to contribute?
If you want to add some functionality or fix bugs, you can fork, change and create pull request. If you not sure how this works, try [interactive GitHub tutorial](https://skills.github.com).
If you found any bug or have some questions, use [issues tab](https://github.com/imponeer/smarty-sunrise-http-router/issues) and write there your questions.