SlideShare a Scribd company logo
1 of 28
CAKEPHP
Presented By: Sneha D Guided By: Sarvesh Araballi
Varsha K Asst.Prof ISE Dept
Siri P S SVCE
SRI VENKATESHWARA COLLEGE OF ENGINEERING
AGENDA
 Introduction to PHP
 MVC
 Disadvantages of PHP
 Cake PHP
 Working of cake PHP
 Applications
 conclusion
Introduction to PHP
 PHP stands for "Personal Home Page” which is now
known as “ Hypertext Preprocessor" language.
 It was created by Rasmus Lerdorf in 1994 who wrote
the original Common Gateway Interface (CGI).
 It is a server-side scripting language that can be
embedded in html documents and used to run
applications through a server to serve content and
applications via a network or the internet.
 The PHP scripting engine may be installed and run
either locally on a single machine or on a server.
MVC
 Model–view–controller (MVC) is a
software architectural pattern for implementing user
interfaces.
 It divides a given software application into three
interconnected parts, so as to separate internal
representations of information from the ways that
information is presented to or accepted from the user.
Components of MVC
 Model
 Data layer
 View
 Presentation layer
 Controller
 Logic layer
MVC FLOW
MVC Flow
 MVC can vary depending on the framework with
which you’re working, but generally it works as follows
1. The client sends a page request to the application,
either by typing a URL or by clicking a link of some
kind. By convention, a typical URL is usually
structured like this:
http://{Domain}.com/{Application}/{Controller}/{Actio
n}/{Parameter 1, etc.}
2. The dispatcher script parses the URL structure and
determines which controller to execute. It also passes
along any actions and parameters to the controller.
3. The function in the controller may need to handle
more data than just the parameters forwarded by the
dispatcher. It will send database requests to the model
script.
4. The model script determines how to interact with the
database using the requests submitted by the
controller. It may run queries with the database and do
all sorts of handy data-sorting instructions.
5. Once the model has pulled any data from or sent data
to the database, it returns its output to the controller.
6. The controller processes the data and outputs to the
view file.
7. The view adds any design or display data to the
controller output and sends its output to the client’s
browser
Disadvantages
 Not enough features in the PHP.
The PHP language is primary centered for Web needs.
 The PHP doesn’t provide the support that is object
oriented.
The tendency to decline the language because of the lack
of OOP support is rather old-fashioned. In the modern
PHP you will not HAVE to use any of the objects at all.
 The PHP has not enough PHP developer tools.
 If not used properly, PHP can lead to problems with
security for server and/or any web pages or
applications running off of that server.
 If scripts or programs are complex it can take a long
time to get them to work properly; e.g. debugging.
CAKEPHP
 A framework for developing applications in PHP
 Inspired by Ruby on Rails
 Follows MVC design pattern
 Convention over configuration
 CAKEPHP follows the MVC software design pattern.
Programming using MVC separates your application
into three main parts:
 The Model represents the application data
 The View renders a presentation of model data
 The Controller handles and routes requests made by
the client
Typical Flow
Script
Client
4
1
2
3
Data
base
Typical Flow Of CakePHP
 CAKEPHP (or, for short, Cake) is a framework, not a
set of libraries, even though it contains dozens of
functions and methods that simplify web
development much like libraries do.
 The benefit of using MVC to develop web sites is that
repeated functions or tasks can be separated, thus
allowing for quicker edits.
Other Features
 Cake offers, its repository of other powerful resources
such as built-in validation
 access control lists (ACLs)
 data sanitization(Data Sanitization is the process of
making sensitive information in non-production
databases safe for wider visibility.)
 security and session handling components
 view caching
CakePHP Framework app/
• config/
• controllers/
• models/
• plugins/
• tmp/
• vendors/
• views/
• webroot/
 cake/
• config/
• docs/
• libs/
 vendors/
 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 we’ve worked our magic.
