SlideShare uma empresa Scribd logo
1 de 24
Don't code, bake.
An introduction to CakePHP
GREAT SCOTT!
Happy Back to the Future Day!
Introduction
PHP Developer
at UK Web Media
in Weyhill
http://www.ukwm.co.uk
Cyberstalk me!
https://twitter.com/YellDavid
https://github.com/davidyell
http://careers.stackoverflow.com/davidyell
http://uk.linkedin.com/in/davidyell
#cakephp on Freenode IRC
David Yell
aka Neon1024
CakePHP 3
is
Awesome
What is CakePHP?
CakePHP makes building web applications simpler, faster and require less code.
RAD
Rapid Application
Development
MVC
Model View Controller
CakePHP eh?
Framework
Docs
2005!
Why is Cake good?
Convention over configuration
Less of this More of this
Do work.
Make people happy.
???
Profit!
Why should I use it?
CakePHP makes building web applications simpler, faster and require less code.
What's in the box?
5.45.4
ORMORM
Simpler configuration External librariesFramework components
Freebies!
Behaviours
● Counter cache
● Timestamp
● Translate
● Tree
Components
● Authentication
● Cookie
● CSRF
● Flash
● Paginator
● Request Handler
● Security
Utilities
● Caching
● Email
● File & Folder
● Hash
● HttpClient
● Inflector
● Internationalisation
and localisation
● Logging
● Number
● Router
● Security
● String
● Time
● Xml
Helpers
● Flash
● Form
● Html
● Number
● Paginator
● Rss
● Session
● Text
● Time
● Url
Model
Tables and Entities
● Repository pattern
● Tables find your entities
● Loves to play with Databases
● Tables serve up tasty entities
● Varied shared behaviour
Example
src/Model/Table/PostsTable.php
src/Model/Entity/Post.php
Table class
Query object
Database
class
DB Driver
Data
store
Behaviors
Share the love
● Refactor shared model
methods
● Reusable code
● Complex data operations
● Callbacks
● Dynamic attachment
Models
Shared
Logic
Behavior
Controller
The brain
● Dad for the day
● Bosses the Model
● Herds the View
● Looks after the request
● Callbacks
Request
Routing
Controller
Model
View
Components
Share the love
● Refactor shared controller
methods
● Reusable code
● Callbacks
● Dynamic attachment
Controllers
Shared
Logic
Component
Views
The pretty bit
● Response
● Works with the Controller
● Shiny veneer
Data
Layout
Template
View
Example
src/Template/<Plural>/index.ctp
Helpers
Share the love
● Give views some brains
● Wrap up complex
functionality
● Reusable
ViewNumber
Form
Html
Paginator
Text
Time
An extra slice of views
● Build complex templates
● Reusable and extendable
● Dynamic shared content
● Complex data
Elements
View Cells
BlocksBlocks
View
Bake for 5 minutes
Using Bake you can complete the Bookmarker tutorial in under 5 minutes!
Plugins
● Applications in applications
● Can wrap anything
● Distributable
● Self contained
● Single responsibility
functionality
The book
CakeBot: Book is http://book.cakephp.org the answer to life, the universe and all your bun making needs.
Convinced?
Getting started
Bookmarker tutorial
Ecosystem
● http://cakephp.org
● Book – http://book.cakephp.org
● Plugins – http://plugins.cakephp.org
https://github.com/cakephp
Check the core teams
repositories for more stuff
Use Muffin – https://github.com/usemuffin
Friends of Cake – www.friendsofcake.com
Thanks!
Questions?
Feedback?
https://joind.in/15858

Mais conteúdo relacionado

Mais procurados

Front-End Modernization for Mortals
Front-End Modernization for MortalsFront-End Modernization for Mortals
Front-End Modernization for Mortalscgack
 
Using Git with WordPress - Presented by Nigel Rodgers.
Using Git with WordPress - Presented by Nigel Rodgers.Using Git with WordPress - Presented by Nigel Rodgers.
Using Git with WordPress - Presented by Nigel Rodgers.WordCamp Harare
 
Web development meetingup
Web development meetingupWeb development meetingup
Web development meetingupPiTechnologies
 
Vaadin slides for @Devoxx 2012
Vaadin slides for @Devoxx 2012Vaadin slides for @Devoxx 2012
Vaadin slides for @Devoxx 2012Nicolas Fränkel
 
Building End to-End Web Apps Using TypeScript
Building End to-End Web Apps Using TypeScriptBuilding End to-End Web Apps Using TypeScript
Building End to-End Web Apps Using TypeScriptGil Fink
 
Robin Böhm - Angular 2 - code.talks 2015
Robin Böhm - Angular 2 - code.talks 2015Robin Böhm - Angular 2 - code.talks 2015
Robin Böhm - Angular 2 - code.talks 2015AboutYouGmbH
 
