SlideShare una empresa de Scribd logo
1 de 21
Descargar para leer sin conexión
www.edureka.co/php-mysql
View PHP & MySQL with MVC Frameworks course details at www.edureka.co/php-mysql
For Queries:
Post on Twitter @edurekaIN: #askEdureka
Post on Facebook /edurekaIN
For more details please contact us:
US : 1800 275 9730 (toll free)
INDIA : +91 88808 62004
Email us : sales@edureka.co
Rapid Development with CakePHP
Slide 2 www.edureka.co/php-mysqlSlide 2
Objectives
At the end of this module, you will be able to understand:
MVC Architecture
CakePHP Introduction
Why to Use CakePHP
How to Configure CakePHP
Creating a Simple Web Application Using CakePHP
Slide 3 www.edureka.co/php-mysqlSlide 3
 Coding in straight PHP can lead to spaghetti code. Long lines of code that have multiple interactions and typically
have HTML code in it
 Leads to disorganization
 Difficult to re-use code
 Change one thing, break another
 Everything must be tested, which is difficult
 Hard code everything from scratch
 Teamwork challenges - parallel programming cannot be done efficiently
Drawbacks of Designing an Application Without Using a Framework
Design Patterns is a way to organize a program in a proper manner
One such design pattern is MVC
Slide 4 www.edureka.co/php-mysql
Introduction – What is MVC
MVC Introduction
 MVC is acronym for Model-View-Controller
 MVC is software design pattern for developing web and desktop applications
 It separates the application logic in easily manageable containers viz Model, View and
Controller
Slide 5 www.edureka.co/php-mysql
MVC Introduction - Model
 The Model container manages the data and business logic of the application
 Model receives requests for data access from View
 It also receives requests from Controller to update the data
 Model encapsulates the database and file access from rest of the application logic
Model
Slide 6 www.edureka.co/php-mysql
MVC Introduction - View
 The View container manages the presentation of data in specific format
 Each model can have multiple views associated with it
 View handles all the user interface elements e.g. forms, tables, formatted data
 View also implements templates to unify the overall look and feel of the website
View
Slide 7 www.edureka.co/php-mysql
MVC Introduction - Controller
 The Controller container manages all the communication between Model and view
 Controller is the entry point of all the requests made in the web application
 Controller responds to the events, communicate with model and sets data for view
 Controller can be considered as brain of the application
Controller
Slide 8 www.edureka.co/php-mysql
MVC Introduction - Illustration
Web
Browser/Client
HTTP Request
HTTP Response
CONTROLLER MODEL
VIEW
Data object
Request
Data Objects
Response
Render dataEvents
(GET/POST)
Handled by Framework
(Hidden from user)
Database
Database
Request
Raw Data
Response
MVC Container
Website User
http://www.mywebsite.com
Slide 9 www.edureka.co/php-mysql
CakePHP - Introduction
What is CakePHP?
 It is free, open source, rapid development framework for PHP
 Follows and implements MVC architecture
 Provides a basic structure for organizing files and database table names - keeping everything consistent and
logical.
 Other available frameworks are Zend framework, CodeIgniter, Laravel etc.
Slide 10 www.edureka.co/php-mysql
CakePHP - Introduction
Why CakePHP?
 Open source with flexible licensing
 Supports MVC architecture
 Easy to install with minimal configuration, faster to learn
 Powerful in-build form validation using models
 CakeBake to generate ready to use code
 Integrated CRUD for database interaction
 View helpers for AJAX, JavaScript, HTML forms and more
 Email, cookie, security, session, and request handling Components
Slide 11 www.edureka.co/php-mysqlSlide 11Slide 11Slide 11
Cake PHP Features
Code generation and scaffolding
 Scaffolding is a programming technique
popularized by Ruby on Rails where
code is generated for basic DB
operations
Easy configuration
 Two changes to a file, generate
database config
Out-of-the-box functionality
 DB Support, Form creation , validation