Make a personal commitment not to edit files in this
folder. We 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.
Folder What it Contains
config
Holds the (few) configuration files CakePHP uses. Database
connection details, bootstrapping, core configuration files and
more should be stored here.
controllers Contains your application’s controllers and their components.
locale Stores string files for internationalization.
models Contains your application’s models, behaviors, and datasources.
plugins Contains plugin packages.
tmp
This is where CakePHP stores temporary data. The actual data it stores
depends on how you have CakePHP configured, but this folder is
usually used to store model descriptions, logs, and sometimes session
information.
Make sure that this folder exists and that it is writable, otherwise the
performance of your application will be severely impacted. In debug
mode, CakePHP will warn you if it is not the case.
vendors
Any third-party classes or libraries should be placed here. Doing so
makes them easy to access using the App::import('vendor', 'name')
function. Keen observers will note that this seems redundant, as there
is also a vendors folder at the top level of our directory structure. We'll
get into the differences between the two when we discuss managing
multiple applications and more complex system setups.
views
Presentational files are placed here: elements, error pages, helpers,
layouts, and view files.
webroot
In a production setup, this folder should serve as the document root for
your application. Folders here also serve as holding places for CSS
stylesheets, images, and JavaScript files.
Controller Extension
 A Component is a class that aids in controller logic. If
you have some logic you want to share between
controllers (or applications), a component is usually a
good fit.
 Controllers are also fitted with callbacks.
View Extension
 A Helper is a class that aids in view logic. Much like a
component used among controllers, helpers allow
presentational logic to be accessed and shared
between views.
 One of the core helpers, AjaxHelper, makes Ajax
requests within views much easier.
Model Extension
 Behaviors work as ways to add common functionality
between models.
 models are featured with callbacks as well:
 beforeFind()
 afterFind()
 beforeValidate()
 beforeSave()
 afterSave()
 beforeDelete()
 afterDelete()
Example
 Here’s a final example that ties the conventions
 Database table: "people"
 Model class: "Person", found at
/app/models/person.php
 Controller class: "PeopleController", found at
/app/controllers/people_controller.php
 View template, found at /app/views/people/index.ctp
Flow
 CakePHP knows that a request to
http://example.com/people/ maps to a call on the
index() function of the PeopleController, where the
Person model is automatically available (and
automatically tied to the ‘people’ table in the
database), and renders to a file.
 None of these relationships have been configured by
any means other than by creating classes and files that
you’d need to create anyway.
Naming conventions
 http://book.cakephp.org/view/328/Cake-
Conventions
 Table names: “notes”, “my_notes”
 Model: “mynote.php”->“MyNote”
 Controller: “my_notes_controller.php”->
“MyNotesController”
 Views named after actions, organised in folders
according to the related controller:
 views/my_notes/index.thtml
 views/my_notes/add.thtml
 table name -students
 Model
 class Student save as student.php
 controller
 class StudentsController -students_controller.php
 view
 Create one folder in views folder named as controller name
 foldername =students
 view file extendsion must be .ctp or .thtml
Paths + parameters
 Cake uses url to pass parameters
 Apache mod_rewrite converts url into scriptname
and parameters
 http://www.example.com
/controllername/action/param1/param2/…
 Uses paths to figure out views
 Views stored in “controllername” folder
cakephp UDUYKTHA (1)

More Related Content

What's hot

Introduction To Building Enterprise Web Application With Spring Mvc
Introduction To Building Enterprise Web Application With Spring MvcIntroduction To Building Enterprise Web Application With Spring Mvc
Introduction To Building Enterprise Web Application With Spring MvcAbdelmonaim Remani
 
Spring Basics
Spring BasicsSpring Basics
Spring BasicsEmprovise
 
Application engine
Application engineApplication engine
Application engineJAYAARC
 
Lab 5a) create a struts application
Lab 5a) create a struts applicationLab 5a) create a struts application
Lab 5a) create a struts applicationtechbed
 
3) web development
3) web development3) web development
3) web developmenttechbed
 
Entity frameworks101
Entity frameworks101Entity frameworks101
Entity frameworks101Rich Helton
 
Oracle apps online training
Oracle apps online trainingOracle apps online training
Oracle apps online trainingSekhar Byna
 
Rails
RailsRails
RailsSHC
 
Dh2 Apps Training Part2
Dh2   Apps Training Part2Dh2   Apps Training Part2
Dh2 Apps Training Part2jamram82
 
Templates, partials and layouts
Templates, partials and layoutsTemplates, partials and layouts
Templates, partials and layoutsKadiv Vech
 
Integration of APEX and Oracle Forms
Integration of APEX and Oracle FormsIntegration of APEX and Oracle Forms
Integration of APEX and Oracle FormsRoel Hartman
 
Creating Single Page Applications with Oracle Apex
Creating Single Page Applications with Oracle ApexCreating Single Page Applications with Oracle Apex
Creating Single Page Applications with Oracle ApexDick Dral
 

What's hot (18)

