SlideShare a Scribd company logo
May 16th, 2013 php|tek 2013 1
E-mail: chris@ctankersley.com
Twitter: @dragonmantank
App.net: @ctankersleyhttps://joind.in/8153
 ChrisTankersley
 Doing PHP for 9Years
 Lots of projects no one uses, and a few that
some do
 TL;DR https://github.com/dragonmantank
 Heavy Drupal Development for 2 years
May 16th, 2013 php|tek 2013 2
 Don’t use Drupal
May 16th, 2013 php|tek 2013 3
 Don’t abuse Drupal
May 16th, 2013 php|tek 2013 4
What powers your site
May 16th, 2013 php|tek 2013 5
 Pre-built *AMP Stack
 Available for Drupal 6 or 7
 Install and Ready to Go
May 16th, 2013 php|tek 2013 6
Advantages
Disadvantages
 Not built for multiple installs
 Can’t use for existing sites
 Only forWindows and Mac
 Best to use for module or theme
development
 I don’t like it for full site development
May 16th, 2013 php|tek 2013 7
 Make use of the “Sites” option to help
separate work
 On Mac, only the /sites/all/ folder is writable
 Even Sites you create are not writable
 Don’t put the entire stack inVC, just your
work
May 16th, 2013 php|tek 2013 8
May 16th, 2013 php|tek 2013 9
 Full server to run code
 Self contained and can be replicated
 Most modern machines can doVM
Advantages
Disadvantages
 Uses more resources
 Easier to break
 Best to use for full site development
 Or use it all the time, it’s nice to have an
environment you control
May 16th, 2013 php|tek 2013 10
 Try and pick a distro that is close to your production
setup. If you are running Redhat in production, set up
an CentOS box
 Set up the document root for your web server to be
the /vagrant folder (or sub folder, depending on your
site layout).This way your site will run automatically.
 If you are running CentOS and Apache, disable
SELinux so that Apache will use the /vagrant folder
 Don't use PHP 5.4 with Drupal 7 or lower
 Make sure APC, or some opcode cache, is installed
 Provide lots of RAM, at least 1GB
May 16th, 2013 php|tek 2013 11
 Run everything off of your local machine!
 Great if you can do it, I like vagrant better
May 16th, 2013 php|tek 2013 12
@grmpyprogrammer will track you down if you don’t
May 16th, 2013 php|tek 2013 13
Automatically making sure your code works
May 16th, 2013 php|tek 2013 14
 Write your tests before you code
 Watch it fail
 Write code to make your tests pass
 Feel better
May 16th, 2013 php|tek 2013 15
 Drupal ships with SimpleTest baked in
 Supports unit testing and functional testing
 Unit tests are done by extending
DrupalUnitTestCase
 Functional tests are done by extending
DrupalWebTestCase
May 16th, 2013 php|tek 2013 16
May 16th, 2013 php|tek 2013 17
 Unit tests do not bootstrap Drupal, so are
very quick
 FunctionalTests bootstrap Drupal, so are very
slow
May 16th, 2013 php|tek 2013 18
 The test runner is AJAX, so it can break very
easily
 Debugging can be hard since extra output
breaks the test runner, and since the DB is
destroyed watchdog() is useless
 You can use $this->verbose(‘message’) or
debug(‘message’) though
May 16th, 2013 php|tek 2013 19
Your command line friend
May 16th, 2013 php|tek 2013 20
Dump your database to an SQL file
$ drush sql-dump --result-file=/PATH/TO/dump.sql
Back up the entire site to a tarball
$ drush archive-dump default
View watchdog entries
$ drush watchdog-list
Update Drupal and modules
$ drush pm-update
Download module
$ drush pm-download [module_name]
May 16th, 2013 php|tek 2013 21
I couldn’t think of a good tagline that should go here
May 16th, 2013 php|tek 2013 22
 Allows you to quickly back up the DB and
move it
 No need to use a DB GUI
 Can do automatic local or remote backups
 Useful for moving databases from one server
to another
May 16th, 2013 php|tek 2013 23
 Exposes a lot of the structure of Drupal
 Things like nodes can be clicked through to see
