SlideShare une entreprise Scribd logo
1  sur  17
Rapid Application Development

        With CakePHP 1.3
Who am I


      • Brad Hancock
   • Twitter @braddhancock
  • braddhancock@gmail.com
  • Network Security Engineer
• Part-time CakePHP developer.
Goals for tonight

• Identify Cake.
• To demonstrate CakePHP’s ability to rapidly
  deploy an application.
• Build an application in under 1 hour.
What is CakePHP

• Free open-source rapid development framework.

• MVC Architecture.

• Application scaffolding.

• Code Generation.

• Convention over configuration.
Steps for prototyping an Application in
               CakePHP

• LAMP Installation.
  Linux Apache Mysql & PHP


• Build the database.

• Bake the application.
                             Just that easy

• Run the application.
Pre-configuration

Apache 2.2 Web server needs modrewrite enabled
                  # a2enmod rewrite (debian)
                       Mysql
           Latest CakePHP 1.3 installation from
                    CakePHP.
Steps

•   Extract Cake to your apache document root.
•   Test that the framework starts.
•   Ensure rewrite is enabled.
•   Create your database -- mysql
•   Create the database tables.
         tables names plural
         foreign key columns named as tablename_id
                 (convention over configuration)
Bake time.
• ../cake/console/cake bake project – create salt
    Hashing in Cake defaults to Sha1. The Salt prevents dictionary attacks on the hash.

• ../cake/console/cake bake db_config -create db con.
                                 Connect Cake to MySQL

• ../cake/console/cake bake model all --models
• ../cake/console/cake bake controller all --controllers
• ../cake/console/cake bake view all -- views
See the application


• Automatic generation of CSS and HTML for views.
• Notice associations are automatically created based
  on column names.
• Notice Friendly URLs.
Validation and Automatic creation of
              Form fields.


• Based on user input we can bake model
  validation right into the application.
• Quickly rebuilding our model and view if
  necessary.
Enable Auth Component
• Create User Table
   – Must have username and password columns.
   – Password Type must be Varchar(40) for hash.

   CREATE TABLE users (
   id integer auto_increment,
   username char(50),
   password char(40),
   admin int(1),
   PRIMARY KEY (id));
Add a user and create login view
•   Bake the Model, Controller, & View.
•   var $components = array('Auth', 'Session');
    – Add to the App_Controller.php Parent Controller for all
       others.
    Modify the User Controller to add the Login and logout
    method.
Modify the User Controller


 class UsersController extends AppController {
  var $name = 'Users';

       function beforeFilter() {
                            $this->Auth->allow('*');
                 }

      function login() {

               }

     function logout() {
                           $this->redirect($this->Auth->logout());
               }
 }
Create the Login.ctp View
 <?php

         echo $this->Html->div('',null,array('id'=>'login'));

         echo $session->flash('auth');

         echo $this->Form->create('User', array(
         'action' =>'login',
         'autocomplete'=>'off‘
                       )
         );

         echo $this->Form->input('username');

         echo $this->Form->input('password');

         echo $this->Form->end('Login');

 ?>
Customize your app

• Build a menu or modify your opening page.
  – app/views/pages/home.ctp
• Modify the CSS styles.
  – app/webroot/css
• Customize your views, controllers, &models
  – app/views, app/controllers, app/models
Learning More
• book.cakephp.org website cookbook
• Books:
  – Beginning CakePHP:From Novice to Professional
    David Golding. Kindle $18. On Cake 1.2
  - Super Awesome Advanced CakePHP tips
    Matt Curry. Free www.pseudocoder.com
  - CakePHP 1.3 Application Development Cookbook
    Mariano Iglesias
• IRC:
  – Freenode channel #cakephp
IRC
<Ceeram> what do you mean with this then?:
<kidtangerine> he adds public in front of his
functions
> Does that have a question mark on the
end, asshole?

Contenu connexe

Tendances

Chef Fundamentals Training Series Module 4: The Chef Client Run and Expanding...
Chef Fundamentals Training Series Module 4: The Chef Client Run and Expanding...Chef Fundamentals Training Series Module 4: The Chef Client Run and Expanding...
Chef Fundamentals Training Series Module 4: The Chef Client Run and Expanding...
Chef Software, Inc.
 
The Peanut Butter Cup of Web-dev: Plack and single page web apps
The Peanut Butter Cup of Web-dev: Plack and single page web appsThe Peanut Butter Cup of Web-dev: Plack and single page web apps
The Peanut Butter Cup of Web-dev: Plack and single page web apps
John Anderson
 

Tendances (20)

