https://github.com/dmirogin/yii2-js-urlmanager
That extension provide a way to create urls from your frontend part.
https://github.com/dmirogin/yii2-js-urlmanager
yii2 yii2-asset yii2-extension
Last synced: 4 months ago
JSON representation
That extension provide a way to create urls from your frontend part.
- Host: GitHub
- URL: https://github.com/dmirogin/yii2-js-urlmanager
- Owner: dmirogin
- License: mit
- Archived: true
- Created: 2017-02-25T20:33:55.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2024-04-01T09:43:28.000Z (about 1 year ago)
- Last Synced: 2025-01-14T11:05:40.298Z (4 months ago)
- Topics: yii2, yii2-asset, yii2-extension
- Language: TypeScript
- Homepage:
- Size: 169 KB
- Stars: 52
- Watchers: 4
- Forks: 6
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
[](https://packagist.org/packages/dmirogin/yii2-js-urlmanager)
[](https://packagist.org/packages/dmirogin/yii2-js-urlmanager)
# Yii2 js UrlManagerThat extension provide a way to create urls from your frontend part.
### Instalation
```php
composer require dmirogin/yii2-js-urlmanager
```1. [How to use](#how-to-use)
2. [PHP options](#php-options)
3. [Contributing](#contributing)
4. [Roadmap](#roadmap)1. Add component to your application configuration
```php
'jsUrlManager' => [
'class' => \dmirogin\js\urlmanager\JsUrlManager::class,
],
```
2. Add component to bootstrap
```php
'bootstrap' => ['jsUrlManager'],
```
3. Now you can use window.UrlManager or just UrlManager in your frontend part
```js
UrlManager.createUrl('foo/bar', {id: 10})
```if you want to change assets position, use this
```php
'assetManager' => [
'bundles' => [
\dmirogin\js\urlmanager\JsUrlManagerAsset::class => [
'jsOptions' => [
'position' => \yii\web\View::POS_END,
],
],
],
],
```
### PHP options#### configurationStringPosition - integer
Default value - \yii\web\View::POS_HEADThe location to register configuration Frontend UrlManager string
```php
'jsUrlManager' => [
'class' => \dmirogin\js\urlmanager\JsUrlManager::class,
'configurationStringPosition' => \yii\web\View::POS_END,
],
```#### configureThroughVariable - boolean
Default value - falseSetting configuration through document variable urlManagerConfiguration
```php
'jsUrlManager' => [
'class' => \dmirogin\js\urlmanager\JsUrlManager::class,
'configureThroughVariable' => true,
],
```
### Contributing
1. Clone project
2. Write code
3. Test
```
npm run test
```
```
./vendor/bin/phpunit
```
4. Build js
```
npm run build
```### Roadmap
* Disable or enable including rules in frontend
* Creating absolute urls