Git in 10 minutes (WordCamp Europe 2017)
Git in 10 minutes (WordCamp Europe 2017)Git in 10 minutes (WordCamp Europe 2017)
Git in 10 minutes (WordCamp Europe 2017)Borek Bernard
 
How to outsource the pain of drupal translation to smartling from loparev
How to outsource the pain of drupal translation to smartling from loparevHow to outsource the pain of drupal translation to smartling from loparev
How to outsource the pain of drupal translation to smartling from loparevOleksii Bogush
 
Creating real time applications with Angular and Firebase
Creating real time applications with Angular and FirebaseCreating real time applications with Angular and Firebase
Creating real time applications with Angular and FirebaseLoiane Groner
 
Untangle Your Front End Development with Visual Studio 2015
Untangle Your Front End Development with Visual Studio 2015Untangle Your Front End Development with Visual Studio 2015
Untangle Your Front End Development with Visual Studio 2015Scott Heckel
 
HTML5 for dummies
HTML5 for dummiesHTML5 for dummies
HTML5 for dummiesRan Bar-Zik
 
Going Global with WordPress Multilingual (WordCamp Denpasar 2016)
Going Global with WordPress Multilingual (WordCamp Denpasar 2016)Going Global with WordPress Multilingual (WordCamp Denpasar 2016)
Going Global with WordPress Multilingual (WordCamp Denpasar 2016)Dat Hoang
 
WordPress on the Jamstack by rtCamper Muhammad Muhsin @ WordPress Colombo Meetup
WordPress on the Jamstack by rtCamper Muhammad Muhsin @ WordPress Colombo MeetupWordPress on the Jamstack by rtCamper Muhammad Muhsin @ WordPress Colombo Meetup
WordPress on the Jamstack by rtCamper Muhammad Muhsin @ WordPress Colombo MeetuprtCamp
 
Why Embrace "Html5"?
Why Embrace "Html5"?Why Embrace "Html5"?
Why Embrace "Html5"?FossilDesigns
 

Mais procurados (20)

MJML API @ Paris API
MJML API  @ Paris APIMJML API  @ Paris API
MJML API @ Paris API
 
Front-End Modernization for Mortals
Front-End Modernization for MortalsFront-End Modernization for Mortals
Front-End Modernization for Mortals
 
Using Git with WordPress - Presented by Nigel Rodgers.
Using Git with WordPress - Presented by Nigel Rodgers.Using Git with WordPress - Presented by Nigel Rodgers.
Using Git with WordPress - Presented by Nigel Rodgers.
 
Web development meetingup
Web development meetingupWeb development meetingup
Web development meetingup
 
Vaadin slides for @Devoxx 2012
Vaadin slides for @Devoxx 2012Vaadin slides for @Devoxx 2012
Vaadin slides for @Devoxx 2012
 
Building End to-End Web Apps Using TypeScript
Building End to-End Web Apps Using TypeScriptBuilding End to-End Web Apps Using TypeScript
Building End to-End Web Apps Using TypeScript
 
Robin Böhm - Angular 2 - code.talks 2015
Robin Böhm - Angular 2 - code.talks 2015Robin Böhm - Angular 2 - code.talks 2015
Robin Böhm - Angular 2 - code.talks 2015
 
Git in 10 minutes (WordCamp Europe 2017)
Git in 10 minutes (WordCamp Europe 2017)Git in 10 minutes (WordCamp Europe 2017)
Git in 10 minutes (WordCamp Europe 2017)
 
How to outsource the pain of drupal translation to smartling from loparev
How to outsource the pain of drupal translation to smartling from loparevHow to outsource the pain of drupal translation to smartling from loparev
How to outsource the pain of drupal translation to smartling from loparev
 
Plugin for CakePHP2.0
Plugin for CakePHP2.0Plugin for CakePHP2.0
Plugin for CakePHP2.0
 
MVA-Transcript
MVA-TranscriptMVA-Transcript
MVA-Transcript
 
Creating real time applications with Angular and Firebase
Creating real time applications with Angular and FirebaseCreating real time applications with Angular and Firebase
Creating real time applications with Angular and Firebase
 
Untangle Your Front End Development with Visual Studio 2015
Untangle Your Front End Development with Visual Studio 2015Untangle Your Front End Development with Visual Studio 2015
Untangle Your Front End Development with Visual Studio 2015
 
HTML5 for dummies
HTML5 for dummiesHTML5 for dummies
HTML5 for dummies
 
Going Global with WordPress Multilingual (WordCamp Denpasar 2016)
Going Global with WordPress Multilingual (WordCamp Denpasar 2016)Going Global with WordPress Multilingual (WordCamp Denpasar 2016)
Going Global with WordPress Multilingual (WordCamp Denpasar 2016)
 
That worked before
That worked beforeThat worked before
That worked before
 
