dmirogin/yii2-js-urlmanager

This package is abandoned and no longer maintained. No replacement package was suggested.

Yii2 javascript URL manager

Installs: 15 434

Dependents: 1

Suggesters: 0

Security: 0

Stars: 53

Watchers: 4

Forks: 6

Open Issues: 2

Language:TypeScript

Type:yii2-extension

1.2.2 2024-03-27 09:21 UTC

This package is not auto-updated.

Last update: 2024-04-14 00:02:04 UTC


README

Latest Stable Version License

Yii2 js UrlManager

That extension provide a way to create urls from your frontend part.

Instalation

composer require dmirogin/yii2-js-urlmanager
  1. How to use
  2. PHP options
  3. Contributing
  4. Roadmap

How to use

  1. Add component to your application configuration
    'jsUrlManager' => [
        'class' => \dmirogin\js\urlmanager\JsUrlManager::class,
    ],
  2. Add component to bootstrap
    'bootstrap' => ['jsUrlManager'],
  3. Now you can use window.UrlManager or just UrlManager in your frontend part
       UrlManager.createUrl('foo/bar', {id: 10})

if you want to change assets position, use this

'assetManager' => [
    'bundles' => [
        \dmirogin\js\urlmanager\JsUrlManagerAsset::class => [
            'jsOptions' => [
                'position' => \yii\web\View::POS_END,
            ],
        ],
    ],
],

PHP options

configurationStringPosition - integer

Default value - \yii\web\View::POS_HEAD

The location to register configuration Frontend UrlManager string

'jsUrlManager' => [
    'class' => \dmirogin\js\urlmanager\JsUrlManager::class,
    'configurationStringPosition' => \yii\web\View::POS_END,
],

configureThroughVariable - boolean

Default value - false

Setting configuration through document variable urlManagerConfiguration

'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