Introduction to VueJS & The WordPress REST API
Introduction to VueJS & The WordPress REST APIIntroduction to VueJS & The WordPress REST API
Introduction to VueJS & The WordPress REST API
 
WordPress Security & Backup
WordPress Security & Backup WordPress Security & Backup
WordPress Security & Backup
 
WordCamp SF 2011: Debugging in WordPress
WordCamp SF 2011: Debugging in WordPressWordCamp SF 2011: Debugging in WordPress
WordCamp SF 2011: Debugging in WordPress
 
SINATRA + HAML + TWITTER
SINATRA + HAML + TWITTERSINATRA + HAML + TWITTER
SINATRA + HAML + TWITTER
 
Cooking with Chef on Windows
Cooking with Chef on WindowsCooking with Chef on Windows
Cooking with Chef on Windows
 
Chef Fundamentals Training Series Module 4: The Chef Client Run and Expanding...
Chef Fundamentals Training Series Module 4: The Chef Client Run and Expanding...Chef Fundamentals Training Series Module 4: The Chef Client Run and Expanding...
Chef Fundamentals Training Series Module 4: The Chef Client Run and Expanding...
 
Chef Fundamentals Training Series Module 2: Workstation Setup
Chef Fundamentals Training Series Module 2: Workstation SetupChef Fundamentals Training Series Module 2: Workstation Setup
Chef Fundamentals Training Series Module 2: Workstation Setup
 
The unintended benefits of Chef
The unintended benefits of ChefThe unintended benefits of Chef
The unintended benefits of Chef
 
Cooking on Windows without the Windows Cookbook
Cooking on Windows without the Windows CookbookCooking on Windows without the Windows Cookbook
Cooking on Windows without the Windows Cookbook
 
Cooking with Chef on Windows: 2015 Edition
Cooking with Chef on Windows: 2015 EditionCooking with Chef on Windows: 2015 Edition
Cooking with Chef on Windows: 2015 Edition
 
Automating That "Other" OS
Automating That "Other" OSAutomating That "Other" OS
Automating That "Other" OS
 
Chef and PowerShell Desired State Configuration
Chef and PowerShell Desired State ConfigurationChef and PowerShell Desired State Configuration
Chef and PowerShell Desired State Configuration
 
Dirtless Databases - How to Keep Your WordPress Database Squeaky Clean
Dirtless Databases - How to Keep Your WordPress Database Squeaky CleanDirtless Databases - How to Keep Your WordPress Database Squeaky Clean
Dirtless Databases - How to Keep Your WordPress Database Squeaky Clean
 
SenchaCon 2016: Expect the Unexpected - Dealing with Errors in Web Apps
SenchaCon 2016: Expect the Unexpected - Dealing with Errors in Web AppsSenchaCon 2016: Expect the Unexpected - Dealing with Errors in Web Apps
SenchaCon 2016: Expect the Unexpected - Dealing with Errors in Web Apps
 
Writing Software not Code with Cucumber
Writing Software not Code with CucumberWriting Software not Code with Cucumber
Writing Software not Code with Cucumber
 
Cloud Automation with Opscode Chef
Cloud Automation with Opscode ChefCloud Automation with Opscode Chef
Cloud Automation with Opscode Chef
 
Introduccion app engine con python
Introduccion app engine con pythonIntroduccion app engine con python
Introduccion app engine con python
 
The Peanut Butter Cup of Web-dev: Plack and single page web apps
The Peanut Butter Cup of Web-dev: Plack and single page web appsThe Peanut Butter Cup of Web-dev: Plack and single page web apps
The Peanut Butter Cup of Web-dev: Plack and single page web apps
 
Introduction To Ruby Watir (Web Application Testing In Ruby)
Introduction To Ruby Watir (Web Application Testing In Ruby)Introduction To Ruby Watir (Web Application Testing In Ruby)
Introduction To Ruby Watir (Web Application Testing In Ruby)
 
Introduction to Selenium and Ruby
Introduction to Selenium and RubyIntroduction to Selenium and Ruby
Introduction to Selenium and Ruby
 

Similaire à Rapid Application Development with CakePHP 1.3

Staging Drupal 8 31 09 1 3
Staging Drupal 8 31 09 1 3Staging Drupal 8 31 09 1 3
Staging Drupal 8 31 09 1 3
Drupalcon Paris
 

Similaire à Rapid Application Development with CakePHP 1.3 (20)

Intro to CakePHP 1.3
Intro to CakePHP 1.3Intro to CakePHP 1.3
Intro to CakePHP 1.3
 
Synapseindia reviews sharing intro cakephp
Synapseindia reviews sharing intro cakephpSynapseindia reviews sharing intro cakephp
Synapseindia reviews sharing intro cakephp
 