Spring Boot
Spring BootSpring Boot
Spring Boot
 
WordPress on the Jamstack by rtCamper Muhammad Muhsin @ WordPress Colombo Meetup
WordPress on the Jamstack by rtCamper Muhammad Muhsin @ WordPress Colombo MeetupWordPress on the Jamstack by rtCamper Muhammad Muhsin @ WordPress Colombo Meetup
WordPress on the Jamstack by rtCamper Muhammad Muhsin @ WordPress Colombo Meetup
 
Why Embrace "Html5"?
Why Embrace "Html5"?Why Embrace "Html5"?
Why Embrace "Html5"?
 
PWA - Progressive Web App
PWA - Progressive Web AppPWA - Progressive Web App
PWA - Progressive Web App
 

Destaque

PHP South Coast - Don't code bake, an introduction to CakePHP 3
PHP South Coast - Don't code bake, an introduction to CakePHP 3PHP South Coast - Don't code bake, an introduction to CakePHP 3
PHP South Coast - Don't code bake, an introduction to CakePHP 3David Yell
 
Cơ đầu mặt cổ (p1)
Cơ đầu mặt cổ (p1)Cơ đầu mặt cổ (p1)
Cơ đầu mặt cổ (p1)Tải ThànhHuy
 
CV_Silvia_Stulrajterova Projects resume
CV_Silvia_Stulrajterova Projects resumeCV_Silvia_Stulrajterova Projects resume
CV_Silvia_Stulrajterova Projects resumeSILVIA STULRAJTEROVA
 
BPM Day SP 2016 - Transformação de uma empresa por meio de processos
BPM Day SP 2016 - Transformação de uma empresa por meio de processosBPM Day SP 2016 - Transformação de uma empresa por meio de processos
BPM Day SP 2016 - Transformação de uma empresa por meio de processosLecom Tecnologia
 
BPM Day SP - Integrando BPM na Agenda de Inovação da Empresa
BPM Day SP - Integrando BPM na Agenda de Inovação da Empresa BPM Day SP - Integrando BPM na Agenda de Inovação da Empresa
BPM Day SP - Integrando BPM na Agenda de Inovação da Empresa Lecom Tecnologia
 
BPM Day SP 2016 - O que a automacao pode fazer pelos seus processos
BPM Day SP 2016 - O que a automacao pode fazer pelos seus processos BPM Day SP 2016 - O que a automacao pode fazer pelos seus processos
BPM Day SP 2016 - O que a automacao pode fazer pelos seus processos Lecom Tecnologia
 
BPM Day SP - 2016 Business transformation
BPM Day SP - 2016 Business transformationBPM Day SP - 2016 Business transformation
BPM Day SP - 2016 Business transformationLecom Tecnologia
 
Métodos Agéis e como podem ser usados em projetos de BPM. Agile BPM
Métodos Agéis e como podem ser usados em projetos de BPM.  Agile BPMMétodos Agéis e como podem ser usados em projetos de BPM.  Agile BPM
Métodos Agéis e como podem ser usados em projetos de BPM. Agile BPMLecom Tecnologia
 
BPM e Transformação Digital - BPM Day Salvador 2016
BPM e Transformação Digital - BPM Day Salvador 2016BPM e Transformação Digital - BPM Day Salvador 2016
BPM e Transformação Digital - BPM Day Salvador 2016Lecom Tecnologia
 
Don't Code, Bake. An introduction to CakePHP ~PHP Hampshire Oct 2014
Don't Code, Bake. An introduction to CakePHP ~PHP Hampshire Oct 2014Don't Code, Bake. An introduction to CakePHP ~PHP Hampshire Oct 2014
Don't Code, Bake. An introduction to CakePHP ~PHP Hampshire Oct 2014David Yell
 
Future of HTTP in CakePHP
Future of HTTP in CakePHPFuture of HTTP in CakePHP
Future of HTTP in CakePHPmarkstory
 
CakePHP mistakes made 2015
CakePHP mistakes made 2015CakePHP mistakes made 2015
CakePHP mistakes made 2015markstory
 
New in cakephp3
New in cakephp3New in cakephp3
New in cakephp3markstory
 
JavaScript 從零開始
JavaScript 從零開始JavaScript 從零開始
JavaScript 從零開始Adam Hung
 

Destaque (15)

PHP South Coast - Don't code bake, an introduction to CakePHP 3
PHP South Coast - Don't code bake, an introduction to CakePHP 3PHP South Coast - Don't code bake, an introduction to CakePHP 3
PHP South Coast - Don't code bake, an introduction to CakePHP 3
 
Cơ đầu mặt cổ (p1)
Cơ đầu mặt cổ (p1)Cơ đầu mặt cổ (p1)
Cơ đầu mặt cổ (p1)
 