their object structure
 Can auto-generate dummy content
 Better debugging output
 dpm() and dvm() for pretty output
 dpr(), kpr(), and dvr() will dump to the page
header
May 16th, 2013 php|tek 2013 24
 Package system for Drupal
 Takes a lot of stuff in the DB and makes it
exportable and portable via code
 Lot of stuff works out of the box, extra
modules like UUID, boxes, and features_extra
pick up the slack
 ftools makes updating features easy
May 16th, 2013 php|tek 2013 25
Understand it and harness its power
May 16th, 2013 php|tek 2013 26
 Page caching for full output caching
 Block caching so that dynamic content can
still update if it needs to
 You can configure how long to cache things
for
May 16th, 2013 php|tek 2013 27
 In Full Page Caching, most of the PHP isn’t
run
 Effectively turns your site into a static site (kind
of)
 With block caching, not all blocks will cache.
What and when to cache is up to the block
May 16th, 2013 php|tek 2013 28
It’s kind of like nuclear fusion, but without all the explosions
May 16th, 2013 php|tek 2013 29
 Will group needed JS and CSS files
together, reducing the number of HTTP
requests
 Will minify CSS, reducing some of the
transmission size
YOU have to make your modules take
advantage of it, though
May 16th, 2013 php|tek 2013 30
 Let Drupal know about your files
 drupal_add_js()
 drupal_add_css()
 Add the files to your .info file
 Don’t just add JS and CSS files via <script>
and <style> tags in your theme
May 16th, 2013 php|tek 2013 31
Really, ask.
May 16th, 2013 php|tek 2013 32
 Acquia Dev Desktop
 vagrant
 Drupal SimpleTest
 drush
 Backup and Migrate
 Devel
 Features
May 16th, 2013 php|tek 2013 33
May 16th, 2013 php|tek 2013 34
E-mail: chris@ctankersley.com
Twitter: @dragonmantank
App.net: @ctankersley
https://joind.in/8153

More Related Content

PDF
PHP SA 2014 - Releasing Your Open Source Project
PDF
Introduction to PhoneGap and PhoneGap Build
PPTX
Xdebug, KCacheGrind and Webgrind with WampServer
PDF
Find WordPress performance bottlenecks with XDebug PHP profiling
PDF
How to investigate and recover from a security breach in WordPress
PDF
Profiling PHP with Xdebug / Webgrind
PDF
Testing and updating WordPress - Advanced techniques for avoiding regressions
PDF
The 5 most common reasons for a slow WordPress site and how to fix them – ext...
PHP SA 2014 - Releasing Your Open Source Project
Introduction to PhoneGap and PhoneGap Build
Xdebug, KCacheGrind and Webgrind with WampServer
Find WordPress performance bottlenecks with XDebug PHP profiling
How to investigate and recover from a security breach in WordPress
Profiling PHP with Xdebug / Webgrind
Testing and updating WordPress - Advanced techniques for avoiding regressions
The 5 most common reasons for a slow WordPress site and how to fix them – ext...

What's hot (20)

PDF
Capistrano deploy Magento project in an efficient way
PDF
WordPress security 101 - WP Turku Meetup 2.2.2017
PDF
Automatic testing and quality assurance for WordPress plugins and themes
PDF
Improving WordPress performance (xdebug and profiling)
PDF
Optimising Your Front End Workflow With Symfony, Twig, Bower and Gulp
PDF
Why it's dangerous to turn off automatic updates and here's how to do it
PDF
WordPress modern development
PPTX
Python/Flask Presentation
PPTX
WordPress Hardening
KEY
Php Power Tools
PDF
The MetaCPAN VM for Dummies Part One (Installation)
PDF
WordPress security 101 - WP Jyväskylä Meetup 21.3.2017
PPTX
Use Symfony2 components inside WordPress
PDF
Developers, Be a Bada$$ with WP-CLI
PPTX
Building a PWA - For Everyone Who Is Scared To
PDF
Quick flask an intro to flask
PDF
WPDay Bologna 2013
PDF
Open web mail setup
PDF
Philipp Von Weitershausen Plone Age Mammoths, Sabers And Caveen Cant The...
PDF
Technical SEO for WordPress - 2017 edition
Capistrano deploy Magento project in an efficient way
WordPress security 101 - WP Turku Meetup 2.2.2017
Automatic testing and quality assurance for WordPress plugins and themes
Improving WordPress performance (xdebug and profiling)
Optimising Your Front End Workflow With Symfony, Twig, Bower and Gulp
Why it's dangerous to turn off automatic updates and here's how to do it
WordPress modern development
Python/Flask Presentation
WordPress Hardening
Php Power Tools
The MetaCPAN VM for Dummies Part One (Installation)
WordPress security 101 - WP Jyväskylä Meetup 21.3.2017
Use Symfony2 components inside WordPress
Developers, Be a Bada$$ with WP-CLI
Building a PWA - For Everyone Who Is Scared To
Quick flask an intro to flask
WPDay Bologna 2013
Open web mail setup
Philipp Von Weitershausen Plone Age Mammoths, Sabers And Caveen Cant The...
Technical SEO for WordPress - 2017 edition
Ad

