Introduction to PHP H/MVC Frameworks by

Post on 18-Dec-2014

3,034 views 1 download

description

Model-View-Controller (MVC) is a software architecture, currently considered an architectural pattern used in software engineering. Separation of concerns is one of the major reasons why MVC Frameworks were created. Learn more about it in our presentation. This presentation was done in more than 8 Universities, Colleges, and other training institutions in the Philippines by Christopher John Cubos. Comparison of PHP MVC Frameworks like Zend Framework, Symfony, CodeIgniter, Kohana, Yii Framework, and the latest PHP Framework - FuelPHP.

transcript

Intro to H/MVC FrameworksCHRISTOPHER JOHN CUBOS

WEB DESIGN AND DEVELOPMENT MONTH (AUGUST 2011)COLLEGES & UNIVERSITIES DAVAO CITY PHILIPPINES

PHP H/MVC Frameworks Aug 2011 www.silicongulf.com

Who is Chris Cubos• Started programming at age 10 (1985)• Created his first website (1995)• The first web designer/developer in Mindanao• Been doing this for 26 years and still learning• Won the first website competition in the Philippines

(1995)• Developed his first CD-ROM application (1996)• Developed his first flash site (1995)

… forward to the present

PHP H/MVC Frameworks Aug 2011 www.silicongulf.com

Tech Stuff• Languages: Q/BASIC/A, Pascal, C, C++,

Assembly, PHP, JavaScript, VBScript, ASP, AutoLISP, Lingo, ActionScripting, etc…

• PHP Frameworks: CodeIgniter, FuelPHP• CMS: Wordpress, Drupal, Joomla, Mambo, etc• Applications: Photoshop, Dreamweaver,

Illustrator, AfterEffects, Premiere, CS, etc…

PHP H/MVC Frameworks Aug 2011 www.silicongulf.com

1st Web Development Company• Won the Philippine Webby Awards for

Multimedia Category• Won Davao Web Design Competition in multiple

categories and the overall best web design• 1st Company to develop flash based applications• 1st Company to develop multimedia CD-ROMs• 1st Company to develop web portals• 2nd Company to develop a PH search engine• Won multiple awards in web design, logo design

PHP H/MVC Frameworks Aug 2011 www.silicongulf.com

Yes the present• He currently devotes his time helping students

enhance their skills with the non-profit organization called the SiliconGulf Initiative

• He is also organizing large I.T. events in the Davao and currently organized the most number of I.T. events in a single month.

PHP H/MVC Frameworks Aug 2011 www.silicongulf.com

Brewing• We are currently developing the first game-based

training center in Mindanao• Multiple mobile apps and games• Organizing multiple upcoming I.T. events

PHP H/MVC Frameworks Aug 2011 www.silicongulf.com

MVC Defined• Model–view–controller (MVC) is a software

architecture, currently considered anarchitectural pattern used in softwareengineering. The pattern isolates "domainlogic" (the application logic for the user) from theuser interface (input and presentation),permitting independent development, testingand maintenance of each (separation ofconcerns).

Source: wikipedia.org

PHP H/MVC Frameworks Aug 2011 www.silicongulf.com

How does MVC work?

View Model

Controller

PHP H/MVC Frameworks Aug 2011 www.silicongulf.com

History• Not a new concept• First described on 1979 MVC by Trygve

Reenskaug• He was working on Smalltalk at Xerox PARC• The original implementation is described in

depth in the influential paper "Applications Programming in Smalltalk-80: How to use Model–View–Controller"

PHP H/MVC Frameworks Aug 2011 www.silicongulf.com

The Model• The model manages the behavior and data of the

application• Responds to requests for information from both

the controller and view• Business and data logic

PHP H/MVC Frameworks Aug 2011 www.silicongulf.com

The View• Displays the content of the site. • A view can be a template or an element of a site• A model-view has a business logic inside it but

has design elements as well• Translates raw data to readable user interface

PHP H/MVC Frameworks Aug 2011 www.silicongulf.com