CV_Silvia_Stulrajterova Projects resume
CV_Silvia_Stulrajterova Projects resumeCV_Silvia_Stulrajterova Projects resume
CV_Silvia_Stulrajterova Projects resume
 
BPM Day SP 2016 - Transformação de uma empresa por meio de processos
BPM Day SP 2016 - Transformação de uma empresa por meio de processosBPM Day SP 2016 - Transformação de uma empresa por meio de processos
BPM Day SP 2016 - Transformação de uma empresa por meio de processos
 
BPM Day SP - Integrando BPM na Agenda de Inovação da Empresa
BPM Day SP - Integrando BPM na Agenda de Inovação da Empresa BPM Day SP - Integrando BPM na Agenda de Inovação da Empresa
BPM Day SP - Integrando BPM na Agenda de Inovação da Empresa
 
BPM Day SP 2016 - O que a automacao pode fazer pelos seus processos
BPM Day SP 2016 - O que a automacao pode fazer pelos seus processos BPM Day SP 2016 - O que a automacao pode fazer pelos seus processos
BPM Day SP 2016 - O que a automacao pode fazer pelos seus processos
 
BPM Day SP - 2016 Business transformation
BPM Day SP - 2016 Business transformationBPM Day SP - 2016 Business transformation
BPM Day SP - 2016 Business transformation
 
Métodos Agéis e como podem ser usados em projetos de BPM. Agile BPM
Métodos Agéis e como podem ser usados em projetos de BPM.  Agile BPMMétodos Agéis e como podem ser usados em projetos de BPM.  Agile BPM
Métodos Agéis e como podem ser usados em projetos de BPM. Agile BPM
 
PHP WTF
PHP WTFPHP WTF
PHP WTF
 
BPM e Transformação Digital - BPM Day Salvador 2016
BPM e Transformação Digital - BPM Day Salvador 2016BPM e Transformação Digital - BPM Day Salvador 2016
BPM e Transformação Digital - BPM Day Salvador 2016
 
Don't Code, Bake. An introduction to CakePHP ~PHP Hampshire Oct 2014
Don't Code, Bake. An introduction to CakePHP ~PHP Hampshire Oct 2014Don't Code, Bake. An introduction to CakePHP ~PHP Hampshire Oct 2014
Don't Code, Bake. An introduction to CakePHP ~PHP Hampshire Oct 2014
 
Future of HTTP in CakePHP
Future of HTTP in CakePHPFuture of HTTP in CakePHP
Future of HTTP in CakePHP
 
CakePHP mistakes made 2015
CakePHP mistakes made 2015CakePHP mistakes made 2015
CakePHP mistakes made 2015
 
New in cakephp3
New in cakephp3New in cakephp3
New in cakephp3
 
JavaScript 從零開始
JavaScript 從零開始JavaScript 從零開始
JavaScript 從零開始
 

Semelhante a PHP Berkshire October 2015

Why use Go for web development?
Why use Go for web development?Why use Go for web development?
Why use Go for web development?Weng Wei
 
Monster JavaScript Course - 50+ projects and applications
Monster JavaScript Course - 50+ projects and applicationsMonster JavaScript Course - 50+ projects and applications
Monster JavaScript Course - 50+ projects and applicationsLaurence Svekis ✔
 
Benefits of cake_php_in_web_development
Benefits of cake_php_in_web_developmentBenefits of cake_php_in_web_development
Benefits of cake_php_in_web_developmentXicom Technologies
 
Introduction to Web Components & Polymer Workshop - JS Interactive
Introduction to Web Components & Polymer Workshop - JS InteractiveIntroduction to Web Components & Polymer Workshop - JS Interactive
Introduction to Web Components & Polymer Workshop - JS InteractiveJohn Riviello
 
Reactjs workshop
Reactjs workshop Reactjs workshop
Reactjs workshop Ahmed rebai
 
Building a µservice with Kotlin, Micronaut & GCP
Building a µservice with Kotlin, Micronaut & GCPBuilding a µservice with Kotlin, Micronaut & GCP
Building a µservice with Kotlin, Micronaut & GCPRobert MacLean
 
Intro to CakePHP 1.3
Intro to CakePHP 1.3Intro to CakePHP 1.3
Intro to CakePHP 1.3Adam Culp
 
JS digest. Decemebr 2017
JS digest. Decemebr 2017JS digest. Decemebr 2017
JS digest. Decemebr 2017ElifTech
 
They why behind php frameworks
They why behind php frameworksThey why behind php frameworks
They why behind php frameworksKirk Madera
 
Building a PaaS using Chef
Building a PaaS using ChefBuilding a PaaS using Chef
Building a PaaS using ChefShaun Domingo
 
Developing the unknown
Developing the unknownDeveloping the unknown
Developing the unknownpaul22blue
 