Introduction To Building Enterprise Web Application With Spring Mvc
Introduction To Building Enterprise Web Application With Spring MvcIntroduction To Building Enterprise Web Application With Spring Mvc
Introduction To Building Enterprise Web Application With Spring Mvc
 
Spring Basics
Spring BasicsSpring Basics
Spring Basics
 
Application engine
Application engineApplication engine
Application engine
 
Lab 5a) create a struts application
Lab 5a) create a struts applicationLab 5a) create a struts application
Lab 5a) create a struts application
 
3) web development
3) web development3) web development
3) web development
 
Entity frameworks101
Entity frameworks101Entity frameworks101
Entity frameworks101
 
Oracle apps online training
Oracle apps online trainingOracle apps online training
Oracle apps online training
 
Spring mvc 2.0
Spring mvc 2.0Spring mvc 2.0
Spring mvc 2.0
 
Jsf
JsfJsf
Jsf
 
Rails
RailsRails
Rails
 
Jsp with mvc
Jsp with mvcJsp with mvc
Jsp with mvc
 
Dh2 Apps Training Part2
Dh2   Apps Training Part2Dh2   Apps Training Part2
Dh2 Apps Training Part2
 
Mvc in symfony
Mvc in symfonyMvc in symfony
Mvc in symfony
 
Resume
ResumeResume
Resume
 
Templates, partials and layouts
Templates, partials and layoutsTemplates, partials and layouts
Templates, partials and layouts
 
Integration of APEX and Oracle Forms
Integration of APEX and Oracle FormsIntegration of APEX and Oracle Forms
Integration of APEX and Oracle Forms
 
Creating Single Page Applications with Oracle Apex
Creating Single Page Applications with Oracle ApexCreating Single Page Applications with Oracle Apex
Creating Single Page Applications with Oracle Apex
 
CAF & Portlet Development Notes
CAF & Portlet Development NotesCAF & Portlet Development Notes
CAF & Portlet Development Notes
 

Similar to cakephp UDUYKTHA (1)

Why CakePHP Is Superior to Other Web Frameworks! Examine Its Pros & Cons For ...
Why CakePHP Is Superior to Other Web Frameworks! Examine Its Pros & Cons For ...Why CakePHP Is Superior to Other Web Frameworks! Examine Its Pros & Cons For ...
Why CakePHP Is Superior to Other Web Frameworks! Examine Its Pros & Cons For ...JPLoft Solutions
 
Laravel : A Fastest Growing Kid
Laravel : A Fastest Growing KidLaravel : A Fastest Growing Kid
Laravel : A Fastest Growing KidEndive Software
 
Ruby On Rails Siddhesh
Ruby On Rails SiddheshRuby On Rails Siddhesh
Ruby On Rails SiddheshSiddhesh Bhobe
 
Rapid Development With CakePHP
Rapid Development With CakePHPRapid Development With CakePHP
Rapid Development With CakePHPEdureka!
 
Programming is Fun with ASP.NET MVC
Programming is Fun with ASP.NET MVCProgramming is Fun with ASP.NET MVC
Programming is Fun with ASP.NET MVCIan Carnaghan
 
Company Visitor Management System Report.docx
Company Visitor Management System Report.docxCompany Visitor Management System Report.docx
Company Visitor Management System Report.docxfantabulous2024
 
A report on mvc using the information
A report on mvc using the informationA report on mvc using the information
A report on mvc using the informationToushik Paul
 
Cakephp Interview Questions
Cakephp Interview QuestionsCakephp Interview Questions
Cakephp Interview QuestionsPankaj Chauhan
 
Building Restful Web App Rapidly in CakePHP
Building Restful Web App Rapidly in CakePHPBuilding Restful Web App Rapidly in CakePHP
Building Restful Web App Rapidly in CakePHPEdureka!
 

Similar to cakephp UDUYKTHA (1) (20)

Why CakePHP Is Superior to Other Web Frameworks! Examine Its Pros & Cons For ...
Why CakePHP Is Superior to Other Web Frameworks! Examine Its Pros & Cons For ...Why CakePHP Is Superior to Other Web Frameworks! Examine Its Pros & Cons For ...
Why CakePHP Is Superior to Other Web Frameworks! Examine Its Pros & Cons For ...
 
Cakephp manual-11
Cakephp manual-11Cakephp manual-11
Cakephp manual-11
 
Php Framework
Php FrameworkPhp Framework
Php Framework
 
