yii2 - presentasi yii2 di panadaconf, 1 november 2014

Post on 26-Jun-2015

570 Views

Category:

Technology

7 Downloads

Preview:

Click to see full reader

DESCRIPTION

Presentasi Yii2 yang di event Panada Conference, Menara Bank Mega, 1 November 2014

TRANSCRIPT

Peter J. Kambey – Yii Enthusiasm

HIGH PERFORMANCE &

BEST FEATURES YII-2

About Me

http://about.me/peterjkambey

Family Office

Community

What’s New Yii-2

Composer

•Easy Installation •Easy Update•Centralize Repo

PSR Compliance•PSR-0 Autoloading Standard •PSR-1 Basic Coding Standard•PSR-2 Coding Style Guide•PSR-3 Logger Interface•PSR-4 Improved Autoloading

PHP 5.4 •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.

A. Non Yii Users / New Comers

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

What is Yii

high performance

component-based PHP

What is Yii Best for?

generic Web programming framework

All kinds of Web applications using PHP.

Large-scale applications portals, forums, content management systems

(CMS), e-commerce projects, RESTful Web services, etc

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.

Personal Opinion

RICH

FEATUR

ES

• Model-View-Controller (MVC)

• Security (RBAC/ACL)

• Automatic code generation

FULL OOP

•Inheritance•Extend•Static

EASY INTEG

RATION

•AR/ORM•Mailer•Jquery/Ajax•Bootstrap Twitter•Cache

B. Yii Users

Namespaces

Prefixes no longer used

Based on directory structuree.g. yii\web\Request

Events

onEvent method definition no longer needed

$component->on($eventName, $handler);

Path Alias

Must use @ @yii means Yii installation directory Closely related to class namespaces

View Class

$this in a view no longer means controller or widget object

Smarty and Twig support added Prado support removed

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

Controllers

Render() and renderPartial() return content instead of sending it out

One must echo contents now

Widgets

Simplified process Use begin(), end() and widget() instead

of passing strings through beginWidget() and endWidget().

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

Console applications

Controllers Console and web controllers have same

base class Console controller is similar to

CConsoleCommand

Internationalisation (i18n)

Date and number formatter are out PECL intl php module is in I18n application component

ActiveForm

Field: label, input, error message and hint text

Query Builder

CDbCommand, CDbCriteria, CDbCommandBuilder

yii\db\Query|Query = DB yii\db\QueryBuilder|QueryBuilder =

Query

Active Record

yii\db\ActiveRecord|ActiveRecord Relational AR Query 1.1 = relations() 2.0 = getter methods

Active Record

No longer uses model(), but uses the find method:

User and IdentityInterface

CWebuser is now yii\web\User CUserIdentity is no more yii\web\IdentityInterface

URL Management

Optional parameters are now supported

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 Unit 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

THANK YOU

top related