Yii 2.o Failures

I find the Yii 2.0 version too difficult to be usable. The composer adds another level of complexity that is not desirable nor warranted. The one thing this version produced consistently is errors.

The total lack of support is not good for this product. I have waited a long time for this version only to find my waiting was in vain.

I will use visual studio for my next web project not Yii 2.0.

For me Yii is a bust!

Sad to hear that. Any concrete errors you’re experiencing?

Note that Yii 2.0 isn’t released yet so bugs are expected.

C:\xp\wamp\www>composer create-project --prefer-dist yiisoft/yii2-app-basic basi

c >> out.txt


Could not find package yiisoft/yii2-app-basic with stability stable.

create-project [-s|–stability="…"] [–prefer-source] [–prefer-dist] [–repos

itory-url="…"] [–dev] [–no-dev] [–no-plugins] [–no-custom-installers] [–n

o-scripts] [–no-progress] [–keep-vcs] [–no-install] [package] [directory] [ve


Hi archman007!

I’m migrating from Yii 1.1 to 2.0 and there are a lot of new things to learn.

Composer, bower, changes in Yii core, etc.

But I managed to build a small app with Yii 2.0 RC in 1 week and I can guarantee it’s not difficult to learn Yii 2 to who is coming from Yii 1.1. Just take your time thru the 2.0 guide. I know it’s not as complete as the 1.1 yet, but It helped me a lot.

And please, show us some of the errors you got so someone may help you with them.

I have the advanced system set up but when I use Gii it cannot find what Gii produced. I would expect for code generated by Gii to work in the Yii environment. What is wrong? Thanks for your assistance in this endeavor.

Is there an example that show how the GII crud form should work? I was unable to find the example(s). This should not as difficult as it is.

Here is the gii input:

This generator generates a controller and views that implement CRUD (Create, Read, Update, Delete) operations for the specified data model.

Model Class

Search Model Class

Controller Class

Base Controller Class


Module ID


Widget Used in Index Page


Enable I18N

Code Template

default (C:\xp\wamp\www\yii-application\vendor\yiisoft\yii2-gii\generators\crud/default)

When I try and execute this via http://localhost/yii-application/frontend/web/index.php?r=phone

I get the following:


Unknown Class – yii\base\UnknownClassException

Unable to find ‘frontend\controllers\PhoneController’ in file: C:\xp\wamp\www\yii-application/frontend/controllers/PhoneController.php. Namespace missing?

  1. in C:\xp\wamp\www\yii-application\vendor\yiisoft\yii2\BaseYii.php at line 291

282283284285286287288289290291292293294295296297298299300 return;


    } else {




    if (YII_DEBUG && !class_exists($className, false) && !interface_exists($className, false) && !trait_exists($className, false)) {

        throw new UnknownClassException("Unable to find '$className' in file: $classFile. Namespace missing?");




 * Creates a new object using the given configuration.


 * You may view this method as an enhanced version of the `new` operator.

 * The method supports creating an object based on a class name, a configuration array or

 * an anonymous function.
  1. yii\BaseYii::autoload(‘frontend\controllers\PhoneContro…’)

  2. spl_autoload_call(‘frontend\controllers\PhoneContro…’)

  3. in C:\xp\wamp\www\yii-application\vendor\yiisoft\yii2\base\Module.php – class_exists(‘frontend\controllers\PhoneContro…’) at line 563

  4. in C:\xp\wamp\www\yii-application\vendor\yiisoft\yii2\base\Module.php – yii\base\Module::createControllerByID(‘phone’) at line 521

  5. in C:\xp\wamp\www\yii-application\vendor\yiisoft\yii2\base\Module.php – yii\base\Module::createController(‘phone’) at line 449

  6. in C:\xp\wamp\www\yii-application\vendor\yiisoft\yii2\web\Application.php – yii\base\Module::runAction(‘phone’, [‘r’ => ‘phone’]) at line 83

  7. in C:\xp\wamp\www\yii-application\vendor\yiisoft\yii2\base\Application.php – yii\web\Application::handleRequest(yii\web\Request) at line 375

  8. in C:\xp\wamp\www\yii-application\frontend\web\index.php – yii\base\Application::run() at line 18

12131415161718 require(DIR . ‘/../../common/config/main-local.php’),

require(__DIR__ . '/../config/main.php'),

require(__DIR__ . '/../config/main-local.php')


$application = new yii\web\Application($config);


$_GET = [

'r' => 'phone',


$_SERVER = [

'HTTP_HOST' => 'localhost',

'HTTP_CONNECTION' => 'keep-alive',

'HTTP_ACCEPT' => 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',

'HTTP_USER_AGENT' => 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.124 Safari/537.36',

'HTTP_ACCEPT_ENCODING' => 'gzip,deflate,sdch',

'HTTP_ACCEPT_LANGUAGE' => 'en-US,en;q=0.8',

'HTTP_COOKIE' => '_csrf=5ddc19cc3e10465c7f8c29afb371d68c1d6ff4443c50d6b64d74ee5e18e22d55s%3A32%3A%22yvd1ZczYew-roxQ9GTXC1wKSKK4vwNcX%22%3B; PHPSESSID=5o6612st2o2j139hl5gi1t90u7',

'PATH' => 'C:\\Program Files (x86)\\SoftDevLabs\\FishLib;C:\\Program Files (x86)\\Windows Kits\\8.1\\Windows Performance Toolkit\\;C:\\Program Files\\Microsoft SQL Server\\110\\Tools\\Binn\\;C:\\Program Files (x86)\\Microsoft SDKs\\TypeScript\\1.0\\;C:\\xp\\wamp\\bin\\php\\php5.4.3;C:\\ProgramData\\ComposerSetup\\bin',

'SystemRoot' => 'C:\\Windows',

'COMSPEC' => 'C:\\Windows\\system32\\cmd.exe',


'WINDIR' => 'C:\\Windows',


'SERVER_SOFTWARE' => 'Apache/2.2.22 (Win32) PHP/5.4.3',

'SERVER_NAME' => 'localhost',

'SERVER_ADDR' => '',

'SERVER_PORT' => '80',

'REMOTE_ADDR' => '',

'DOCUMENT_ROOT' => 'C:/xp/wamp/www/',

'SERVER_ADMIN' => 'admin@localhost',

'SCRIPT_FILENAME' => 'C:/xp/wamp/www/yii-application/frontend/web/index.php',

'REMOTE_PORT' => '27567',




'QUERY_STRING' => 'r=phone',

'REQUEST_URI' => '/yii-application/frontend/web/index.php?r=phone',

'SCRIPT_NAME' => '/yii-application/frontend/web/index.php',

'PHP_SELF' => '/yii-application/frontend/web/index.php',

'REQUEST_TIME_FLOAT' => 1412715408.899,

'REQUEST_TIME' => 1412715408,


$_COOKIE = [

'_csrf' => '5ddc19cc3e10465c7f8c29afb371d68c1d6ff4443c50d6b64d74ee5e18e22d55s:32:"yvd1ZczYew-roxQ9GTXC1wKSKK4vwNcX";',

'PHPSESSID' => '5o6612st2o2j139hl5gi1t90u7',


Yii Framework

2014-10-07, 20:56:48

Apache/2.2.22 (Win32) PHP/5.4.3

Yii Framework/2.0.0-dev

If you understand yii2 well you will find that it’s extremely powerful … have you tested dependency injection or service locator or behaviors or events … it’s powerful man ;)

Non functioning code generated by this application is not powerful. IJS As opposed to telling me how powerful it is how about a demonstration on what you are speaking of. Thanks

ok in your code shown above it tells you simply that the PhoneController.php file can not be founded so serch your app for this file and put it in this directory


i think in your code generator did not enter the controller class correctly

otherwise i’ll let you discover yii power yourself ;)

I wrote my first code generator in 1974. It works to this day. The Phone Controller is in C:\xp\wamp\www\yii-application\frontend\controllers

Please be my guest and guess again.

Is because Yii 2.0 isn’t released yet. You need to add --dev for now but soon it will work w/o it.

In the Gii for advanced app you need to specify namespaces because Gii can’t automatically detect if code generated should be in common, frontend or backend. I see your controller file is correct so the second guess is to verify that namespace generated matches it i.e. it is frontend/controllers.

It’s unfortunate that you don’t like Composer. Composer is one of the best improvements that Yii added IMO. Pretty much every mainstream PHP project uses Composer now. It also makes installing extension effortless.

Sounds like your biggest problem is attempting to use a project that isn’t fully released yet and you expect it to run 100% with documentation. Honestly Yii 2’s documentation is pretty good since it isn’t out yet and it has had documentation for several months (at least).

When it complains about a namespace missing, it’s usually simple case of the namespace being wrong or missing a use statement somewhere. Other ideas:

Also important for advanced app, not sure if it could be a problem here, bootstrap.php in \common\config:

Yii::setAlias(‘common’, dirname(DIR));

Yii::setAlias(‘frontend’, dirname(dirname(DIR)) . ‘/frontend’);

Yii::setAlias(‘backend’, dirname(dirname(DIR)) . ‘/backend’);

[size=2]Yii::setAlias(‘console’, dirname(dirname(DIR)) . ‘/console’);[/size]

If that is missing, it could throw a namespace missing message

One other problem I experienced was I accidentally created a duplicate folder in the wrong place, when I first tried Yii 2. Not sure how I did it actually, maybe through Gii, but it ran me in circles for a while because even my IDE was acting weird about it. Probably not the case with your problem, but you might want to look for that just to be sure.

My guess is that you have something like app\controllers for namespace when you need frontend\controllers or something along those lines. It took me a while to get the namespaces sorted out when I first started using Yii 2.

As someone who is coming at this from the other end of the spectrum in terms of coding experience, as in not having a lot, I think you will fall in love with Yii 2, once you get past the speed bump of set up and basic familiarity. It’s a great framework.