Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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 (about 3 years ago)
- Default Branch: main
- Last Pushed: 2024-08-01T11:48:13.000Z (5 months ago)
- Last Synced: 2024-10-02T18:16:58.027Z (3 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://img.shields.io/github/license/imponeer/smarty-sunrise-http-router.svg)](LICENSE)
[![GitHub release](https://img.shields.io/github/release/imponeer/smarty-sunrise-http-router.svg)](https://github.com/imponeer/smarty-sunrise-http-router/releases) [![PHP](https://img.shields.io/packagist/php-v/imponeer/smarty-sunrise-http-router.svg)](http://php.net)
[![Packagist](https://img.shields.io/packagist/dm/imponeer/smarty-sunrise-http-router.svg)](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.