Similar to Drupal Development Tips (20)

ODP
Making The Drupal Pill Easier To Swallow
PDF
Hong Kong Drupal User Group - Nov 8th
PDF
Hong kong drupal user group nov 8th - drupal 7.32 security vulnerability
PDF
Hong kong drupal user group nov 8th - drupal 7.32 security vulnerability
ODP
Drupal development
PPTX
Drupal in Libraries
PPTX
Drush for drupal website builder
PDF
Help! I inherited a Drupal Site! - DrupalCamp Atlanta 2016
PPT
How to? Drupal developer toolkit. Dennis Povshedny.
PDF
Drupal Performance : DrupalCamp North
PDF
DrupalCampLA 2011: Drupal backend-performance
ODP
Drupal Multi-Site Setup
PPTX
Becoming A Drupal Master Builder
PDF
Introduction to Drupal - Installation, Anatomy, Terminologies
PDF
Magento Performance Optimization 101
PDF
Towards the perfect Drupal Dev Machine
PPTX
Google App Engine for PHP
PDF
Drupal + composer = new love !?
PDF
Drupal in-depth
PPT
Performance and Scalability
Making The Drupal Pill Easier To Swallow
Hong Kong Drupal User Group - Nov 8th
Hong kong drupal user group nov 8th - drupal 7.32 security vulnerability
Hong kong drupal user group nov 8th - drupal 7.32 security vulnerability
Drupal development
Drupal in Libraries
Drush for drupal website builder
Help! I inherited a Drupal Site! - DrupalCamp Atlanta 2016
How to? Drupal developer toolkit. Dennis Povshedny.
Drupal Performance : DrupalCamp North
DrupalCampLA 2011: Drupal backend-performance
Drupal Multi-Site Setup
Becoming A Drupal Master Builder
Introduction to Drupal - Installation, Anatomy, Terminologies
Magento Performance Optimization 101
Towards the perfect Drupal Dev Machine
Google App Engine for PHP
Drupal + composer = new love !?
Drupal in-depth
Performance and Scalability
Ad

More from Chris Tankersley (20)

PDF
8 Rules for Better Applications - PHP Tek 2025
PDF
The Art of API Design - PHP Tek 2025, Chris Tankersley
PDF
Docker is Dead: Long Live Containers
PDF
Bend time to your will with git
PDF
Using PHP Functions! (Not those functions, Google Cloud Functions)
PDF
Dead Simple APIs with OpenAPI
PDF
Killer Docker Workflows for Development
PDF
You Got Async in my PHP!
ODP
Docker for Developers - PHP Detroit 2018
ODP
Docker for Developers
ODP
They are Watching You
ODP
BASHing at the CLI - Midwest PHP 2018
PDF
You Were Lied To About Optimization
ODP
Docker for PHP Developers - php[world] 2017
ODP
Docker for PHP Developers - Madison PHP 2017
ODP
Docker for Developers - php[tek] 2017
ODP
Why Docker? Dayton PHP, April 2017
PPTX
OOP Is More Then Cars and Dogs - Midwest PHP 2017
PPTX
From Docker to Production - SunshinePHP 2017
PPTX
Docker for Developers - Sunshine PHP
8 Rules for Better Applications - PHP Tek 2025
The Art of API Design - PHP Tek 2025, Chris Tankersley
Docker is Dead: Long Live Containers
Bend time to your will with git
Using PHP Functions! (Not those functions, Google Cloud Functions)
Dead Simple APIs with OpenAPI
Killer Docker Workflows for Development
You Got Async in my PHP!
Docker for Developers - PHP Detroit 2018
Docker for Developers
They are Watching You
BASHing at the CLI - Midwest PHP 2018
You Were Lied To About Optimization
Docker for PHP Developers - php[world] 2017
Docker for PHP Developers - Madison PHP 2017
Docker for Developers - php[tek] 2017
Why Docker? Dayton PHP, April 2017
OOP Is More Then Cars and Dogs - Midwest PHP 2017
From Docker to Production - SunshinePHP 2017
Docker for Developers - Sunshine PHP