Reactjs workshop (1)
Reactjs workshop (1)Reactjs workshop (1)
Reactjs workshop (1)Ahmed rebai
 
GraphQL-ify your APIs - Devoxx UK 2021
 GraphQL-ify your APIs - Devoxx UK 2021 GraphQL-ify your APIs - Devoxx UK 2021
GraphQL-ify your APIs - Devoxx UK 2021Soham Dasgupta
 
Improving your code design using Java
Improving your code design using JavaImproving your code design using Java
Improving your code design using JavaRoan Brasil Monteiro
 
Making sense of the front-end, for PHP developers
Making sense of the front-end, for PHP developersMaking sense of the front-end, for PHP developers
Making sense of the front-end, for PHP developersLewiz
 

Semelhante a PHP Berkshire October 2015 (20)

Why use Go for web development?
Why use Go for web development?Why use Go for web development?
Why use Go for web development?
 
Monster JavaScript Course - 50+ projects and applications
Monster JavaScript Course - 50+ projects and applicationsMonster JavaScript Course - 50+ projects and applications
Monster JavaScript Course - 50+ projects and applications
 
Benefits of cake_php_in_web_development
Benefits of cake_php_in_web_developmentBenefits of cake_php_in_web_development
Benefits of cake_php_in_web_development
 
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
 
Vue.js Use Cases
Vue.js Use CasesVue.js Use Cases
Vue.js Use Cases
 
Introduction to Web Components & Polymer Workshop - JS Interactive
Introduction to Web Components & Polymer Workshop - JS InteractiveIntroduction to Web Components & Polymer Workshop - JS Interactive
Introduction to Web Components & Polymer Workshop - JS Interactive
 
Reactjs workshop
Reactjs workshop Reactjs workshop
Reactjs workshop
 
Building a µservice with Kotlin, Micronaut & GCP
Building a µservice with Kotlin, Micronaut & GCPBuilding a µservice with Kotlin, Micronaut & GCP
Building a µservice with Kotlin, Micronaut & GCP
 
Cakephp manual-11
Cakephp manual-11Cakephp manual-11
Cakephp manual-11
 
Intro to CakePHP 1.3
Intro to CakePHP 1.3Intro to CakePHP 1.3
Intro to CakePHP 1.3
 
Itb2018 integrating mvc into legacy
Itb2018   integrating mvc into legacyItb2018   integrating mvc into legacy
Itb2018 integrating mvc into legacy
 
JS digest. Decemebr 2017
JS digest. Decemebr 2017JS digest. Decemebr 2017
JS digest. Decemebr 2017
 
They why behind php frameworks
They why behind php frameworksThey why behind php frameworks
They why behind php frameworks
 
Building a PaaS using Chef
Building a PaaS using ChefBuilding a PaaS using Chef
Building a PaaS using Chef
 
Developing the unknown
Developing the unknownDeveloping the unknown
Developing the unknown
 
Reactjs workshop (1)
Reactjs workshop (1)Reactjs workshop (1)
Reactjs workshop (1)
 
GraphQL-ify your APIs - Devoxx UK 2021
 GraphQL-ify your APIs - Devoxx UK 2021 GraphQL-ify your APIs - Devoxx UK 2021
GraphQL-ify your APIs - Devoxx UK 2021
 
Improving your code design using Java
Improving your code design using JavaImproving your code design using Java
Improving your code design using Java
 
Making sense of the front-end, for PHP developers
Making sense of the front-end, for PHP developersMaking sense of the front-end, for PHP developers
Making sense of the front-end, for PHP developers
 
Web components
Web componentsWeb components
Web components
 

Último

Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
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 challengesrafiqahmad00786416
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
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 TerraformAndrey Devyatkin
 
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 Scriptwesley chun
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbuapidays
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
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 FresherRemote DBA Services
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024The Digital Insurer
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024The Digital Insurer
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
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 connectorsNanddeep Nachan
 
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 WorkerThousandEyes
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelDeepika Singh
 
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 educationjfdjdjcjdnsjd
 

Último (20)

Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
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 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
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
 
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
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
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
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
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
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
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
 