Php framework
Php frameworkPhp framework
Php framework
 
Laravel overview
Laravel overviewLaravel overview
Laravel overview
 
Cakephp
CakephpCakephp
Cakephp
 
Cakephp
CakephpCakephp
Cakephp
 
Cakephp
CakephpCakephp
Cakephp
 
My Saminar On Php
My Saminar On PhpMy Saminar On Php
My Saminar On Php
 
PPT - A slice of cake php
PPT - A slice of cake phpPPT - A slice of cake php
PPT - A slice of cake php
 
Laravel : A Fastest Growing Kid
Laravel : A Fastest Growing KidLaravel : A Fastest Growing Kid
Laravel : A Fastest Growing Kid
 
sample1
sample1sample1
sample1
 
Ruby On Rails Siddhesh
Ruby On Rails SiddheshRuby On Rails Siddhesh
Ruby On Rails Siddhesh
 
Rapid Development With CakePHP
Rapid Development With CakePHPRapid Development With CakePHP
Rapid Development With CakePHP
 
Programming is Fun with ASP.NET MVC
Programming is Fun with ASP.NET MVCProgramming is Fun with ASP.NET MVC
Programming is Fun with ASP.NET MVC
 
Company Visitor Management System Report.docx
Company Visitor Management System Report.docxCompany Visitor Management System Report.docx
Company Visitor Management System Report.docx
 
Know about cake php framework with vertexplus
Know about  cake php framework with vertexplusKnow about  cake php framework with vertexplus
Know about cake php framework with vertexplus
 
A report on mvc using the information
A report on mvc using the informationA report on mvc using the information
A report on mvc using the information
 
Cakephp Interview Questions
Cakephp Interview QuestionsCakephp Interview Questions
Cakephp Interview Questions
 
Building Restful Web App Rapidly in CakePHP
Building Restful Web App Rapidly in CakePHPBuilding Restful Web App Rapidly in CakePHP
Building Restful Web App Rapidly in CakePHP
 