Users, authentication
Community
 Strong, Active
 Maintained Plugins
Clean MVC Implementation
 Industry standard design pattern
 Structured application
 Easy for developers to read
Cake PHP for a long time from 2005
 Broad user base
 Available documentation
Slide 12 www.edureka.co/php-mysql
CakePHP - Prerequisite
Prerequisite for CakePHP 2.5.6
 Apache httpd server 2.4
 PHP 5.2.8 or higher
 MySQL 4 or higher
 We are assuming that we already have PHP and MySQL setup running on the
machine
Slide 13 www.edureka.co/php-mysql
Configuring CakePHP (Contd…)
 Download the CakePHP version 2.5.6 zip file from
https://github.com/cakephp/cakephp/archive/2.5.6.zip
 Extract the zip file to the apache webserver document root directory
To get the document root directory location –
» Browse to Apache 2.4 directory
» Click on conf folder and edit the httpd.conf file
» Find the word “DocumentRoot”. It will have the document root directory path.
Slide 14 www.edureka.co/php-mysql
Configuring CakePHP (Contd…)
Document root
Slide 15 www.edureka.co/php-mysql
Configuring CakePHP (Contd…)
 Now Start the apache and MySQL server if it is not already running.
 Open web browser and enter http://localhost/cakephp-2.5.6/
 Browser will show the CakePHP index page. This means your CakePHP has been setup correctly.
 There are some warnings displayed in the index page. We will resolve them in post installation steps next.
Slide 16 www.edureka.co/php-mysql
Configuring CakePHP (Contd…)
Check the installation - Output
Slide 17 www.edureka.co/php-mysql
CakePHP folder structure
CakePHP core directories
 There are 4 core directories under CakePHP
 app, lib, plugins and vendors
Slide 18 www.edureka.co/php-mysql
CakePHP folder structure
CakePHP core directories
 app
» Main working directory for CakePHP development
» Contains all custom application code including model, view and controller.
» Also contains public webroot directory (document root)
 lib
» Contains all the core CakePHP libraries
» DO NOT modify any files in this directory as it will affect the core CakePHP functionality
 plugins
» Empty by default
» Can contain custom plugins made available to enhance CakePHP functionality
 vendors
» Empty by default
» Can contains third party libraries
Slide 19 www.edureka.co/php-mysql
Creating a Simple Web Application Using CakePHP
A Web application to display all the user details with an option to add a new user, edit an existing user and to delete a
user using CakePHP
Application to perform simple CRUD (Create, Read, Update and Delete) operations
Create a Database with name 'Edureka'
mysql> create database Edureka
Create a Database Table with name "users" in "Edureka" Database with the following fields
ID
FIRST_NAME
LAST_NAME
EMAIL
MOBILE
User Management System
Slide 20 www.edureka.co/php-mysql
Questions
Slide 21 www.edureka.co/php-mysql

Más contenido relacionado

La actualidad más candente

Tutorial PHP and Dreamweaver CS3
Tutorial PHP and Dreamweaver CS3Tutorial PHP and Dreamweaver CS3
Tutorial PHP and Dreamweaver CS3
Halizah Ahmad
 
Getting Started with the Joomla! Framework
Getting Started with the Joomla! FrameworkGetting Started with the Joomla! Framework
Getting Started with the Joomla! Framework
Michael Babker
 
Uk Nuke Facebook Connect Authentication For Dot Net Nuke
Uk Nuke Facebook Connect Authentication For Dot Net NukeUk Nuke Facebook Connect Authentication For Dot Net Nuke
Uk Nuke Facebook Connect Authentication For Dot Net Nuke
Stuart Lodge
 
iWeb NJECC June 28, 2011 DAndrea
iWeb NJECC June 28, 2011 DAndreaiWeb NJECC June 28, 2011 DAndrea
iWeb NJECC June 28, 2011 DAndrea
D'Andrea
 

