Get going with CakePHP Framework at gnuNify 2010

3,712 views
3,633 views

Published on

Published in: Technology
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
3,712
On SlideShare
0
From Embeds
0
Number of Embeds
1,043
Actions
Shares
0
Downloads
42
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide
  • 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
  • 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.
  • 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
  • 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” http://stackoverflow.com/questions/1432729/is-cakephp-modeled-after-ruby-on-rails
  • OO - Whether you are a seasoned object-oriented programmer or a beginner, you'll feel comfortable
  • Scaffolding is used for generating code on the fly for CRUD of a database table - http://en.wikipedia.org/wiki/Scaffold_(programming) 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/
  • mod_rewrite needs to be enabled Make tmp directory writable and change the value of security salts – recommended but not necessary Open http://example.com 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)
  • 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.
  • 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
  • mod_rewrite needs to be enabled Make tmp directory writable and change the value of security salts – recommended but not necessary Open http://example.com 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)
  • Get going with CakePHP Framework at gnuNify 2010

    1. 1. Get going with CakePHP Framework By Abbas Ali SANIsoft Technologies, Nagpur
    2. 2. I am... <ul><li>Mechanical Engineer
    3. 3. Technical Manager with SANIsoft
    4. 4. Dev Team member of Coppermine Photo Gallery
    5. 5. FOSS Enthusiast </li></ul>
    6. 6. Roadmap... <ul><li>What is a Web application framework
    7. 7. What is CakePHP and its History
    8. 8. Features
    9. 9. Model, controller and view
    10. 10. Helpers, components and behaviors </li></ul>
    11. 11. 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)
    12. 12. CakePHP!!! <ul><li>R.A.D framework
    13. 13. For PHP written in PHP
    14. 14. MVC architectural pattern
    15. 15. ORM design pattern
    16. 16. Convention over Configuration </li></ul>
    17. 17. History <ul><li>Michal Tatarynowicz - April 15 th 2005
    18. 18. Larry E. Masters (aka phpnut) took over in July 2005
    19. 19. v1.0 was released on May 1 st 2006
    20. 20. Current stable release v1.2.6
    21. 21. Cake3 => Li3 </li></ul>
    22. 22. Why CakePHP? <ul><li>No Configuration - Set-up the database and let the magic begin
    23. 23. Extremely Simple - Just look at the name...It's Cake
    24. 24. Active, Friendly Community
    25. 25. Best Practices - covering security, authentication, and session handling, among the many other features </li></ul>
    26. 26. More Features <ul><li>Application Scaffolding
    27. 27. Code generation via Bake
    28. 28. Helpers for HTML, Forms, Pagination, AJAX, Javascript, XML, RSS and more
    29. 29. Access Control Lists and Authentication
    30. 30. Simple yet extensive validation of model data
    31. 31. Router for mapping urls </li></ul>
    32. 32. How to?
    33. 33. Installation <ul><li>Download (http://cakephp.org)
    34. 34. Unpack
    35. 35. Put it in webroot
    36. 36. That is it.... </li></ul>
    37. 37. Directory Structure |-- app |-- cake |-- vendors |-- .htaccess `-- index.php |-- app | |-- config | |-- controllers | |-- models | |-- views | `-- webroot | |-- .htaccess | |-- index.php
    38. 38. A typical request
    39. 39. Conventions <ul><li>In general, filenames are underscored while classnames are CamelCased
    40. 40. Model classnames are singular and CamelCased.
    41. 41. Controller classnames are plural, CamelCased, and end in Controller.
    42. 42. View template files are named after the controller functions they display, in an underscored form. </li></ul>
    43. 43. Model
    44. 44. Controller
    45. 45. print_r($articles); Array ( [0] => Array ( [Article] => Array ( [id] => 1 [title] => first article [content] => gnunify rocks!!! ) ) [1] => ...... )
    46. 46. View
    47. 47. Helpers
    48. 48. Other Goodies... <ul><li>Components </li><ul><li>Auth
    49. 49. Session
    50. 50. Cookie </li></ul><li>Behaviors </li><ul><li>Tree
    51. 51. Containable </li></ul></ul>
    52. 52. Summing Up With CakePHP you can rapidly develop an application which is secure, scalable and easy to maintain.
    53. 53. References and further reading <ul><li>http://en.wikipedia.org
    54. 54. http://book.cakephp.org
    55. 55. http://bakery.cakephp.org </li></ul>
    56. 56. Thank You class Question extends Curiosity { var $ask = “ easy ones please”; }

    ×