This document summarizes new features in Yii2 and PHP 5.5. For Yii2, it discusses changes to namespaces, components/objects, views, models, and queries. Key changes include improved namespaces, introduction of Objects and Components, views as objects, and standalone query builder. For PHP 5.5, it covers generators, final keyword, bundled opcode cache, and improved password hashing API. The presenter encourages trying out Yii2 on GitHub and provides contact for job opportunities.
1. What's New InWhat's New In
Yii2 & PHP5.5Yii2 & PHP5.5
Petra Novandi Barus
Chief Technology Officer
UrbanIndo.com
PHP Indonesia MeetupPHP Indonesia Meetup
2. Who Am IWho Am I
● 2009 Graduated from Informatics Eng. ITB
– Activities: OS and Internet programming lecture assistant, table
tennis unit, etc.
● 2011 Graduated from Master Informatics Eng. ITB
– Specialize in distributed systems and parallel programming
● 2011 Recruited as CTO for UrbanIndo.com
Contact Me:
- mail: petra@urbanindo.com
- twitter: @petrabarus
- linkedin: http://linkedin.com/in/petrabarus
3. UrbanIndoUrbanIndo
● A real-estate marketplace for Indonesia: house, land,
apartment, commercial, room.
● Board members consist of professionals from Silicon
Valley: Apple, Google, Yahoo.
● Launched November 2011
● Got investment from East Ventures 4 months later
● Got investment from Gree Ventures & IMJ Fenox in 2013
● Currently listing
– 16 thousand registered users
– 7 thousand agents
– 100 thousand properties
5. What I'm Going To Talk AboutWhat I'm Going To Talk About
●Yii2
● PHP 5.5
(Not really related with Yii2, just filling some time for the
Iftar)
6. Let's talk about Yii firstLet's talk about Yii first
● A macro PHP framework
● A lot of functionalities
● Great design
● Easy to extend
● Easy to configure
● But hard learning-curve
7. Yii FeaturesYii Features
● MVC
● DAO, Active Record, Database Migration
● Authentication/Authorization
● Skinning/Theming
● Web Services
● I18n, L10N
● Cache
● And many more
8. Yii2Yii2
● Yii2 is now in public preview.
– It's not even alpha
– Don't use it for production
– Not all functionalities from Yii1.1 has been
imported.
● Supports PHP5.3+
● Most of the changes are in redesigning the
architecture.
10. NamespaceNamespace
● Actually Yii1.1 has support namespace usage in
user's code (since 1.1.5) using autoloading
● For PHP5.3+ usage only (Yii1.1 still supports PHP5.2)
● Support PSR-0
Better IDE support
Can easily be mistaken with other Strings
12. Namespace in Yii2Namespace in Yii2
● Better namespace organization
– e.g. we used to have
–
–
–
–
– No more long
class name
13.
14.
15. Components and ObjectComponents and Object
● In Yii1.1, we have CComponents
– Getter/Setter through magic __get, __set, __call
– Behavior
– Event.
● In Yii2 we have Object and Component
– Object, basic data structure, getter/setter,
toArray, object configuration, className (added in
PHP5.5).
– Component, extends Object, added event and
behavior
21. View ObjectView Object
● Controller and Widget now accessed as View's
context
● Easily do view-rendering every where, not just
in controller
● CClientScript responsibility is now part of View
object.
● Fragment cache moved from Controller to
View object
● Supports multiple non-native renderer like
Smarty and Twig
32. Many MoreMany More
● Assets Bundling
● Static Helpers
● ActiveForm
● Auto Quoting Column Names
● User and Identity
● Better URL Management
33. More to comeMore to come
● Better Extension management
● Response/Request
● Integration with Composer
● Widgets (Menu, Pager, Captcha)
● NoSQL wrapper
● MessageQueue wrapper
34. WarningWarning
● Yii2 is still in heavy development
● It's not even in Alpha phase
● What I talk about right now can be obsolete
next week
● Fork the github
– http://github.com/yiisoft/yii2
● Try installing
● Put your idea and your fix
35. What's new inWhat's new in
PHP 5.5PHP 5.5
Not really related with Yii2,
just filling some time
36. What's NewWhat's New
● Generators
● “Finally” Keyword
● Password Hashing API
● Bundled OPcode cache
● Class name to scalar
● Array dereferencing
● And many more...
37. GeneratorGenerator
● Simple iterator without implementing
“Iterator” interface
● Iterate result without building array in
memory
– Exceed memory limit
– Time consuming
● Introduces the keyword 'yield'
38.
39.
40. 'Finally' keyword'Finally' keyword
● Just like the one in Java
● Mostly concerns with resource handling
– Prevent resource leaking
● Block in `finally` will be executed no matter if
the exception caught or not
41.
42.
43. Bundled Zend OpCacheBundled Zend OpCache
● is ZendOptimizerPlus by Zend
– https://github.com/zendtech/ZendOptimizerPlus
– provides faster PHP execution through opcode
caching andoptimization
– storing precompiled script bytecode in the shared
memory
● There is also APC (Alternative PHP Cache)
– not really maintainable
● Zend OpCache is now bundled with PHP5.5
– You can still install it in PHP5.2, PHP5.3, PHP5.4
45. Password Hashing APIPassword Hashing API
● password_hash()
– Can set the algorithm, the cost, the salt
– The value returned will contain the algorithm, the
cost, the salt, and the hash itself.
– Only need 1 storage (or 1 column in table).
● password_verify()
– Only take the plain password and the hash result
47. Just for your information :)
We have a lot of
opportunities
- Web engineer
- Front-end engineer
- Mobile app engineer
- Data scientist
- Internship
Send your resume to info@urbanindo.com