The Controller• The controller receives user input and initiates

a response by making calls on model objects.• A controller accepts input from the user and

instructs the model and viewport to perform actions based on that input.

PHP H/MVC Frameworks Aug 2011 www.silicongulf.com

Why use an MVC Framework• Faster development time• Use and reuse tested code• Automation (ORM, Auth, generators)• Maintainability• Community driven• Separation of code and design• Agile development• Modular development

PHP H/MVC Frameworks Aug 2011 www.silicongulf.com

PHP Web Frameworks• Zend Framework• CodeIgniter• Symfony• CakePHP• Yii• Kohana• FuelPHP• CMS Frameworks (Drupal, Wordpress, Joomla)

PHP H/MVC Frameworks Aug 2011 www.silicongulf.com

Other PHP Frameworks• Lithium – for people who hate frameworks• Akelos – ported from ruby on rails• Seagull – a mature OOP framework• Lion – a dual MVC+MVP architecture

PHP H/MVC Frameworks Aug 2011 www.silicongulf.com

Choosing PHP as a platform• Easy to learn• Easy to install in different operating systems• The largest number developers• More than 75% of websites run on PHP• Open Source• Powerful• Tons of developer tools available• Huge resources available

PHP H/MVC Frameworks Aug 2011 www.silicongulf.com

Detailed Framework GuideA quick run through over top PHP frameworks

PHP H/MVC Frameworks Aug 2011 www.silicongulf.com

Zend Framework• Open source (New BSD License)• Object oriented• MVC architecture• PHP 5.2.4+• Database Agnostic• http://www.zendframework.com/

PHP H/MVC Frameworks Aug 2011 www.silicongulf.com

Zend Framework• Provides a console tool for Rapid Development• Generates models, controllers, layouts, & views• Poor documentation• No automated SQL generation• No automated CRUD functions• Default tutorials don’t provide basic

authentication and security related examples

PHP H/MVC Frameworks Aug 2011 www.silicongulf.com

CodeIgniter• Not fully open source (CodeIgniter License)• Object oriented• MVC architecture• PHP 5.1.6+• Database Agnostic

– No native support for SQLite3• http://codeigniter.com/

PHP H/MVC Frameworks Aug 2011 www.silicongulf.com

CodeIgniter• No console tool• No automated generation tool• Very small footprint (2.2mb)• Video tutorials only• Tutorials and documentation (outdated)• Default tutorials don’t provide basic

authentication and security related examples

PHP H/MVC Frameworks Aug 2011 www.silicongulf.com

Symfony• Open source (MIT License)• Object oriented• MVC architecture• PHP 5.2.4+• Database Agnostic

– Uses doctrine or propel for Object Relational Mapping (ORM) layer

• http://symfony.com/

PHP H/MVC Frameworks Aug 2011 www.silicongulf.com

Symfony• Powerful console tool (symfony)• Automagically generates all elements including

sql queries (from YAML source)• Provides extremely detailed tutorials for all

functionality• Tutorials work as documented• The basic tutorial includes admin functionality as

well as authentication and security information• Plugins are easy to install using console tool

PHP H/MVC Frameworks Aug 2011 www.silicongulf.com

CakePHP• Open source (MIT License)• Object oriented• MVC architecture• PHP4 (4.3.2+)• Database Agnostic

– Does not natively support SQLite3• http://cakephp.org/

PHP H/MVC Frameworks Aug 2011 www.silicongulf.com

CakePHP• Console tool (cake)• Cake bake generates code if a database is defined

including models, views, and controllers for the tables in the database

• Cake schema is used for database backup/restore functionality

• Separate tutorials for a weblog and ACL controlled applications

• Tutorials work as documented

PHP H/MVC Frameworks Aug 2011 www.silicongulf.com

Yii Framework• Open source (BSD License)• Object oriented• MVC architecture• PHP 5.3• Database Agnostic• http://www.yiiframework.com/

PHP H/MVC Frameworks Aug 2011 www.silicongulf.com