Staging Drupal 8 31 09 1 3
Staging Drupal 8 31 09 1 3Staging Drupal 8 31 09 1 3
Staging Drupal 8 31 09 1 3
 
CakePHP REST Plugin
CakePHP REST PluginCakePHP REST Plugin
CakePHP REST Plugin
 
Codegnitorppt
CodegnitorpptCodegnitorppt
Codegnitorppt
 
Introduction to Chef - April 22 2015
Introduction to Chef - April 22 2015Introduction to Chef - April 22 2015
Introduction to Chef - April 22 2015
 
CakePHP
CakePHPCakePHP
CakePHP
 
Dancing with websocket
Dancing with websocketDancing with websocket
Dancing with websocket
 
2011 NetUG HH: ASP.NET MVC & HTML 5
2011 NetUG HH: ASP.NET MVC & HTML 52011 NetUG HH: ASP.NET MVC & HTML 5
2011 NetUG HH: ASP.NET MVC & HTML 5
 
Introduction to CakePHP
Introduction to CakePHPIntroduction to CakePHP
Introduction to CakePHP
 
Introduction to CakePHP
Introduction to CakePHPIntroduction to CakePHP
Introduction to CakePHP
 
Overview of Chef - Fundamentals Webinar Series Part 1
Overview of Chef - Fundamentals Webinar Series Part 1Overview of Chef - Fundamentals Webinar Series Part 1
Overview of Chef - Fundamentals Webinar Series Part 1
 
Cake php
Cake phpCake php
Cake php
 
Introduction to Infrastructure as Code & Automation / Introduction to Chef
Introduction to Infrastructure as Code & Automation / Introduction to ChefIntroduction to Infrastructure as Code & Automation / Introduction to Chef
Introduction to Infrastructure as Code & Automation / Introduction to Chef
 
MVCL pattern, web flow, code flow, request and response in OpenCart
MVCL pattern, web flow, code flow, request and response in OpenCartMVCL pattern, web flow, code flow, request and response in OpenCart
MVCL pattern, web flow, code flow, request and response in OpenCart
 
Node object and roles - Fundamentals Webinar Series Part 3
Node object and roles - Fundamentals Webinar Series Part 3Node object and roles - Fundamentals Webinar Series Part 3
Node object and roles - Fundamentals Webinar Series Part 3
 
Developing High Performance Web Apps - CodeMash 2011
Developing High Performance Web Apps - CodeMash 2011Developing High Performance Web Apps - CodeMash 2011
Developing High Performance Web Apps - CodeMash 2011
 
When Smalltalk Meets the Web
When Smalltalk Meets the WebWhen Smalltalk Meets the Web
When Smalltalk Meets the Web
 
Office 365 Saturday (Sydney) - SharePoint framework – build integrated user e...
Office 365 Saturday (Sydney) - SharePoint framework – build integrated user e...Office 365 Saturday (Sydney) - SharePoint framework – build integrated user e...
Office 365 Saturday (Sydney) - SharePoint framework – build integrated user e...
 
Google app-engine-cloudcamplagos2011
Google app-engine-cloudcamplagos2011Google app-engine-cloudcamplagos2011
Google app-engine-cloudcamplagos2011
 

Dernier

Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 

Dernier (20)

Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
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
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
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
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 

