Yii 2.1, PHP and frameworks

Alexander Makarov

Yii core team, Skyeng


About me

We are going to talk about

  • PHP.
  • Where is it heading to.
  • What to learn?
  • Which framework to choose next?
  • Yii.

The talk is mainly for the ones learning.

Let's start with PHP


Where is PHP heading to?

But first a bit about languages in general

What's the difference between languages?


  • Novice.
  • Specialist.
  • Professional.
  • ...

There are almost no all-stars IT-teams when it comes to real business. You need a language for novices.

Novices need

  • Frames (guidelines, limitations).
  • Strictness.
  • Examples.
  • Java is for novices.
  • Python is for experienced.
  • JavaScript...

Features are less important

When developing for web we're more assemblying things rather than developing.
If we need something unique (often quick-performing) we can do it as golang microservice.

Paradigm is important!


  • Just for fun.
  • Own projects for $.
  • Teams for $.
  • Many teams for $.

PHP improvements over years

Composer PHP stats

PHP 7.0

  • Performance.
  • More exceptions.
  • Return types and scalar typehints.
  • assert().
  • Security.
  • phpdoc is always cached (annotations).

PHP 7.1

  • nullable types.
  • void return.
  • Constant visibility (private, protected, public).
  • pcntl_async_signals.

PHP 7.2

  • object as typehint.
  • More security.
  • Syntactic sugar.

PHP 7.3

  • is_countable().
  • Syntactic sugar.


Is PHP okay?

It is!

  • Somewhere between "for novice" and "for fun".
  • Frameworks could shift above position.
  • Teamleads and tools are watching.
  • Allows prototyping fast.
  • Infrastrutcutre is great! Composer.
  • stateless by default.

What to learn?

Learn what you can use anywhere

  • OOP/OOD. Check yourself with cohesion/coupling.
  • Security.
  • SQL.
  • CAP (Consistency-Availability-Partition Tolerance).
  • Basic undestanding of algorithm complexity.
  • Refactoring.
  • Linux.

You still should learn the framework you use!

Business needs

  • Predictability.
  • Performance.
  • Adequate cost.
  • Ability to express yourself clearly.
  • Ability to write dirty code quickly.
  • Ability to estimate.
  • Desire to learn new things.

Which framework to choose next?

What do we have?

  • Laravel.
  • Symfony.
  • Yii 2.
  • CakePHP.
  • CodeIgniter.
  • Zend Framework.
  • reactphp.
  • Phalcon.
  • FuelPHP.
  • Slim, F3, ...


  • Excellent marketing. Most popular framework nowadays.
  • Secret priorities similar to Apple.
  • Questionable community relations.
  • It's alright.


  • Strong limitations.
  • Performance issues are being solved by caching and compiling (OroCRM).
  • It better if cache works well. Debug isn't easy. There are many layers.
  • Style is similar to Java and Spring.

Zend Framework

Similar to Symfony. Too similar.


  • Way better perforance.
  • Can't dig into it easily. It is PECL.


Great for async daemons.

Web studio

  • Wordpress.
  • Drupal.
  • ...

Some studios create their own CMS with frameworks.

What do you really need from a framework?

It should be enjoyable.

What about no framework approach?

Do you have enough experience and time?

  • You'll build a framework anyway.
  • Each library is OK by itself but how about 10 libraries used together?
  • How to teach your team?
  • Deadlines... yesterday?

Try it. We succeeded in making a framework ;)

Don't get stuck with a single language or framework

  • PHP MVC.
  • Rapid development.
  • You can get from MVP to support and development.
  • Lots of features out of the box.
  • Flexible and pragmatic.
  • Allows taking shortcuts.
  • Non-commerial.

Some stats

  • Slack, 957 users.
  • 392 projects at YiiPowered.
  • 12017 Github stars.
  • 32027 Facebook group members.

Yii philosophy

  • Complexity should be enough and not more than that.
  • API and code usability first.
  • Document everything.
  • Backwards compatiblity and support are important.
  • Listen to your community.
  • OpenSource is working together on something we all benefit from.

Same as with every framework Yii has its pros and cons.

  • RAD
  • Not too strict
  • Thin abstractions
  • Performance
  • ...

Yii 2.0 mistakes

Tried to handle too much

Got too much into the core.

  • jQuery.
  • PJAX.
  • Masked input.
  • More clientside :(

fxp composer plugin

Gave many issues. Both good and bad.

We haven't used many PSRs

They were mostly accespted after framework release. Backwards compatibility...


  • New website (OpenSource).
  • Infrastructure imrovements.
  • ActiveRecord and DB layer internals were refactored.
  • Got feedback at Trello.
  • Yii 2.0 is feature frozen.
  • Yii 2.1 in progress.
  • yiisoft/di.
  • Still supporting 1.1.

We need your help!

Questions time!

What do you want to see in 3.0?