PHP Berkshire October 2015

  • 1. Don't code, bake. An introduction to CakePHP
  • 2. GREAT SCOTT! Happy Back to the Future Day!
  • 3. Introduction PHP Developer at UK Web Media in Weyhill http://www.ukwm.co.uk Cyberstalk me! https://twitter.com/YellDavid https://github.com/davidyell http://careers.stackoverflow.com/davidyell http://uk.linkedin.com/in/davidyell #cakephp on Freenode IRC David Yell aka Neon1024
  • 5. What is CakePHP? CakePHP makes building web applications simpler, faster and require less code. RAD Rapid Application Development MVC Model View Controller
  • 7. Why is Cake good? Convention over configuration Less of this More of this
  • 8. Do work. Make people happy. ??? Profit! Why should I use it? CakePHP makes building web applications simpler, faster and require less code.
  • 9. What's in the box? 5.45.4 ORMORM Simpler configuration External librariesFramework components
  • 10. Freebies! Behaviours ● Counter cache ● Timestamp ● Translate ● Tree Components ● Authentication ● Cookie ● CSRF ● Flash ● Paginator ● Request Handler ● Security Utilities ● Caching ● Email ● File & Folder ● Hash ● HttpClient ● Inflector ● Internationalisation and localisation ● Logging ● Number ● Router ● Security ● String ● Time ● Xml Helpers ● Flash ● Form ● Html ● Number ● Paginator ● Rss ● Session ● Text ● Time ● Url
  • 11. Model Tables and Entities ● Repository pattern ● Tables find your entities ● Loves to play with Databases ● Tables serve up tasty entities ● Varied shared behaviour Example src/Model/Table/PostsTable.php src/Model/Entity/Post.php Table class Query object Database class DB Driver Data store
  • 12. Behaviors Share the love ● Refactor shared model methods ● Reusable code ● Complex data operations ● Callbacks ● Dynamic attachment Models Shared Logic Behavior
  • 13. Controller The brain ● Dad for the day ● Bosses the Model ● Herds the View ● Looks after the request ● Callbacks Request Routing Controller Model View
  • 14. Components Share the love ● Refactor shared controller methods ● Reusable code ● Callbacks ● Dynamic attachment Controllers Shared Logic Component
  • 15. Views The pretty bit ● Response ● Works with the Controller ● Shiny veneer Data Layout Template View Example src/Template/<Plural>/index.ctp
  • 16. Helpers Share the love ● Give views some brains ● Wrap up complex functionality ● Reusable ViewNumber Form Html Paginator Text Time
  • 17. An extra slice of views ● Build complex templates ● Reusable and extendable ● Dynamic shared content ● Complex data Elements View Cells BlocksBlocks View
  • 18. Bake for 5 minutes Using Bake you can complete the Bookmarker tutorial in under 5 minutes!
  • 19. Plugins ● Applications in applications ● Can wrap anything ● Distributable ● Self contained ● Single responsibility functionality
  • 20. The book CakeBot: Book is http://book.cakephp.org the answer to life, the universe and all your bun making needs.
  • 23. Ecosystem ● http://cakephp.org ● Book – http://book.cakephp.org ● Plugins – http://plugins.cakephp.org https://github.com/cakephp Check the core teams repositories for more stuff Use Muffin – https://github.com/usemuffin Friends of Cake – www.friendsofcake.com