cakephp UDUYKTHA (1)

  • 1. CAKEPHP Presented By: Sneha D Guided By: Sarvesh Araballi Varsha K Asst.Prof ISE Dept Siri P S SVCE SRI VENKATESHWARA COLLEGE OF ENGINEERING
  • 2. AGENDA  Introduction to PHP  MVC  Disadvantages of PHP  Cake PHP  Working of cake PHP  Applications  conclusion
  • 3. Introduction to PHP  PHP stands for "Personal Home Page” which is now known as “ Hypertext Preprocessor" language.  It was created by Rasmus Lerdorf in 1994 who wrote the original Common Gateway Interface (CGI).  It is a server-side scripting language that can be embedded in html documents and used to run applications through a server to serve content and applications via a network or the internet.  The PHP scripting engine may be installed and run either locally on a single machine or on a server.
  • 4. MVC  Model–view–controller (MVC) is a software architectural pattern for implementing user interfaces.  It divides a given software application into three interconnected parts, so as to separate internal representations of information from the ways that information is presented to or accepted from the user.
  • 5. Components of MVC  Model  Data layer  View  Presentation layer  Controller  Logic layer
  • 7. MVC Flow  MVC can vary depending on the framework with which you’re working, but generally it works as follows 1. The client sends a page request to the application, either by typing a URL or by clicking a link of some kind. By convention, a typical URL is usually structured like this: http://{Domain}.com/{Application}/{Controller}/{Actio n}/{Parameter 1, etc.} 2. The dispatcher script parses the URL structure and determines which controller to execute. It also passes along any actions and parameters to the controller.
  • 8. 3. The function in the controller may need to handle more data than just the parameters forwarded by the dispatcher. It will send database requests to the model script. 4. The model script determines how to interact with the database using the requests submitted by the controller. It may run queries with the database and do all sorts of handy data-sorting instructions. 5. Once the model has pulled any data from or sent data to the database, it returns its output to the controller. 6. The controller processes the data and outputs to the view file. 7. The view adds any design or display data to the controller output and sends its output to the client’s browser
  • 9. Disadvantages  Not enough features in the PHP. The PHP language is primary centered for Web needs.  The PHP doesn’t provide the support that is object oriented. The tendency to decline the language because of the lack of OOP support is rather old-fashioned. In the modern PHP you will not HAVE to use any of the objects at all.  The PHP has not enough PHP developer tools.  If not used properly, PHP can lead to problems with security for server and/or any web pages or applications running off of that server.  If scripts or programs are complex it can take a long time to get them to work properly; e.g. debugging.
  • 10. CAKEPHP  A framework for developing applications in PHP  Inspired by Ruby on Rails  Follows MVC design pattern  Convention over configuration
  • 11.  CAKEPHP follows the MVC software design pattern. Programming using MVC separates your application into three main parts:  The Model represents the application data  The View renders a presentation of model data  The Controller handles and routes requests made by the client
  • 13. Typical Flow Of CakePHP
  • 14.  CAKEPHP (or, for short, Cake) is a framework, not a set of libraries, even though it contains dozens of functions and methods that simplify web development much like libraries do.  The benefit of using MVC to develop web sites is that repeated functions or tasks can be separated, thus allowing for quicker edits.
  • 15. Other Features  Cake offers, its repository of other powerful resources such as built-in validation  access control lists (ACLs)  data sanitization(Data Sanitization is the process of making sensitive information in non-production databases safe for wider visibility.)  security and session handling components  view caching
  • 16. CakePHP Framework app/ • config/ • controllers/ • models/ • plugins/ • tmp/ • vendors/ • views/ • webroot/  cake/ • config/ • docs/ • libs/  vendors/
  • 17.  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 we’ve worked our magic. Make a personal commitment not to edit files in this folder. We 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.
  • 18. Folder What it Contains config Holds the (few) configuration files CakePHP uses. Database connection details, bootstrapping, core configuration files and more should be stored here. controllers Contains your application’s controllers and their components. locale Stores string files for internationalization. models Contains your application’s models, behaviors, and datasources. plugins Contains plugin packages.
  • 19. tmp This is where CakePHP stores temporary data. The actual data it stores depends on how you have CakePHP configured, but this folder is usually used to store model descriptions, logs, and sometimes session information. Make sure that this folder exists and that it is writable, otherwise the performance of your application will be severely impacted. In debug mode, CakePHP will warn you if it is not the case. vendors Any third-party classes or libraries should be placed here. Doing so makes them easy to access using the App::import('vendor', 'name') function. Keen observers will note that this seems redundant, as there is also a vendors folder at the top level of our directory structure. We'll get into the differences between the two when we discuss managing multiple applications and more complex system setups. views Presentational files are placed here: elements, error pages, helpers, layouts, and view files. webroot In a production setup, this folder should serve as the document root for your application. Folders here also serve as holding places for CSS stylesheets, images, and JavaScript files.
  • 20. Controller Extension  A Component is a class that aids in controller logic. If you have some logic you want to share between controllers (or applications), a component is usually a good fit.  Controllers are also fitted with callbacks.
  • 21. View Extension  A Helper is a class that aids in view logic. Much like a component used among controllers, helpers allow presentational logic to be accessed and shared between views.  One of the core helpers, AjaxHelper, makes Ajax requests within views much easier.
  • 22. Model Extension  Behaviors work as ways to add common functionality between models.  models are featured with callbacks as well:  beforeFind()  afterFind()  beforeValidate()  beforeSave()  afterSave()  beforeDelete()  afterDelete()
  • 23. Example  Here’s a final example that ties the conventions  Database table: "people"  Model class: "Person", found at /app/models/person.php  Controller class: "PeopleController", found at /app/controllers/people_controller.php  View template, found at /app/views/people/index.ctp
  • 24. Flow  CakePHP knows that a request to http://example.com/people/ maps to a call on the index() function of the PeopleController, where the Person model is automatically available (and automatically tied to the ‘people’ table in the database), and renders to a file.  None of these relationships have been configured by any means other than by creating classes and files that you’d need to create anyway.
  • 25. Naming conventions  http://book.cakephp.org/view/328/Cake- Conventions  Table names: “notes”, “my_notes”  Model: “mynote.php”->“MyNote”  Controller: “my_notes_controller.php”-> “MyNotesController”  Views named after actions, organised in folders according to the related controller:  views/my_notes/index.thtml  views/my_notes/add.thtml
  • 26.  table name -students  Model  class Student save as student.php  controller  class StudentsController -students_controller.php  view  Create one folder in views folder named as controller name  foldername =students  view file extendsion must be .ctp or .thtml
  • 27. Paths + parameters  Cake uses url to pass parameters  Apache mod_rewrite converts url into scriptname and parameters  http://www.example.com /controllername/action/param1/param2/…  Uses paths to figure out views  Views stored in “controllername” folder