La actualidad más candente (20)

Tutorial PHP and Dreamweaver CS3
Tutorial PHP and Dreamweaver CS3Tutorial PHP and Dreamweaver CS3
Tutorial PHP and Dreamweaver CS3
 
APEX navigation concepts
APEX navigation conceptsAPEX navigation concepts
APEX navigation concepts
 
Asp.Net Tutorials
Asp.Net TutorialsAsp.Net Tutorials
Asp.Net Tutorials
 
Getting Started with the Joomla! Framework
Getting Started with the Joomla! FrameworkGetting Started with the Joomla! Framework
Getting Started with the Joomla! Framework
 
UkNuke Facebook Connect Authentication For DotNetNuke 5
UkNuke Facebook Connect Authentication For DotNetNuke 5UkNuke Facebook Connect Authentication For DotNetNuke 5
UkNuke Facebook Connect Authentication For DotNetNuke 5
 
JOOMLA
JOOMLAJOOMLA
JOOMLA
 
Facebook Connect Tutorial
Facebook Connect TutorialFacebook Connect Tutorial
Facebook Connect Tutorial
 
Magento 2 Theme Trainning for Beginners | Magenest
Magento 2 Theme Trainning for Beginners | MagenestMagento 2 Theme Trainning for Beginners | Magenest
Magento 2 Theme Trainning for Beginners | Magenest
 
Uk Nuke Facebook Connect Authentication For Dot Net Nuke
Uk Nuke Facebook Connect Authentication For Dot Net NukeUk Nuke Facebook Connect Authentication For Dot Net Nuke
Uk Nuke Facebook Connect Authentication For Dot Net Nuke
 
Joomla english for the work group
Joomla english for the work groupJoomla english for the work group
Joomla english for the work group
 
First Pages HTML ASP-ASP.NET
First Pages HTML ASP-ASP.NETFirst Pages HTML ASP-ASP.NET
First Pages HTML ASP-ASP.NET
 
Facebook Developer Garage Cyberjaya
Facebook Developer Garage CyberjayaFacebook Developer Garage Cyberjaya
Facebook Developer Garage Cyberjaya
 
Custom Template for Joomla! 3
Custom Template for Joomla! 3Custom Template for Joomla! 3
Custom Template for Joomla! 3
 
Webinar: Front End Web Development - Trendy Web Designs Using HTML5
Webinar: Front End Web Development - Trendy Web Designs Using HTML5Webinar: Front End Web Development - Trendy Web Designs Using HTML5
Webinar: Front End Web Development - Trendy Web Designs Using HTML5
 
Joomla @ Barcamp4(Feb 08 Pune)
Joomla @ Barcamp4(Feb 08 Pune)Joomla @ Barcamp4(Feb 08 Pune)
Joomla @ Barcamp4(Feb 08 Pune)
 
Joomla Template Tutorial
Joomla Template TutorialJoomla Template Tutorial
Joomla Template Tutorial
 
iWeb NJECC June 28, 2011 DAndrea
iWeb NJECC June 28, 2011 DAndreaiWeb NJECC June 28, 2011 DAndrea
iWeb NJECC June 28, 2011 DAndrea
 
Building an interactive timeline from facebook photos
Building an interactive timeline from facebook photosBuilding an interactive timeline from facebook photos
Building an interactive timeline from facebook photos
 
How to create theme in Magento 2 - Part 2
How to create theme in Magento 2 - Part 2How to create theme in Magento 2 - Part 2
How to create theme in Magento 2 - Part 2
 
Developing a website
Developing a websiteDeveloping a website
Developing a website
 

Destacado

PHP MVC Tutorial
PHP MVC TutorialPHP MVC Tutorial
PHP MVC Tutorial
Yang Bruce
 
Beginners PHP Tutorial
Beginners PHP TutorialBeginners PHP Tutorial
Beginners PHP Tutorial
alexjones89
 

Destacado (18)

