Yiistrap and Yii 2.0

Dear all

I have been struggling with the following problem for quite some time. I want to use Yiistrap in my new project, as it seems it promissed nice extra features on top of the classic bootstrap theme.

The thing is, I just cannot manage to get it configured and it seems the documentation is lacking…

So let me explain what I did: (as stated on the configuration site)

[list=1]

[*]1 downloaded the basic template for yii2.0

[*]2 I downloaded the Yiistrap with composed (installed in ./vendor/2amigos/yiistrap)

[*]3 tried to configure the main.php file (which the basic template does not have) so I changed web.php

[/list]

But here it goes wrong: I’m not sure what to do there but I changed the following (but here it crashes … )


$config = [

    'id' => 'horizon',

    'basePath' => dirname(__DIR__),

    //'bootstrap' => ['log',"gii"],

    // path aliases

    

    'aliases' => array(

		'bootstrap' => dirname(__FILE__) . '/vendor/2amigos/yiistrap',	

	),    

    // application modules

    'modules' => array(


        'gii' => array(

            'generatorPaths' => array('bootstrap.gii'),

            'gii' => 'yii\gii\Module',

        ),

    ),

    'components' => [

        'bootstrap' => array(

                'class' => 'bootstrap.components.TbApi',

        ),

        'request' => [

            // !!! insert a secret key in the following (if it is empty) - this is required by cookie validation

            'cookieValidationKey' => 'NVR3vC3RvKCj78TH_GIJnBhIVlnAWkmg',

        ],

        'cache' => [

            'class' => 'yii\caching\FileCache',

        ],

        'user' => [

            'identityClass' => 'app\models\User',

            'enableAutoLogin' => true,

        ],

        'errorHandler' => [

            'errorAction' => 'site/error',

        ],

        'mailer' => [

            'class' => 'yii\swiftmailer\Mailer',

            // send all mails to a file by default. You have to set

            // 'useFileTransport' to false and configure a transport

            // for the mailer to send real emails.

            'useFileTransport' => true,

        ],

        'log' => [

            'traceLevel' => YII_DEBUG ? 3 : 0,

            'targets' => [

                [

                    'class' => 'yii\log\FileTarget',

                    'levels' => ['error', 'warning'],

                ],

            ],

        ],

        'db' => require(__DIR__ . '/db.php'),

        'urlManager' => [

            

            'showScriptName' => false,

            'enablePrettyUrl' => true

                  ],    

    ],

    'params' => $params,




    

];

The register does not work and I cannot seem to use the widget… So can somebody tell me how to configure Yii2.0 with yiistrap?

I think YiiStrap is for Yii 1.x only. You would probably be better off using extensions designed specifically for Yii 2. A great resource that provides most if not all of the same functionality as YiiStrap is Kartik’s Widgets: https://github.com/kartik-v/yii2-widgets

Thanks for the Tip. I was unaware that Yii2.0 was incompatible with Yii1 (which in my opinion does not seem as a good rule of design). I used the kartik widgets!

Thanks