More Related Content


Recently uploaded(20)

Get going with CakePHP Framework at gnuNify 2010

  1. Get going with CakePHP Framework By Abbas Ali SANIsoft Technologies, Nagpur
  2. Technical Manager with SANIsoft
  3. Dev Team member of Coppermine Photo Gallery
  4. FOSS Enthusiast
  5. What is CakePHP and its History
  6. Features
  7. Model, controller and view
  8. Helpers, components and behaviors
  9. What is a Web Framework? “ A web application framework is a software framework that is designed to support the development of dynamic websites, Web applications and Web services.” (Wikipedia)
  10. For PHP written in PHP
  11. MVC architectural pattern
  12. ORM design pattern
  13. Convention over Configuration
  14. Larry E. Masters (aka phpnut) took over in July 2005
  15. v1.0 was released on May 1 st 2006
  16. Current stable release v1.2.6
  17. Cake3 => Li3
  18. Extremely Simple - Just look at the name...It's Cake
  19. Active, Friendly Community
  20. Best Practices - covering security, authentication, and session handling, among the many other features
  21. Code generation via Bake
  22. Helpers for HTML, Forms, Pagination, AJAX, Javascript, XML, RSS and more
  23. Access Control Lists and Authentication
  24. Simple yet extensive validation of model data
  25. Router for mapping urls
  26. How to?
  27. Unpack
  28. Put it in webroot
  29. That is it....
  30. Directory Structure |-- app |-- cake |-- vendors |-- .htaccess `-- index.php |-- app | |-- config | |-- controllers | |-- models | |-- views | `-- webroot | |-- .htaccess | |-- index.php
  31. A typical request
  32. Model classnames are singular and CamelCased.
  33. Controller classnames are plural, CamelCased, and end in Controller.
  34. View template files are named after the controller functions they display, in an underscored form.
  35. Model
  36. Controller
  37. print_r($articles); Array ( [0] => Array ( [Article] => Array ( [id] => 1 [title] => first article [content] => gnunify rocks!!! ) ) [1] => ...... )
  38. View
  39. Helpers
  40. Session
  41. Containable
  42. Summing Up With CakePHP you can rapidly develop an application which is secure, scalable and easy to maintain.
  45. Thank You class Question extends Curiosity { var $ask = “ easy ones please”; }

Editor's Notes

  1. Mechanical Engineer by education and graduated from Nagpur University in 2003 Fascinated with both machines and computers Working in PHP since last 6 years. Was a career choice but soon became obsession Got acquainted with cakephp sometime in 2005 and started using it in commercial project from 2006 onwards
  2. The framework aims to alleviate the overhead associated with common activities performed in Web development. For example, many frameworks provide libraries for database access, templating frameworks and session management, and they often promote code reuse. Helps in rapid application development as code is reused and common tasks are performed by the framework. Ex: html/form helpers, db abstraction, auth component A library is a set of classes or functions which are invoked by your code while a framework has an inbuilt architecture, which dictates the way an application has to be written to use it. The framework invokes your code.
  3. We can create application rapidly. A add form which normally takes 0.5 to 1 hr can be done within 10 mins and less than 50 lines of code You can actually see how a particular method works as it is written in php MVC – will be explained in later slide ORM maps objects to relational database where an attribute maps to columns in database. Some attribute holds objects of other tables. Example Addressbook with multiple addresses for each user and multiple phone numbers If convention is followed then no configuration is needed
  4. Michal Tatarynowicz wrote a minimal version of a Rapid Application Framework in PHP and found that it was the start of a very good framework. Michal published the framework under The MIT license, dubbing it Cake, and opened it up to a community of developers, who now maintain Cake under the name Heavy development during 2005-2006 to release a stable version The team created bakery, cakeforge and bin CakePHP is not a port of Ruby on Rails to PHP, but appropriates many of its useful concepts. From chat logs: “Cake is building a well documentated framework inspired by the concepts introduced in Ruby On Rails”
  5. OO - Whether you are a seasoned object-oriented programmer or a beginner, you'll feel comfortable
  6. Scaffolding is used for generating code on the fly for CRUD of a database table - Validation is done before saving a record and if validation fails error messages are shown. Multiple validation rule per field can be applied ACL is authorization which is different from authentication. Being Authenticated does not automatically mean Authorized, but being Authorized would have to mean you are Authenticated. Explain routing with an example http://localhost/controller/action/
  7. mod_rewrite needs to be enabled Make tmp directory writable and change the value of security salts – recommended but not necessary Open and this should show the welcome page Three ways to install cakephp Development (in a subfolder) Production (root of website) Advanced (share the cake library folder)
  8. The app folder will be where you work your magic: it’s where your application’s files will be placed. The cake folder is where cake have worked its magic. Make a personal commitment not to edit files in this folder. Cake can’t help you if you’ve modified the core. Finally, the vendors folder is where you’ll place third-party PHP libraries you need to use with your CakePHP applications.
  9. The MVC paradigm is a way of breaking an application, or even just a piece of an application's interface, into three parts: the model, the view, and the controller. MVC was originally developed to map the traditional input, processing, output roles into the GUI realm The Model represents the application data The View renders a presentation of model data The Controller handles and routes requests made by the client Why use MVC? Because it is a tried and true software design pattern that turns an application into a maintainable, modular, rapidly developed package. Allows developers and designers to work simultaneously
  10. mod_rewrite needs to be enabled Make tmp directory writable and change the value of security salts – recommended but not necessary Open and this should show the welcome page Three ways to install cakephp Development (in a subfolder) Production (root of website) Advanced (share the cake library folder)