Node js - Yns
Node js - YnsNode js - Yns
Node js - Yns
 
Learning CakePHP2 from source code vol2
Learning CakePHP2 from source code vol2Learning CakePHP2 from source code vol2
Learning CakePHP2 from source code vol2
 
How to create test data
How to create test dataHow to create test data
How to create test data
 
Road to CakePHP 3.0
Road to CakePHP 3.0Road to CakePHP 3.0
Road to CakePHP 3.0
 
MVC Frameworks for building PHP Web Applications
MVC Frameworks for building PHP Web ApplicationsMVC Frameworks for building PHP Web Applications
MVC Frameworks for building PHP Web Applications
 
Advanced Querying with CakePHP 3
Advanced Querying with CakePHP 3Advanced Querying with CakePHP 3
Advanced Querying with CakePHP 3
 
PHP MVC Tutorial
PHP MVC TutorialPHP MVC Tutorial
PHP MVC Tutorial
 
A Good PHP Framework For Beginners Like Me!
A Good PHP Framework For Beginners Like Me!A Good PHP Framework For Beginners Like Me!
A Good PHP Framework For Beginners Like Me!
 
PHP MVC
PHP MVCPHP MVC
PHP MVC
 
Un exemple élémentaire d'application MVC en PHP
Un exemple élémentaire d'application MVC en PHPUn exemple élémentaire d'application MVC en PHP
Un exemple élémentaire d'application MVC en PHP
 
Beginners PHP Tutorial
Beginners PHP TutorialBeginners PHP Tutorial
Beginners PHP Tutorial
 
Roll Your Own Content Management System
Roll Your Own Content Management SystemRoll Your Own Content Management System
Roll Your Own Content Management System
 
Joomla-Content Management System
Joomla-Content Management SystemJoomla-Content Management System
Joomla-Content Management System
 
Content Management System
Content Management SystemContent Management System
Content Management System
 
Joomla - CMS
Joomla - CMSJoomla - CMS
Joomla - CMS
 
Content Management System
Content Management SystemContent Management System
Content Management System
 
Php Presentation
Php PresentationPhp Presentation
Php Presentation
 
Introduction to PHP
Introduction to PHPIntroduction to PHP
Introduction to PHP
 

Similar a Rapid Development With CakePHP

Symfony HTTP Kernel for refactoring legacy apps: the eZ Publish case study - ...
Symfony HTTP Kernel for refactoring legacy apps: the eZ Publish case study - ...Symfony HTTP Kernel for refactoring legacy apps: the eZ Publish case study - ...
Symfony HTTP Kernel for refactoring legacy apps: the eZ Publish case study - ...
Gaetano Giunta
 

Similar a Rapid Development With CakePHP (20)

Cakephp manual-11
Cakephp manual-11Cakephp manual-11
Cakephp manual-11
 
Principles of MVC for PHP Developers
Principles of MVC for PHP DevelopersPrinciples of MVC for PHP Developers
Principles of MVC for PHP Developers
 
Principles of MVC for Rails Developers
Principles of MVC for Rails DevelopersPrinciples of MVC for Rails Developers
Principles of MVC for Rails Developers
 
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
 
IRJET- Lightweight MVC Framework in PHP
IRJET- Lightweight MVC Framework in PHPIRJET- Lightweight MVC Framework in PHP
IRJET- Lightweight MVC Framework in PHP
 
PHP Frameworks and CodeIgniter
PHP Frameworks and CodeIgniterPHP Frameworks and CodeIgniter
PHP Frameworks and CodeIgniter
 
ASP.NET Presentation
ASP.NET PresentationASP.NET Presentation
ASP.NET Presentation
 
cakephp UDUYKTHA (1)
cakephp UDUYKTHA (1)cakephp UDUYKTHA (1)
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 ...
 
Developing Java Web Applications
Developing Java Web ApplicationsDeveloping Java Web Applications
Developing Java Web Applications
 
