yii2 by peter jack kambey

27
Peter J. Kambey Yii Enthusiasm HIGH PERFORMANCE & BEST FEATURES YII-2

Upload: k4ndar

Post on 05-Jul-2015

1.410 views

Category:

Software


0 download

DESCRIPTION

Introduction about Yii2 by Peter Jack Kambey

TRANSCRIPT

Page 1: Yii2 by Peter Jack Kambey

Peter J. Kambey – Yii Enthusiasm

HIGH PERFORMANCE

&

BEST FEATURES YII-2

Page 2: Yii2 by Peter Jack Kambey

About Me

http://about.me/peterjkambey

Page 3: Yii2 by Peter Jack Kambey

What’s New Yii-2

⦿ Composer

⦿ PSR Compliance. Autoloading

⦿ PHP 5.4 or above ▪ Namespaces. ▪ Anonymous functions.▪ Short array syntax.▪ Short echo tags <?= are used in view files. ▪ SPL classes and interfaces.▪ Late Static Bindings.▪ Date and Time.▪ Traits.▪ intl.

Page 4: Yii2 by Peter Jack Kambey

A. Non Yii Users / New

Comers

Page 5: Yii2 by Peter Jack Kambey

http://www.yiiframework.com/doc-2.0/guide-index.html

Page 6: Yii2 by Peter Jack Kambey

What is Yii

Page 7: Yii2 by Peter Jack Kambey

What is Yii Best for?

Page 8: Yii2 by Peter Jack Kambey

Yii vs Other Frameworks?

• MVC (Model-View-Controller)

• Design pattern

• Full-stack framework with ready-to-use features:

query builders and ActiveRecord for both relational and NoSQL databases;

RESTful API development support;

multi-tier caching support;

and more.

• Extremely extensible.

• High performance is always a primary goal of Yii.

• Backed up by a strong core developer team, as well as a large community of

professionals constantly contributing to Yii's development.

Page 9: Yii2 by Peter Jack Kambey

Personal Opinion

Page 10: Yii2 by Peter Jack Kambey

B. Yii Users

Page 11: Yii2 by Peter Jack Kambey

Namespaces

⦿ Prefixes no longer used

⦿ Based on directory structure

e.g. yii\web\Request

Page 12: Yii2 by Peter Jack Kambey

Events

⦿ onEvent method definition no longer

needed

⦿ $component->on($eventName,

$handler);

Page 13: Yii2 by Peter Jack Kambey

Path Alias

⦿ Must use @

⦿ @yii means Yii installation directory

⦿ Closely related to class namespaces

Page 14: Yii2 by Peter Jack Kambey

View Class

⦿ $this in a view no longer means controller or

widget object

⦿ Smarty and Twig support added

⦿ Prado support removed

Page 15: Yii2 by Peter Jack Kambey

Models

⦿ formName() returns the form name (previously hardcoded)

⦿ Load() and loadMultiple() added to aid data population

⦿ New method: scenarios() to define which fields need to be validated

⦿ Safe validators discontinued, scenarios() define which are safe

Page 16: Yii2 by Peter Jack Kambey

Controllers

⦿ Render() and renderPartial() return content

instead of sending it out

⦿ One must echo contents now

Page 17: Yii2 by Peter Jack Kambey

Widgets

⦿ Simplified process

⦿ Use begin(), end() and widget() instead of

passing strings through beginWidget() and

endWidget().

Page 18: Yii2 by Peter Jack Kambey

Themes

⦿ CThemeManager is gone

⦿ Path maps

⦿ ['/web/views' => '/web/themes/basic’]

⦿ /web/views/site/index.php will be /web/themes/basic/site/index.php

⦿ Any view file can have a theme, even if rendered outside of the context of a controller

Page 19: Yii2 by Peter Jack Kambey

Console applications

⦿ Controllers

⦿ Console and web controllers have same

base class

⦿ Console controller is similar to

CConsoleCommand

Page 20: Yii2 by Peter Jack Kambey

Internationalisation (i18n)

⦿ Date and number formatter are out

⦿ PECL intl php module is in

⦿ I18n application component

Page 21: Yii2 by Peter Jack Kambey

ActiveForm

⦿ Field: label, input, error message and

hint text

Page 22: Yii2 by Peter Jack Kambey

Query Builder

⦿ CDbCommand, CDbCriteria,

CDbCommandBuilder

⦿ yii\db\Query|Query = DB

⦿ yii\db\QueryBuilder|QueryBuilder =

Query

Page 23: Yii2 by Peter Jack Kambey

Active Record

⦿ yii\db\ActiveRecord|ActiveRecord

⦿ Relational AR Query

⦿ 1.1 = relations()

⦿ 2.0 = getter methods

Page 24: Yii2 by Peter Jack Kambey

Active Record

⦿ No longer uses model(), but uses the

find method:

Page 25: Yii2 by Peter Jack Kambey

User and IdentityInterface

⦿ CWebuser is now yii\web\User

⦿ CUserIdentity is no more

⦿ yii\web\IdentityInterface

Page 26: Yii2 by Peter Jack Kambey

URL Management

⦿ Optional parameters are now supported

Page 27: Yii2 by Peter Jack Kambey

⦿ Installing Yii

⦿ Generating Code with Gii

⦿ Handling Errors

⦿ Logging

⦿ Query Builder

⦿ Active Record

⦿ Migrations

⦿ Sphinx

⦿ Redis

⦿ MongoDB

⦿ ElasticSearch

⦿ Security

⦿ Caching

⦿ RESTful Web Services

⦿ Development Tools

⦿ Testing

Yii 2.0 Keys Success

⦿ Advanced Application Template

⦿ Console Commands

⦿ Core Validators

⦿ Internationalization

⦿ Mailing

⦿ Template Engines

⦿ Working with Third-Party Code

⦿ GridView

⦿ ListView

⦿ DetailView

⦿ Pjax

⦿ Menu

⦿ LinkPager

⦿ LinkSorter

⦿ Bootstrap Widgets

⦿ Jquery UI Widgets