Notas do Editor

  1. Six years commercial experience, mostly agencies doing campaign work. Started with HTML on GeoCities. Self-taught myself PHP whilst building an arbiter for the Howling Rain alliance in Planetarion. UKWM do campaign and affiliate marketing work, we are recruiting for another developer so if this presentation sounds like something you&amp;apos;d be interested in let me know and I can hook you up. This is my first presentation so be gentle! I will hopefully have some time at the end for questions.
  2. CakePHP is awesome and I think so, and hopefully after this presentation you will to.
  3. So I mentioned RAD and MVC. Everyone heard of these two principles? Wikipedia says “In general, RAD approaches to software development put less emphasis on planning tasks and more emphasis on development.” It&amp;apos;s worth noting that you do want to still do a little planning, mostly with your database. What information you want to store and how to store it. In essence it&amp;apos;s more about building stuff than chatting about building stuff. MVC is about creating separation of concerns and keeping code clean and DRY (don&amp;apos;t repeat yourself) which is related to refactoring for me at least, but that&amp;apos;s a bit off topic here.
  4. CakePHP is a PHP based MVC RAD framework. The idea is to allow rapid development of applications but also be flexible enough to allow customisation and further development. In the top 10 most starred php frameworks on github (pos 8) Two released major versions, 2.x and 3.x Version 3.x currently released, under active development, nearly 7k commits to 3.x before release. Since release of 3.0.0 there have been 850 commits. 3.0.9 just released this week. More than 8 million visitors to the framework website Over 31 million page views of the website 10 years of life! Completely open source, community driven development. Mention that anyone can contribute and is welcome to do so, it&amp;apos;s encouraged. Talk about the documentation being maintained and that people can also contribute back it quickly and easily, the &amp;apos;improve button&amp;apos; CakeFest 2014 had over 110 attendees from 22 different countries! CakePHP maintains a presence in social media, with twitter, facebook, google groups, youtube, podcast and active stack overflow community.
  5. Instead of configuring your application you can simply stick to conventions in the framework to have everything work out of the box. Of course you can override the conventions when and if you want to. For example you can have a Table reading from a db table with a different name if you want. Again, I&amp;apos;m lazy. I like not writing and validating YAML or XML. Anyone hate things not working when there is a missing character in your configuration? I do. Plural db tables, plural Table classes, singular Entities, plural Controllers and plural Template folders. For example a database table called &amp;apos;people&amp;apos; would have a model class called &amp;apos;Person&amp;apos; and use the &amp;apos;PeopleController&amp;apos; and have it&amp;apos;s views in the &amp;apos;people&amp;apos; folder. Cakes inflector will take care of pluralisation and singularisation of words. You can obviously add your own rules, but it currently understands things such as the example, and also fish and sheep.
  6. I want to be happy I want to make people happy. They might be my colleagues, clients or internal project stakeholders. I want you guys to be happy. Happiness breads motivation. It helps you guys get out of bed and build awesome applications every day. This mean delivering applications and functionality to project stakeholders on time and in budget. Using a RAD MVC framework you&amp;apos;re able to develop complex applications very quickly, iterate early, and fast, but still to a high standard. A framework helps to give a standardised basis of work for developers meaning that code becomes more transferrable and easier to maintain. The &amp;apos;profit&amp;apos; here might be happyness, it might be motivation, it might be a happy client, a great application, a fully passing test suite, green CI reports. All kinds of things. Make sure to pick the right tool for the job. Noone can claim that any one tool or framework is a blanket tool for all cases. I rebuilt my companies most profitable website from a legacy system to cakephp, due to a deadline, in one week and it&amp;apos;s still live and living happily. It even went live on a Friday of a bank holiday when I had the Tuesday off. I don&amp;apos;t test, but when I do, I do it in production! Cake is tested on Linux and Windows, as well as tested in HHVM
  7. Has full composer support. 3.x has a minimum requirement of php 5.4.16 The ORM (db layer) has been written to be very lazy and use query objects. Routing api has been rewritten More consistent and now simpler to configure, now just one app.php file to setup your application, so less faff with Git and setup in production. Slicker Configuration class allowing easier config access Making more use of external libraries such as Carbon, Aura and Password Compat (for php5.4)
  8. No need to worry about Composer dependancies! All this is included! Think of all the things you could build with so many handy tools right at your fingertips! Hash is a utility class which is used to doing operations on arrays using X-Path notation. Such as stripping out all Posts with a certain tag from a set of data. The rest I&amp;apos;m sure you can work out what they do from their names. You&amp;apos;ll notice Number and Time, these use the library classes which are wrapped into the Number and Time helpers, so you can use the functionality in models or controllers. In 3.x a number of these classes have been changed around, some, like the FlashComponent are due to refactoring elsewhere, in this case the SessionComponent. &amp;lt;Talk a bit about some of the various classes, email, security, etc&amp;gt;
  9. Anything to do with data should be in a model. Extends AppModel. Fat models are good, many functions can be refactored into models to keep your controllers thin and allow your controllers to access the methods through the model. A datasource actually does the heavy lifting against the data provider. So you can create any datasource you want and it remains transparent to the model. Can write a datasource for anything, mysql, mongo, api, etc Models store contain your data when it&amp;apos;s returned. In 3.x you&amp;apos;ll get a query object instead which contains a collection of objects. Used to build relationships between objects in the application. Post hasMany Tag for example would be defined in the model. Deals with data validation in your forms using the rules defined in your models.
  10. Spelling. &amp;apos;murica Behaviours are essentially mixins for your models. In order to keep your fat models organised any shared logic or callbacks that you need to apply to multiple models can be refactored into a behaviour. This allows you to easily attach that behaviour to any model to give it access to that functionality. Example, you want to timestamp when a record changes. You&amp;apos;d go right in for the &amp;apos;beforeSave()&amp;apos; method to add a timestamp to the data. However you don&amp;apos;t want to write the same code in the same callback in each model. So why not make a Timestamp behaviour, which you can then attach to the models which you want to have timestamping. Simples! Examples: Containable, Linkable, Translate, Listable
  11. Extends AppController so there is inheritance. Dad for the day! It deals with both the incoming request object, preparing the response object and dispatching the view. The controller has a single responsibility. So an OrdersController deals with orders. A UsersController deals with Users. Contains public methods called actions, which are your &amp;apos;things which do things&amp;apos;. Such as Add, Edit, View and Delete. Has callbacks allowing you to change data and perform operations at various stages of the controller execution. BeforeFilter, beforeRender and afterFilter()
  12. Components are similar to Behaviours in that they are mixins for your Controllers. If you are writing the same logic in lots of controllers, stop! And think about refactoring the code into a component. Always keep code DRY. Don&amp;apos;t be tempted to put public controller actions into a component! Think more about actual php code that those methods might need and refactor that. Example, Session, Pagination, Security
  13. So our routing has found the controller, the controller has got the data from our model and has set it to the view. The V in MVC. Responsible for generating specific output required for the request. This could be HTML, Xml or Json depending on the request. It might even be a PDF or another file for download. By default, most views are HTML using the .ctp extension (cake template) which is just standard php+html. The framework has automatic Json and Xml views built in which can be used using the RequestHandlerComponent. This makes building API&amp;apos;s super easy as you don&amp;apos;t need to worry about building your api output. Layout file to implement our shared html. Layouts wrap views common markup should be in the layout. Eg, JS &amp; CSS Templates can be extended from each other, so if you want to break up your common view parts into views to inherit from you can do that. The actual view template should have no logic ideally, but you&amp;apos;ll end up with some foreachs in most cases. Refactoring view logic uses helpers which we&amp;apos;ll come onto shortly.
  14. Helpers are the component-like classes for the presentation layer of your application. They contain presentational logic that is shared between many views, elements, or layouts. As helpers are actual classes any complex functionality can be easily wrapped into a helper to prevent adding of logic to templates. Here are some of the core helpers. Form helper deals with generating form fields. The Time helper for example can do &amp;apos;time ago in words&amp;apos; and such. So anything which requires some logic. If you start writing PHP in your views, stop and think about using a helper instead. Helpers are portable. You can reuse them in different projects so it&amp;apos;s always worth making the code and output quite generic so that you can reuse them. For UKWM we have a php prices library for calculating prices, annual, monthly, averages, etc and I have wrapped this into a helper, so that I can, in my view, simply say $this-&amp;gt;Price-&amp;gt;monthly() and get a monthly price.
  15. In 2.x dynamic elements required requestAction() which was bad because it needed caching due to the dispatch cycle. In 3.x this has gone and Cells are in to replace it. Cells have their own controller and view file. They are ideal for reusable page parts which need logic, data and specific rendering. Cells do not dispatch sub-requests making them more efficient than requestAction(). Eg, data driven nav, sidebar with category counts. Elements which are shared static HTML which can be included in any view. This allows you to build a static navigation, sidebar or similar with only one place for the markup. Data can be passed into elements and they can be cached easily. Blocks allow for shared content in memory, but can be appended to from the view. Mostly used to for things like javascript and meta. So you can append javascript to the end of your whole page from the view.
  16. By using the convention over configuration we are able to leverage the automated coding tools in the shell to write out our basic code for us. The bake shell task allows rapid prototyping of features or for you to just build a whole site out to see how it&amp;apos;ll work. You can then proceed to customise the application as you need. The great thing with the bake shell specifically is that the code generated is based on a bake theme, which you can customise. So if you want to change anything that is being generated you can simply change the bake theme and rebake to get new code! I&amp;apos;ve actually built a plugin which has my own bake theme for generating my admin areas so that I can include all the customisations that I like, such as Twitter bootstrap right away. They always say that if you do something more than three times you should automate it, so why not the same with how you automatically generate your code? So here I have created an ERD in MySQL Workbench and used the forward engineer tool to build my database automatically. Then I can use the bake shell task to automatically build my application code. From here I can run it in my browser using the built in php server. By running &amp;apos;Console/cake server&amp;apos;.
  17. Plugins are essentially a Cake application. They can be linked and executed inside your cake application as if they were application code. A plugin could provide any functionality to your application, from a Users plugin for managing users, with full stack MVC layers, or it might be a single behaviour for attaching to a model. Any Cake elements which you would like to reuse in more than one application, think about refactoring it into a plugin. In most cases plugins generally contain Behaviours, Components and Helpers, as they provide the ability to add extra functionality to existing objects within your application.
  18. So you&amp;apos;re convinced right? This is awesome. It&amp;apos;s fast, it&amp;apos;s easy and best of all it does what you want and doesn&amp;apos;t get in your way when you want to do something different. So what is the first step? Where do I start? Got to blog tut slide -&amp;gt;
  19. Everything is on Github. The framework source code, the core developers, most of the plugins, pretty much everything. I&amp;apos;d recommend searching Github for anything you might need as a first port of call. There is also the &amp;apos;Community&amp;apos; menu on the Cake website, which has links to pretty much every community presence for CakePHP across the internet. I&amp;apos;ve included the two main sites here, book and plugins which I use on a daily basis. The Friends of Cake initiative was started by a few of the core team and has since branched out to include some of the community also. I am a member of this team. We have a bunch of useful plugins and tools available. If you would like to use Composer with the 2.x branch, we have that already setup here. We also have CakePHP Vagrant + Puppet boxes setup here if you want to try those. I would also recommend checking the core team members personal profiles on Github. Most of them spend time working on Cake plugins in their spare time and you&amp;apos;ll find that work in their own repos. It&amp;apos;s also worth following so that you can help out with projects that they are working on. The core team are all really nice people and they are usually happy to get feedbacks, ideas and pull requests for things they are working on.If in doubt, ask.