Php Framework
Php FrameworkPhp Framework
Php Framework
 
Php framework
Php frameworkPhp framework
Php framework
 
P H P Framework
P H P  FrameworkP H P  Framework
P H P Framework
 
Introduction To Code Igniter
Introduction To Code IgniterIntroduction To Code Igniter
Introduction To Code Igniter
 
Symfony HTTP Kernel for refactoring legacy apps: the eZ Publish case study - ...
Symfony HTTP Kernel for refactoring legacy apps: the eZ Publish case study - ...Symfony HTTP Kernel for refactoring legacy apps: the eZ Publish case study - ...
Symfony HTTP Kernel for refactoring legacy apps: the eZ Publish case study - ...
 
sample1
sample1sample1
sample1
 
Magento
MagentoMagento
Magento
 
Introduction To CodeIgniter
Introduction To CodeIgniterIntroduction To CodeIgniter
Introduction To CodeIgniter
 
MVC = Make Venerated Code?
MVC = Make Venerated Code?MVC = Make Venerated Code?
MVC = Make Venerated Code?
 
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
 

Más de Edureka!

Más de Edureka! (20)

What to learn during the 21 days Lockdown | Edureka
What to learn during the 21 days Lockdown | EdurekaWhat to learn during the 21 days Lockdown | Edureka
What to learn during the 21 days Lockdown | Edureka
 
Top 10 Dying Programming Languages in 2020 | Edureka
Top 10 Dying Programming Languages in 2020 | EdurekaTop 10 Dying Programming Languages in 2020 | Edureka
Top 10 Dying Programming Languages in 2020 | Edureka
 
Top 5 Trending Business Intelligence Tools | Edureka
Top 5 Trending Business Intelligence Tools | EdurekaTop 5 Trending Business Intelligence Tools | Edureka
Top 5 Trending Business Intelligence Tools | Edureka
 
Tableau Tutorial for Data Science | Edureka
Tableau Tutorial for Data Science | EdurekaTableau Tutorial for Data Science | Edureka
Tableau Tutorial for Data Science | Edureka
 
Python Programming Tutorial | Edureka
Python Programming Tutorial | EdurekaPython Programming Tutorial | Edureka
Python Programming Tutorial | Edureka
 
Top 5 PMP Certifications | Edureka
Top 5 PMP Certifications | EdurekaTop 5 PMP Certifications | Edureka
Top 5 PMP Certifications | Edureka
 
Top Maven Interview Questions in 2020 | Edureka
Top Maven Interview Questions in 2020 | EdurekaTop Maven Interview Questions in 2020 | Edureka
Top Maven Interview Questions in 2020 | Edureka
 
Linux Mint Tutorial | Edureka
Linux Mint Tutorial | EdurekaLinux Mint Tutorial | Edureka
Linux Mint Tutorial | Edureka
 
How to Deploy Java Web App in AWS| Edureka
How to Deploy Java Web App in AWS| EdurekaHow to Deploy Java Web App in AWS| Edureka
How to Deploy Java Web App in AWS| Edureka
 
Importance of Digital Marketing | Edureka
Importance of Digital Marketing | EdurekaImportance of Digital Marketing | Edureka
Importance of Digital Marketing | Edureka
 
RPA in 2020 | Edureka
RPA in 2020 | EdurekaRPA in 2020 | Edureka
RPA in 2020 | Edureka
 
Email Notifications in Jenkins | Edureka
Email Notifications in Jenkins | EdurekaEmail Notifications in Jenkins | Edureka
Email Notifications in Jenkins | Edureka
 
EA Algorithm in Machine Learning | Edureka
EA Algorithm in Machine Learning | EdurekaEA Algorithm in Machine Learning | Edureka
EA Algorithm in Machine Learning | Edureka
 
Cognitive AI Tutorial | Edureka
Cognitive AI Tutorial | EdurekaCognitive AI Tutorial | Edureka
Cognitive AI Tutorial | Edureka
 