Recently uploaded (20)

PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Network Security Unit 5.pdf for BCA BBA.
PPTX
Programs and apps: productivity, graphics, security and other tools
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PPTX
Spectroscopy.pptx food analysis technology
PDF
Empathic Computing: Creating Shared Understanding
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
KodekX | Application Modernization Development
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
Electronic commerce courselecture one. Pdf
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PPTX
Cloud computing and distributed systems.
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Network Security Unit 5.pdf for BCA BBA.
Programs and apps: productivity, graphics, security and other tools
20250228 LYD VKU AI Blended-Learning.pptx
Spectroscopy.pptx food analysis technology
Empathic Computing: Creating Shared Understanding
Review of recent advances in non-invasive hemoglobin estimation
NewMind AI Weekly Chronicles - August'25 Week I
The Rise and Fall of 3GPP – Time for a Sabbatical?
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Digital-Transformation-Roadmap-for-Companies.pptx
Diabetes mellitus diagnosis method based random forest with bat algorithm
Mobile App Security Testing_ A Comprehensive Guide.pdf
KodekX | Application Modernization Development
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Electronic commerce courselecture one. Pdf
Spectral efficient network and resource selection model in 5G networks
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Cloud computing and distributed systems.

Drupal Development Tips

  • 1. May 16th, 2013 php|tek 2013 1 E-mail: chris@ctankersley.com Twitter: @dragonmantank App.net: @ctankersleyhttps://joind.in/8153
  • 2.  ChrisTankersley  Doing PHP for 9Years  Lots of projects no one uses, and a few that some do  TL;DR https://github.com/dragonmantank  Heavy Drupal Development for 2 years May 16th, 2013 php|tek 2013 2
  • 3.  Don’t use Drupal May 16th, 2013 php|tek 2013 3
  • 4.  Don’t abuse Drupal May 16th, 2013 php|tek 2013 4
  • 5. What powers your site May 16th, 2013 php|tek 2013 5
  • 6.  Pre-built *AMP Stack  Available for Drupal 6 or 7  Install and Ready to Go May 16th, 2013 php|tek 2013 6 Advantages Disadvantages  Not built for multiple installs  Can’t use for existing sites  Only forWindows and Mac
  • 7.  Best to use for module or theme development  I don’t like it for full site development May 16th, 2013 php|tek 2013 7
  • 8.  Make use of the “Sites” option to help separate work  On Mac, only the /sites/all/ folder is writable  Even Sites you create are not writable  Don’t put the entire stack inVC, just your work May 16th, 2013 php|tek 2013 8
  • 9. May 16th, 2013 php|tek 2013 9  Full server to run code  Self contained and can be replicated  Most modern machines can doVM Advantages Disadvantages  Uses more resources  Easier to break
  • 10.  Best to use for full site development  Or use it all the time, it’s nice to have an environment you control May 16th, 2013 php|tek 2013 10
  • 11.  Try and pick a distro that is close to your production setup. If you are running Redhat in production, set up an CentOS box  Set up the document root for your web server to be the /vagrant folder (or sub folder, depending on your site layout).This way your site will run automatically.  If you are running CentOS and Apache, disable SELinux so that Apache will use the /vagrant folder  Don't use PHP 5.4 with Drupal 7 or lower  Make sure APC, or some opcode cache, is installed  Provide lots of RAM, at least 1GB May 16th, 2013 php|tek 2013 11
  • 12.  Run everything off of your local machine!  Great if you can do it, I like vagrant better May 16th, 2013 php|tek 2013 12
  • 13. @grmpyprogrammer will track you down if you don’t May 16th, 2013 php|tek 2013 13
  • 14. Automatically making sure your code works May 16th, 2013 php|tek 2013 14
  • 15.  Write your tests before you code  Watch it fail  Write code to make your tests pass  Feel better May 16th, 2013 php|tek 2013 15
  • 16.  Drupal ships with SimpleTest baked in  Supports unit testing and functional testing  Unit tests are done by extending DrupalUnitTestCase  Functional tests are done by extending DrupalWebTestCase May 16th, 2013 php|tek 2013 16
  • 17. May 16th, 2013 php|tek 2013 17
  • 18.  Unit tests do not bootstrap Drupal, so are very quick  FunctionalTests bootstrap Drupal, so are very slow May 16th, 2013 php|tek 2013 18
  • 19.  The test runner is AJAX, so it can break very easily  Debugging can be hard since extra output breaks the test runner, and since the DB is destroyed watchdog() is useless  You can use $this->verbose(‘message’) or debug(‘message’) though May 16th, 2013 php|tek 2013 19
  • 20. Your command line friend May 16th, 2013 php|tek 2013 20
  • 21. Dump your database to an SQL file $ drush sql-dump --result-file=/PATH/TO/dump.sql Back up the entire site to a tarball $ drush archive-dump default View watchdog entries $ drush watchdog-list Update Drupal and modules $ drush pm-update Download module $ drush pm-download [module_name] May 16th, 2013 php|tek 2013 21
  • 22. I couldn’t think of a good tagline that should go here May 16th, 2013 php|tek 2013 22
  • 23.  Allows you to quickly back up the DB and move it  No need to use a DB GUI  Can do automatic local or remote backups  Useful for moving databases from one server to another May 16th, 2013 php|tek 2013 23
  • 24.  Exposes a lot of the structure of Drupal  Things like nodes can be clicked through to see their object structure  Can auto-generate dummy content  Better debugging output  dpm() and dvm() for pretty output  dpr(), kpr(), and dvr() will dump to the page header May 16th, 2013 php|tek 2013 24
  • 25.  Package system for Drupal  Takes a lot of stuff in the DB and makes it exportable and portable via code  Lot of stuff works out of the box, extra modules like UUID, boxes, and features_extra pick up the slack  ftools makes updating features easy May 16th, 2013 php|tek 2013 25
  • 26. Understand it and harness its power May 16th, 2013 php|tek 2013 26
  • 27.  Page caching for full output caching  Block caching so that dynamic content can still update if it needs to  You can configure how long to cache things for May 16th, 2013 php|tek 2013 27
  • 28.  In Full Page Caching, most of the PHP isn’t run  Effectively turns your site into a static site (kind of)  With block caching, not all blocks will cache. What and when to cache is up to the block May 16th, 2013 php|tek 2013 28
  • 29. It’s kind of like nuclear fusion, but without all the explosions May 16th, 2013 php|tek 2013 29
  • 30.  Will group needed JS and CSS files together, reducing the number of HTTP requests  Will minify CSS, reducing some of the transmission size YOU have to make your modules take advantage of it, though May 16th, 2013 php|tek 2013 30
  • 31.  Let Drupal know about your files  drupal_add_js()  drupal_add_css()  Add the files to your .info file  Don’t just add JS and CSS files via <script> and <style> tags in your theme May 16th, 2013 php|tek 2013 31
  • 32. Really, ask. May 16th, 2013 php|tek 2013 32
  • 33.  Acquia Dev Desktop  vagrant  Drupal SimpleTest  drush  Backup and Migrate  Devel  Features May 16th, 2013 php|tek 2013 33
  • 34. May 16th, 2013 php|tek 2013 34 E-mail: chris@ctankersley.com Twitter: @dragonmantank App.net: @ctankersley https://joind.in/8153

Editor's Notes

  • #7: Show the acquiadev desktop
  • #9: Show the directory structure