yiisoft/yii2 — pull request #3535 by ofat (2014-05-21 17:16:45+00:00)
Title: Support for php namespaces, static methods and yii widgets

Here is example of using:

in yii we do:
```php

...
'My Company',
'brandUrl' => Yii::$app->homeUrl,
'options' => [
'class' => 'navbar-inverse navbar-fixed-top',
],
]);
...
echo Nav::widget([
'options' => ['class' => 'navbar-nav navbar-right'],
'items' => [...],
]);
NavBar::end();
?>

$this->params['breadcrumbs']
]) ?>

```

With these functions we can do:

```php
{{ use([
'yii\\bootstrap\\Nav',
'yii\\bootstrap\\NavBar',
'frontend\\assets\\AppAsset',
'frontend\\widgets\\Alert'
]) }}
{{ static('AppAsset', 'register', this) }}
...
{{ widget_begin('NavBar', { brandLabel: app.name, brandUrl: app.homeUrl, options: { class: 'navbar-inverse navbar-fixed-top' } }) }}
...
{{ widget('Nav', {options: { class: 'navbar-nav navbar-right' }, items: ...) }}
...
{{ widget_end('NavBar') }}
...

{{ widget('yii\\widgets\\Breadcrumbs', {links: this.params['breadcrumbs']}) }}

{{ widget('Alert') }}

```

Also we can define namespaces globally in config files:

```php
'namespaces' => [
'\yii\bootstrap\NavBar',
],
```