Yii Framework• Powerful console tool (yiic)• Does not generate SQL• Uses Gii (web based code generator) for CRUD

operations• Default Yii apps as generated by yiic includes

auth functionality and three basic pages• Tutorials are regularly updated.

PHP H/MVC Frameworks Aug 2011 www.silicongulf.com

Kohana• Open source (BSD License)• Originally based on CodeIgniter, but no more• Object oriented• H/MVC architecture• PHP 5.1.5• Database Agnostic

– Does not natively support SQLite3• http://kohanaframework.org/

PHP H/MVC Frameworks Aug 2011 www.silicongulf.com

Kohana• No console tool• No automated generation tool for any function• Small footprint (1.1mb)• Documentation is poor• Tutorials and documentation poor• Default tutorials don’t provide basic

authentication and security related examples

PHP H/MVC Frameworks Aug 2011 www.silicongulf.com

Kohana• No console tool• No automated generation tool for any function• Small footprint (1.1mb)• Documentation is poor• Tutorials and documentation poor• Default tutorials don’t provide basic

authentication and security related examples

PHP H/MVC Frameworks Aug 2011 www.silicongulf.com

FuelPHP• Open source (MIT License)• Based on ideas of multiple frameworks• Object oriented• H/MVC architecture• PHP 5.3+• Database Agnostic• http://www.fuelphp.com

PHP H/MVC Frameworks Aug 2011 www.silicongulf.com

FuelPHP• Powerful command line automation “OIL”

– Generate – Build MVC components, migrations, scaffolding– Refine – run migration and custom functions– Package – install and remove packages– Console – Test your code in real time with an interactive shell– Smallest footprint (865kb)

• New framework• Tutorials and docs is sufficient but• Default tutorials don’t provide basic authentication and

security related examples

PHP H/MVC Frameworks Aug 2011 www.silicongulf.com

How to you may choose• You will be developing so choose the one that

suits your style and preferences• Availability of Libraries• Documentation and sample codes• Available tools IDE, Automation, Testing• Community activity• Ease of hiring people who know the platform

PHP H/MVC Frameworks Aug 2011 www.silicongulf.com

How I choose a Framework• Quality of code is very important• Coding standards for a one-mind team• Lightweight• Performance

– Load what is needed– Short travel for each execution of code

• Easy to create your own libraries• Responsive community• Flexibility to adapt to MY style

PHP H/MVC Frameworks Aug 2011 www.silicongulf.com

What’s next• Choose a framework• Develop great applications• Become a millionaire• Party all day• Share your knowledge• Grow!!!

PHP H/MVC Frameworks Aug 2011 www.silicongulf.com

ThanksOops… There’s more

PHP H/MVC Frameworks Aug 2011 www.silicongulf.com

Full year of IT EventsAugust 2011: Web Development MonthSeptember 2011: Mobile Application MonthOctober 2011: Animation MonthNovember 2011: Bloggers MonthDecember 2011: SEO MonthJanuary 2012: Technopreneurship MonthFebruary 2012: I.T. Education MonthMarch 2012: I.T. Career MonthApril 2012: Gaming MonthMay 2012: Graphic Design MonthJune 2012: Hacking and Network Security MonthJuly 2012: Software Development Month

PHP H/MVC Frameworks Aug 2011 www.silicongulf.com

August I.T. Events by PGOUniversity of Southeastern Philippines (USEP)Friday, August 12 · 9:00am - 11:30amhttp://www.facebook.com/event.php?eid=229646943743096 John Paul II College (JP2C)Saturday, August 13 · 9:00am - 4:00pmhttp://www.facebook.com/event.php?eid=220035684709122 University of Mindanao (UM)Wednesday, August 17 · 1:00pm - 5:00pmhttp://www.facebook.com/event.php?eid=245697658786703 University of Immaculate Conception (UIC)Saturday, August 20 · 1:00pm - 5:00pmhttp://www.facebook.com/event.php?eid=231713253532167