Rapid Application Development with CakePHP 1.3

  • 1. Rapid Application Development With CakePHP 1.3
  • 2. Who am I • Brad Hancock • Twitter @braddhancock • braddhancock@gmail.com • Network Security Engineer • Part-time CakePHP developer.
  • 3. Goals for tonight • Identify Cake. • To demonstrate CakePHP’s ability to rapidly deploy an application. • Build an application in under 1 hour.
  • 4. What is CakePHP • Free open-source rapid development framework. • MVC Architecture. • Application scaffolding. • Code Generation. • Convention over configuration.
  • 5. Steps for prototyping an Application in CakePHP • LAMP Installation. Linux Apache Mysql & PHP • Build the database. • Bake the application. Just that easy • Run the application.
  • 6. Pre-configuration Apache 2.2 Web server needs modrewrite enabled # a2enmod rewrite (debian) Mysql Latest CakePHP 1.3 installation from CakePHP.
  • 7. Steps • Extract Cake to your apache document root. • Test that the framework starts. • Ensure rewrite is enabled. • Create your database -- mysql • Create the database tables. tables names plural foreign key columns named as tablename_id (convention over configuration)
  • 8. Bake time. • ../cake/console/cake bake project – create salt Hashing in Cake defaults to Sha1. The Salt prevents dictionary attacks on the hash. • ../cake/console/cake bake db_config -create db con. Connect Cake to MySQL • ../cake/console/cake bake model all --models • ../cake/console/cake bake controller all --controllers • ../cake/console/cake bake view all -- views
  • 9. See the application • Automatic generation of CSS and HTML for views. • Notice associations are automatically created based on column names. • Notice Friendly URLs.
  • 10. Validation and Automatic creation of Form fields. • Based on user input we can bake model validation right into the application. • Quickly rebuilding our model and view if necessary.
  • 11. Enable Auth Component • Create User Table – Must have username and password columns. – Password Type must be Varchar(40) for hash. CREATE TABLE users ( id integer auto_increment, username char(50), password char(40), admin int(1), PRIMARY KEY (id));
  • 12. Add a user and create login view • Bake the Model, Controller, & View. • var $components = array('Auth', 'Session'); – Add to the App_Controller.php Parent Controller for all others. Modify the User Controller to add the Login and logout method.
  • 13. Modify the User Controller class UsersController extends AppController { var $name = 'Users'; function beforeFilter() { $this->Auth->allow('*'); } function login() { } function logout() { $this->redirect($this->Auth->logout()); } }
  • 14. Create the Login.ctp View <?php echo $this->Html->div('',null,array('id'=>'login')); echo $session->flash('auth'); echo $this->Form->create('User', array( 'action' =>'login', 'autocomplete'=>'off‘ ) ); echo $this->Form->input('username'); echo $this->Form->input('password'); echo $this->Form->end('Login'); ?>
  • 15. Customize your app • Build a menu or modify your opening page. – app/views/pages/home.ctp • Modify the CSS styles. – app/webroot/css • Customize your views, controllers, &models – app/views, app/controllers, app/models
  • 16. Learning More • book.cakephp.org website cookbook • Books: – Beginning CakePHP:From Novice to Professional David Golding. Kindle $18. On Cake 1.2 - Super Awesome Advanced CakePHP tips Matt Curry. Free www.pseudocoder.com - CakePHP 1.3 Application Development Cookbook Mariano Iglesias • IRC: – Freenode channel #cakephp
  • 17. IRC <Ceeram> what do you mean with this then?: <kidtangerine> he adds public in front of his functions > Does that have a question mark on the end, asshole?

Notes de l'éditeur

  1. Describe Framework A framework is collection of libraries, all ready setup to do the generic functions of an application. It provides pre-existing code so you can focus on the logic of your program.Descrbe Rapid Development Framework. A framework focused on creating applications quickly.Describe MVC Architecture Model – Talks to the database View – HTML, Users sees Controller – Regulates between the two. All files are organized between these components. Makes things very organized. Bank anology: Safe is the database, and only the bankers (models) are allowed in there. Bankers are fat and lazy but make most of decisions. The tellers (controllers) take all the info from the customers (views). The bankers never talk to the customer, they are too good for that, they let the tellers bring the information back and forth to the idiot customers. Convention over Configure, has to do with how things are named in the framework, by naming things in a certain syntax or notation Cake can use those names to preconfigured the application. We will discuss convention over configuration in naming tables and columns for our mysql db. Why use MVC? Because it is a tried and true software design pattern that turns an application into a maintainable, modular, rapidly developed package. Crafting application tasks into separate models, views, and controllers makes your application very light on its feet. New features are easily added, and new faces on old features are a snap. The modular and separate design also allows developers and designers to work simultaneously, including the ability to rapidly prototype. Separation also allows developers to make changes in one part of the application without affecting others.If you&apos;ve never built an application this way, it takes some time getting used to, but we&apos;re confident that once you&apos;ve built your first application using CakePHP, you won&apos;t want to do it any other way.
  2. To rapidly deploy an application in cake, first we need to build the database and all of its tables. Does anyone not familiar with LAMP.
  3. Unzip –dmemphisphp cake.1.3.zipMv ./memphisphp/cake/* ./memphisphp/(convention over configuration)You need to create your database first. All table names are plural. members, member_details, and member_skillsYou want to use InnoDB due to CakePHP only supporting transactions with that engine. ~$ mysql -u root -pPaste fileTalk briefly about db setup and phpmyadmin
  4. Cake has libraries for built in hashing of passwords for its Auth Component. It can support Sha2 256and MD5 Show what the cake bake looks like without all.
  5. var $components = array(&apos;Auth&apos;, &apos;Session&apos;); Actual code for the controller. Need to test.
  6. Add the customize method in the user controller. Add beforeFilter() { $this-&gt;Auth-&gt;allow(‘add’); }
  7. Generates our HTML output on the next slide. Form Helper.