FuelPHP - a PHP HMVC Framework by silicongulf.com


Published on

One of the latest PHP frameworks is FuelPHP. It is a combination great ideas from other frameworks (CodeIgniter, Kohana, Ruby on Rails) with a special twist. This is part of our course curriculum at SiliconGulf.com.

Published in: Technology
  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

FuelPHP - a PHP HMVC Framework by silicongulf.com

  2. 2. 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 web design competition in the Philippines (1995) held in Cebu City • Developed his first CD-ROM application (1996) • Developed his first flash site (1995) … forward to the presentFuelPHP HMVC Framework August 2011www.silicongulf.com
  3. 3. 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…FuelPHP HMVC Framework August 2011www.silicongulf.com
  4. 4. 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 designFuelPHP HMVC Framework August 2011www.silicongulf.com
  5. 5. 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. • Furthermore, he is currently developing the the first game-based training center in MindanaoFuelPHP HMVC Framework August 2011www.silicongulf.com
  6. 6. Brewing • We are currently developing the first game-based training center in Mindanao • Multiple mobile apps and games • Organizing multiple upcoming I.T. eventsFuelPHP HMVC Framework August 2011www.silicongulf.com
  7. 7. What is Fuel PHP? • Fuel is a simple, flexible, community driven PHP 5.3 web framework based on the best ideas of other frameworks with a fresh start. • The framework was started in late 2010 by Dan Horrigan then shortly after the team grew to include Phil Sturgeon, Jelmer Schreuder and Harro Verton. The team has decades of PHP experience between them and have all been involved with Open-Source projects such as CodeIgniter, PyroCMS, ExiteCMS and DataMapper ORM to name but a few.FuelPHP HMVC Framework August 2011www.silicongulf.com
  8. 8. Basic Facts • 9 months in the making of (1.0) • 24,155 lines of goodness. • 40+ developers contributed • Community driven • Based on ideas from CodeIgniter, Kohana and Rails but totally rewritten from the ground • Lightweight (800kb.gz) • Load what you need • Configuration over convention • No automagicFuelPHP HMVC Framework August 2011www.silicongulf.com
  9. 9. Why I Choose FuelPHP • Quality of code (very sexy) • Coding standards • Lightweight (smallest footprint 856kb) • Performance – Load only what is needed – Short travel for each code execution • Easy to create your own libraries • Responsive community • Flexibility to adapt to MY styleFuelPHP HMVC Framework August 2011www.silicongulf.com
  10. 10. Getting Started: Download www.fuelphp.com • Framework • Documentation • Packages – Oil – Auth – ORMFuelPHP HMVC Framework August 2011www.silicongulf.com
  11. 11. Requirements • Web Server – Apache running on *nix. • Database • PHP Version – 5.3.2 • mod_rewrite – For clean and seo-friendly URLs • PHPUnit – 3.5.12 (for testing) • Works easily with WAMP and XAMPPFuelPHP HMVC Framework August 2011www.silicongulf.com
  12. 12. Installing: Windows • Install WAMP or XAMPP • Download Fuel PHP • Run!FuelPHP HMVC Framework August 2011www.silicongulf.com
  13. 13. Recommended Tools • Adobe Dreamweaver • CodeLobster • E-texteditor • Komodo • Eclipse • Google Chrome • WAMP • Notepad++ • NavicatFuelPHP HMVC Framework August 2011www.silicongulf.com
  14. 14. Your First AnimationClicking your way through Adobe Edge
  15. 15. FuelPHP MVC • MVC is an approach to separate code depending on what role it plays in an application • The application starts by loading a Controller • That Controller executes a method which retrieves data using Models • Once done, the controller decides what View to load, it contains the output the visitors get to see • Clear separation of design and business logicFuelPHP HMVC Framework August 2011www.silicongulf.com
  16. 16. How does MVC work? Controller View ModelFuelPHP HMVC Framework August 2011www.silicongulf.com
  17. 17. Controllers • Fuels routing decides based on the requested URL what controller to load and what method to call upon it. • The Controller decides what actions to take, what to do with any user input, what data gets manipulated and which View is shown • The Controller does none of these things itself however; it calls upon Models and Classes to do the work.FuelPHP HMVC Framework August 2011www.silicongulf.com
  18. 18. Models • Models contain data that needs to be processed Create, Read, Update and Delete (CRUD) • A Model is a representation of some kind of data and has the methods to change them. • Never put SQL queries in a Controller, those are put in the Model and the Controller will call it. • If your database changes you wont need to change all your Controllers, just the Model.FuelPHP HMVC Framework August 2011www.silicongulf.com
  19. 19. Views • Views contain your HTML, which should never be found in your Controllers or any other class that is not specifically meant to create output • Separate your design from your logic • Change the layout and look through the Views • Views can contain loops, results, forms and the overall design and layout of the site.FuelPHP HMVC Framework August 2011www.silicongulf.com
  20. 20. ViewModels • When your application gets more complex youll discover that it gets hard to decide if a piece of logic really belongs in the Controller • What if it is very specifically about the View and has little to do with your application logic? • This is where ViewModels come in; they are the glue between your controllers and your views.FuelPHP HMVC Framework August 2011www.silicongulf.com
  21. 21. HMVC Requests • HMVC requests are a great way to separate logic and re-use controller logic in multiple places. • One common use of this is when you use a theme or template engine to generate your pages, where every page is divided into sections, and sections are populated by widgets. • By using modules to produce the widget output, you can create a highly modular application, with easy to re-use components.FuelPHP HMVC Framework August 2011www.silicongulf.com
  22. 22. Let’s Code .. Not!!! Excited, heheFuelPHP HMVC Framework August 2011www.silicongulf.com
  23. 23. OIL • Generate - Build MVC components, migrations and entire scaffolding. • Refine - Run tasks such as migrate and your own custom ones. • Package - Install, update and remove packages. • Console - Test your code in real time using an interactive shell.FuelPHP HMVC Framework August 2011www.silicongulf.com
  24. 24. Things you need to do • Create a database (PHPMyAdmin/Navicat) • Configure database (/fuel/app/config/db.php) • Add ORM (/fuel/app/config/config.php) • Create basic CRUD site with OILFuelPHP HMVC Framework August 2011www.silicongulf.com
  25. 25. Creating Tables and CRUD > php oil g scaffold users username:varchar password:varchar sex:tinyint Creating model: C:wampwwwfuelphpfuelappclasses/model/users.php Creating migration: C:wampwwwfuelphpfuelappmigrations/001_create_users.php Creating controller: C:wampwwwfuelphpfuelappclasses/controller/users.php Creating view: C:wampwwwfuelphpfuelappviews/users/index.php Creating view: C:wampwwwfuelphpfuelappviews/users/view.php Creating view: C:wampwwwfuelphpfuelappviews/users/create.php Creating view: C:wampwwwfuelphpfuelappviews/users/edit.php Creating view: C:wampwwwfuelphpfuelappviews/users/_form.php Creating view: C:wampwwwfuelphpfuelappviews/template.php > php oil refine migrate:upFuelPHP HMVC Framework August 2011www.silicongulf.com
  26. 26. Controllers (davaoit.php) class Controller_Davaoit extends Controller { public function action_index() { $data[‘title’] = ‘Welcome to Davao IT’; $data[‘content’]=‘We are a group of great developers’; $data[‘nav’]=array(‘home’, ‘about’, ‘contact’) $this->response->body = View::factory(‘davaoit/index’, $data); } }FuelPHP HMVC Framework August 2011www.silicongulf.com
  27. 27. Views (davaoit/index.php) <html> <head> <title><?php echo $title;?></title> </head> <body> <header><?php echo $title;?></header> <nav><?php $nav;?></nav> <article><?php echo $content;?></article> </body> </html>FuelPHP HMVC Framework August 2011www.silicongulf.com
  28. 28. Showcase: What we’ve done. • DEMO: Social networking site using • DEMO: Game-based learning system • DEMO: Photo Gallery • DEMO: Basic user authenticationFuelPHP HMVC Framework August 2011www.silicongulf.com
  29. 29. Social Network (development)FuelPHP HMVC Framework August 2011www.silicongulf.com
  30. 30. Photo Gallery (under development)FuelPHP HMVC Framework August 2011www.silicongulf.com
  31. 31. What Others have done • http://lumberhandling.com/ (corporate site) • http://poll.froedge.com (online poll) • http://pastecode.com (cut and paste code) • http://wtfismypagerank.com (pr checker) • http://mjs.me/ (url shortener) • http://www.scrapyrd.com/ (code snippets) • http://www.amwaitingfor.com/ (community) • http://www.colorfyit.com/ (analyze site colors)FuelPHP HMVC Framework August 2011www.silicongulf.com
  32. 32. What’s next • Try something in OIL • Modify it • Read docs • Create some apps • Repeat and master • Join forums • Search the netFuelPHP HMVC Framework August 2011www.silicongulf.com
  33. 33. Thanks Oops… There’s moreFuelPHP HMVC Framework August 2011www.silicongulf.com
  34. 34. Full year of IT Events August 2011: Web Development Month September 2011: Mobile Application Month October 2011: Animation Month November 2011: Bloggers Month December 2011: SEO Month January 2012: Technopreneurship Month February 2012: I.T. Education Month March 2012: I.T. Career Month April 2012: Gaming Month May 2012: Graphic Design Month June 2012: Hacking and Network Security Month July 2012: Software Development MonthFuelPHP HMVC Framework August 2011www.silicongulf.com
  35. 35. August I.T. Events by PGO University of Southeastern Philippines (USEP) Friday, August 12 · 9:00am - 11:30am http://www.facebook.com/event.php?eid=229646943743096 John Paul II College (JP2C) Saturday, August 13 · 9:00am - 4:00pm http://www.facebook.com/event.php?eid=220035684709122 University of Mindanao (UM) Wednesday, August 17 · 1:00pm - 5:00pm http://www.facebook.com/event.php?eid=245697658786703 University of Immaculate Conception (UIC) Saturday, August 20 · 1:00pm - 5:00pm http://www.facebook.com/event.php?eid=231713253532167 ACLC Monday, August 22 · 1:00pm - 4:00pm http://www.facebook.com/event.php?eid=231458190229578FuelPHP HMVC Framework August 2011www.silicongulf.com
  36. 36. August I.T. Events by PGO Holy Cross (HCDC) Tuesday, August 23 · 3:00pm - 6:00pm http://www.facebook.com/event.php?eid=253809011309471 InterCity College of Science and Technology (ICST) Wednesday, August 24 · 9:00pm - 11:00pm http://www.facebook.com/event.php?eid=225237414194879 AMA Computer College Thursday, August 25 · 9:30am - 1:00pm http://www.facebook.com/event.php?eid=138109472943706 STI College Friday, August 26 · 1:00am - 4:00pm http://www.facebook.com/event.php?eid=124462760983852FuelPHP HMVC Framework August 2011www.silicongulf.com
  37. 37. Competition On-the-spot Student Web Design Competition August 27, 2011 http://www.facebook.com/event.php?eid=241281559236739 Entries can be found at http://www.silicongulf.com/competitions/web_designFuelPHP HMVC Framework August 2011www.silicongulf.com
  38. 38. 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 OutsourcingFuelPHP HMVC Framework August 2011www.silicongulf.com
  39. 39. Thanks To 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.comFuelPHP HMVC Framework August 2011www.silicongulf.com
  40. 40. Contact 2nd Floor Door #8 Andreliz Bldg #238 Araullo Extension 8000 Davao City Philippines philippineoutsourcing@gmail.com www.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)FuelPHP HMVC Framework August 2011www.silicongulf.com
  41. 41. Copyright This 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 Philippines Outsourcing 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.FuelPHP HMVC Framework August 2011www.silicongulf.com
  42. 42. 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.FuelPHP HMVC Framework August 2011www.silicongulf.com
  43. 43. SiliconGulf Campus SiliconGulf 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 Campus 2nd Floor Door #8 Andreliz Bldg. #238 Araullo Extension 8000 Davao City Philippines silicongulfcampus@gmail.com www.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)FuelPHP HMVC Framework August 2011www.silicongulf.com
  44. 44. FuelPHP HMVC Framework August 2011www.silicongulf.com