ACLCMonday, August 22 · 1:00pm - 4:00pmhttp://www.facebook.com/event.php?eid=231458190229578

PHP H/MVC Frameworks Aug 2011 www.silicongulf.com

August I.T. Events by PGOHoly Cross (HCDC)Tuesday, August 23 · 3:00pm - 6:00pmhttp://www.facebook.com/event.php?eid=253809011309471 InterCity College of Science and Technology (ICST)Wednesday, August 24 · 9:00pm - 11:00pmhttp://www.facebook.com/event.php?eid=225237414194879

AMA Computer CollegeThursday, August 25 · 9:30am - 1:00pmhttp://www.facebook.com/event.php?eid=138109472943706

STI CollegeFriday, August 26 · 1:00am - 4:00pmhttp://www.facebook.com/event.php?eid=124462760983852

PHP H/MVC Frameworks Aug 2011 www.silicongulf.com

CompetitionOn-the-spot Student Web Design CompetitionAugust 27, 2011http://www.facebook.com/event.php?eid=241281559236739

Entries can be found athttp://www.silicongulf.com/competitions/web_design

PHP H/MVC Frameworks Aug 2011 www.silicongulf.com

Our Loving Supporters• The SiliconGulf Initiative• Davao IT• Adobe User Group• PHP Philippines• Developers, Entrepreneurs, Artists of Davao• SEO-Philippines• The IT School with no name yet• Philippine Global Outsourcing

PHP H/MVC Frameworks Aug 2011 www.silicongulf.com

ThanksTo all speakers, PHP framework developers, our

team at Philippine Global Outsourcing, students of all participating schools

To the Adobe Development Team for this wonderful piece of software.

Learn from the best www.silicongulf.com

PHP H/MVC Frameworks Aug 2011 www.silicongulf.com

Contact2nd Floor Door #8 Andreliz Bldg#238 Araullo Extension8000 Davao City Philippinesphilippineoutsourcing@gmail.comwww.philippineglobaloutsourcing.com

+63 916 477 9322 (globe)+63 907 775 6544 (smart)+63 922 551 4009 (sun)+63 923 725 4512 (sun)+63 82 224 1040 (landline)

PHP H/MVC Frameworks Aug 2011 www.silicongulf.com

CopyrightThis reference material is exclusively distributed to the students of SiliconGulf Campus and should not be distributed, transmitted, or shared without the prior written consent of Christopher John Cubos http://www.philippineglobaloutsourcing.com/chriscubos ,SiliconGulf http://www.silicongulf.com/ or PhilippinesOutsourcing http://www.philippineglobaloutsourcing.com/ .

This class material should be discussed by a trained instructor from SiliconGulf to maximize the learning and understanding of the topic. Others belong to their respective copyright holders.

© Copyright 2011 SiliconGulf Campus and Christopher John Cubos. All Rights Reserved.

PHP H/MVC Frameworks Aug 2011 www.silicongulf.com

Disclaimer• Course technology and the author specifically

disclaim any and all other warranties, either express or implied, including warranties of merchantability, suitability to a particular task or purpose, or freedom from errors.

• Some states do not allow for exclusion of implied warranties or limitation of incidental or consequential damages, so these limitations might not apply to you.

PHP H/MVC Frameworks Aug 2011 www.silicongulf.com

SiliconGulf CampusSiliconGulf Campus is one of the pioneers of game based learning system in the Philippines. Our goal is to combined complex theories with fun and excitement of playing games.

SiliconGulf Campus2nd Floor Door #8 Andreliz Bldg.#238 Araullo Extension8000 Davao City Philippinessilicongulfcampus@gmail.comwww.silicongulf.com+63 916 477 9322 (globe)+63 907 775 6544 (smart)+63 922 551 4009 (sun)+63 923 725 4512 (sun)+63 82 224 1040 (landline)

PHP H/MVC Frameworks Aug 2011 www.silicongulf.com

Your First AnimationClicking your way through Adobe Edge