Yii Framework Forum: Yii 2.0 framework description (marketing alert!) - Yii Framework Forum

Jump to content

  • (5 Pages)
  • +
  • « First
  • 3
  • 4
  • 5
  • You cannot start a new topic
  • You cannot reply to this topic

Yii 2.0 framework description (marketing alert!)

#81 User is offline   Webspeed 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 22
  • Joined: 14-March 09

Posted 07 July 2013 - 12:20 AM

The "Yii - we don't force you" would be good if it were true, but actually one of the things I've read people dislike about Yii is that it does force coders into a certain way, as discussed in this Laravel forum thread:


"Any more than that and I feel that a framework starts pushing you towards it's way of thinking, which usually - doesn't suit everyone."

This is precisely the issue I ran into with Yii. It's very opinionated, which is fine if it fits. In my case it didn't, and I ended up fighting against the framework.

I initially liked Yii, but quickly ran into issues.

First, the crud/authentication generators assume a certain site structure: if your project has a different structure, as mine does, the generators break. So you you miss out on one of the most attractive features.

Second, if you don't subscribe to the view that PHP is a good templating language you're out of luck - it's tricky to get 3rd party templates to play nicely with the Yii form system.

Third, they don't use IoC, and the alternatives add complexity. The event system is powerful, and the pseudo-mixin capability is pretty cool. But I'm not convinced that heavy reliance on these mechanisms for extensibility makes for clean, comprehensible code. And it does make testing harder: for database testing, for example, you end up spending a lot of time building fixtures and making sure your testing database and development database are in sync. In the end this is a question of style, but I prefer the Laravel approach. I think Laravel has found a good balance between flexibility, testability and convenience.

Fourth, as the OP says, there's that hard-to-define sense that coding in Laravel is simpler and more elegant. For example, Eloquent2 beats Yii's Active Record implementation hands-down, I feel. When I was playing with Yii I kept on thinking "this would be easier in Laravel".

I think Yii slogan needs to re-emphasize the high-performance claim (which has been stolen by Fabien Potencier for Symfony 2, even though it is a very slow framework) and appeal to coders who dislike "enterprise" frameworks that embrace complexity to feed their consulting business (hello ZF and SF2). Here's my suggestion:

"Yii is a high-performance component-based PHP framework best for practical developers to build high traffic web applications."

Note the "practical developer" reference, I picked that up from SamDark's Yii2 presentations.


#82 User is offline   schmunk 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 584
  • Joined: 02-November 08
  • Location:Stuttgart, Germany

Posted 08 July 2013 - 06:27 AM

Hi Webspeed,

thanks for your posting. I am looking from time to time for negative reviews about Yii, just to think out of the box. But they're hard to find, so I really appreciate it. :)

I'd say "First" and "Second" are just plain wrong. You can (easily) add the functionality to gii and there are several templating engines supported in Yii.
Can't say much about "Third" and about "Fourth" ... let's see what Yii2 brings.

Best regards,
Phundament - Yii Application Boilerplate with composer support
Fork on github

Follow phundament on Twitter

DevSystem: Mac OS X 10.7 - PHP 5.3 - Apache2 - Yii 1.1 / trunk - Firefox or Safari

#83 User is offline   Onman 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 175
  • Joined: 26-December 09
  • Location:The Netherlands

Posted 08 July 2013 - 12:12 PM

Both Yii and Yii2 suply the foundation for IoC: behaviors.
They also supply the foundation for DI: Yii::createObject.

Yii2 almost supports DI: Yii::$objectConfig as the metadata configuration and Yii::createObject as the dependency manager. Only properties that need to be initialized with a unique instance of a class are not supported.

What Yii needs to support true IoC is a 'manager' (IoC manager). This manager would need a configuration array to list, per class, all behaviors that need to be attached to the class.

Yii::$objectDependencies = array(
..'yii\Controller' => array(
.....'interface1' => 'MyControllerBehavior',
.....'interface2' => 'YourControllerBehavior',

class \yii\Component
..function __construct(...)
..... ...
.....$di = Yii::$objectDependencies[get_class()];
.....// optionally check for missing interface declarations and fill these with default behaviors, although this is probably not really necessairy for true IoC.
..... ...

Or maybe there could be a separate function, similar to or integrated in Yii::createObject.

I hope this can serve as a basis for your thoughts on IoC within Yii.

Share this topic:

  • (5 Pages)
  • +
  • « First
  • 3
  • 4
  • 5
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users