AWS Cloud Practitioner Tutorial | Edureka
AWS Cloud Practitioner Tutorial | EdurekaAWS Cloud Practitioner Tutorial | Edureka
AWS Cloud Practitioner Tutorial | Edureka
 
Blue Prism Top Interview Questions | Edureka
Blue Prism Top Interview Questions | EdurekaBlue Prism Top Interview Questions | Edureka
Blue Prism Top Interview Questions | Edureka
 
Big Data on AWS Tutorial | Edureka
Big Data on AWS Tutorial | Edureka Big Data on AWS Tutorial | Edureka
Big Data on AWS Tutorial | Edureka
 
A star algorithm | A* Algorithm in Artificial Intelligence | Edureka
A star algorithm | A* Algorithm in Artificial Intelligence | EdurekaA star algorithm | A* Algorithm in Artificial Intelligence | Edureka
A star algorithm | A* Algorithm in Artificial Intelligence | Edureka
 
Kubernetes Installation on Ubuntu | Edureka
Kubernetes Installation on Ubuntu | EdurekaKubernetes Installation on Ubuntu | Edureka
Kubernetes Installation on Ubuntu | Edureka
 
Introduction to DevOps | Edureka
Introduction to DevOps | EdurekaIntroduction to DevOps | Edureka
Introduction to DevOps | Edureka
 

Último

Último (20)

Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 

Rapid Development With CakePHP

  • 1. www.edureka.co/php-mysql View PHP & MySQL with MVC Frameworks course details at www.edureka.co/php-mysql For Queries: Post on Twitter @edurekaIN: #askEdureka Post on Facebook /edurekaIN For more details please contact us: US : 1800 275 9730 (toll free) INDIA : +91 88808 62004 Email us : sales@edureka.co Rapid Development with CakePHP
  • 2. Slide 2 www.edureka.co/php-mysqlSlide 2 Objectives At the end of this module, you will be able to understand: MVC Architecture CakePHP Introduction Why to Use CakePHP How to Configure CakePHP Creating a Simple Web Application Using CakePHP
  • 3. Slide 3 www.edureka.co/php-mysqlSlide 3  Coding in straight PHP can lead to spaghetti code. Long lines of code that have multiple interactions and typically have HTML code in it  Leads to disorganization  Difficult to re-use code  Change one thing, break another  Everything must be tested, which is difficult  Hard code everything from scratch  Teamwork challenges - parallel programming cannot be done efficiently Drawbacks of Designing an Application Without Using a Framework Design Patterns is a way to organize a program in a proper manner One such design pattern is MVC
  • 4. Slide 4 www.edureka.co/php-mysql Introduction – What is MVC MVC Introduction  MVC is acronym for Model-View-Controller  MVC is software design pattern for developing web and desktop applications  It separates the application logic in easily manageable containers viz Model, View and Controller
  • 5. Slide 5 www.edureka.co/php-mysql MVC Introduction - Model  The Model container manages the data and business logic of the application  Model receives requests for data access from View  It also receives requests from Controller to update the data  Model encapsulates the database and file access from rest of the application logic Model
  • 6. Slide 6 www.edureka.co/php-mysql MVC Introduction - View  The View container manages the presentation of data in specific format  Each model can have multiple views associated with it  View handles all the user interface elements e.g. forms, tables, formatted data  View also implements templates to unify the overall look and feel of the website View
  • 7. Slide 7 www.edureka.co/php-mysql MVC Introduction - Controller  The Controller container manages all the communication between Model and view  Controller is the entry point of all the requests made in the web application  Controller responds to the events, communicate with model and sets data for view  Controller can be considered as brain of the application Controller
  • 8. Slide 8 www.edureka.co/php-mysql MVC Introduction - Illustration Web Browser/Client HTTP Request HTTP Response CONTROLLER MODEL VIEW Data object Request Data Objects Response Render dataEvents (GET/POST) Handled by Framework (Hidden from user) Database Database Request Raw Data Response MVC Container Website User http://www.mywebsite.com
  • 9. Slide 9 www.edureka.co/php-mysql CakePHP - Introduction What is CakePHP?  It is free, open source, rapid development framework for PHP  Follows and implements MVC architecture  Provides a basic structure for organizing files and database table names - keeping everything consistent and logical.  Other available frameworks are Zend framework, CodeIgniter, Laravel etc.
  • 10. Slide 10 www.edureka.co/php-mysql CakePHP - Introduction Why CakePHP?  Open source with flexible licensing  Supports MVC architecture  Easy to install with minimal configuration, faster to learn  Powerful in-build form validation using models  CakeBake to generate ready to use code  Integrated CRUD for database interaction  View helpers for AJAX, JavaScript, HTML forms and more  Email, cookie, security, session, and request handling Components
  • 11. Slide 11 www.edureka.co/php-mysqlSlide 11Slide 11Slide 11 Cake PHP Features Code generation and scaffolding  Scaffolding is a programming technique popularized by Ruby on Rails where code is generated for basic DB operations Easy configuration  Two changes to a file, generate database config Out-of-the-box functionality  DB Support, Form creation , validation Users, authentication Community  Strong, Active  Maintained Plugins Clean MVC Implementation  Industry standard design pattern  Structured application  Easy for developers to read Cake PHP for a long time from 2005  Broad user base  Available documentation
  • 12. Slide 12 www.edureka.co/php-mysql CakePHP - Prerequisite Prerequisite for CakePHP 2.5.6  Apache httpd server 2.4  PHP 5.2.8 or higher  MySQL 4 or higher  We are assuming that we already have PHP and MySQL setup running on the machine
  • 13. Slide 13 www.edureka.co/php-mysql Configuring CakePHP (Contd…)  Download the CakePHP version 2.5.6 zip file from https://github.com/cakephp/cakephp/archive/2.5.6.zip  Extract the zip file to the apache webserver document root directory To get the document root directory location – » Browse to Apache 2.4 directory » Click on conf folder and edit the httpd.conf file » Find the word “DocumentRoot”. It will have the document root directory path.
  • 14. Slide 14 www.edureka.co/php-mysql Configuring CakePHP (Contd…) Document root
  • 15. Slide 15 www.edureka.co/php-mysql Configuring CakePHP (Contd…)  Now Start the apache and MySQL server if it is not already running.  Open web browser and enter http://localhost/cakephp-2.5.6/  Browser will show the CakePHP index page. This means your CakePHP has been setup correctly.  There are some warnings displayed in the index page. We will resolve them in post installation steps next.
  • 16. Slide 16 www.edureka.co/php-mysql Configuring CakePHP (Contd…) Check the installation - Output
  • 17. Slide 17 www.edureka.co/php-mysql CakePHP folder structure CakePHP core directories  There are 4 core directories under CakePHP  app, lib, plugins and vendors
  • 18. Slide 18 www.edureka.co/php-mysql CakePHP folder structure CakePHP core directories  app » Main working directory for CakePHP development » Contains all custom application code including model, view and controller. » Also contains public webroot directory (document root)  lib » Contains all the core CakePHP libraries » DO NOT modify any files in this directory as it will affect the core CakePHP functionality  plugins » Empty by default » Can contain custom plugins made available to enhance CakePHP functionality  vendors » Empty by default » Can contains third party libraries
  • 19. Slide 19 www.edureka.co/php-mysql Creating a Simple Web Application Using CakePHP A Web application to display all the user details with an option to add a new user, edit an existing user and to delete a user using CakePHP Application to perform simple CRUD (Create, Read, Update and Delete) operations Create a Database with name 'Edureka' mysql> create database Edureka Create a Database Table with name "users" in "Edureka" Database with the following fields ID FIRST_NAME LAST_NAME EMAIL MOBILE User Management System