Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

WordPress for the modern PHP developer

1,907 views

Published on

Talk for PHPUK 2017

Published in: Software
  • DOWNLOAD FULL BOOKS, INTO AVAILABLE FORMAT ......................................................................................................................... ......................................................................................................................... 1.DOWNLOAD FULL. PDF EBOOK here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... 1.DOWNLOAD FULL. EPUB Ebook here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... 1.DOWNLOAD FULL. doc Ebook here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... 1.DOWNLOAD FULL. PDF EBOOK here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... 1.DOWNLOAD FULL. EPUB Ebook here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... 1.DOWNLOAD FULL. doc Ebook here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... ......................................................................................................................... ......................................................................................................................... .............. Browse by Genre Available eBooks ......................................................................................................................... Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult,
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • Do You Seek Funds To Pay Off Credits and Debts? { FIFOCapitals@gmail.com } Is Here To Put A Stop To Your Financial Problems. We Offer All Kinds Of Loan (Personal Loan, Commercial Loan, etc.) We Give Out Loan With An Interest Rate Of 1.00%. Interested Applicants Should Contact Us Via Email: FIFOCapitals@gmail.com Please Fill the Application Form Below: - Complete Name: - Loan Amount Needed: - Loan Duration: - Purpose Of Loan: - City / Country: - Telephone: - How Did You Hear About Us: If You Are Interested To Get A Loan Then Kindly Write Us With The Loan Requirement. Please, Contact Us via email: FIFOCapitals@gmail.com
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here

WordPress for the modern PHP developer

  1. 1. @tweetingsherry #phpuk17 ~ ChrisSherry $ WordPress for the modern PHP developer
  2. 2. @tweetingsherry #phpuk17 ~ ChrisSherry $ WordPress for the modern PHP developer
  3. 3. @tweetingsherry #phpuk17 ~ ChrisSherry $ WordPress for the modern PHP developer
  4. 4. @tweetingsherry #phpuk17
  5. 5. @tweetingsherry #phpuk17
  6. 6. @tweetingsherry #phpuk17
  7. 7. @tweetingsherry #phpuk17
  8. 8. @tweetingsherry #phpuk17
  9. 9. @tweetingsherry #phpuk17
  10. 10. @tweetingsherry #phpuk17
  11. 11. @tweetingsherry #phpuk17
  12. 12. @tweetingsherry #phpuk17 Version Control
  13. 13. @tweetingsherry #phpuk17 See who changed what, when
  14. 14. @tweetingsherry #phpuk17 See who changed what, when Multiple people working on the same files simultaneously
  15. 15. @tweetingsherry #phpuk17 See who changed what, when Multiple people working on the same files simultaneously Work on features in parallel
  16. 16. @tweetingsherry #phpuk17 See who changed what, when Multiple people working on the same files simultaneously Work on features in parallel Roll back to previous versions
  17. 17. @tweetingsherry #phpuk17 See who changed what, when Multiple people working on the same files simultaneously Work on features in parallel Roll back to previous versions Go home on time
  18. 18. @tweetingsherry #phpuk17 ALL THE THINGS ~/site $ git init ~/site $ git add —-all
  19. 19. @tweetingsherry #phpuk17 .git index.php readme.htmllicense.txt wp-activate.php wp-admin wp-blog-header.php wp-comments- post.php wp-config- sample.php wp-config.php wp-content wp-cron.php wp-includes wp-links-opml.php wp-load.php wp-login.php wp-mail.php wp-settings.php wp-signup.php wp-trackback.php xmlrpc.php
  20. 20. @tweetingsherry #phpuk17 .git index.php readme.htmllicense.txt wp-activate.php wp-admin wp-blog-header.php wp-comments- post.php wp-config- sample.php wp-config.php wp-content wp-cron.php wp-includes wp-links-opml.php wp-load.php wp-login.php wp-mail.php wp-settings.php wp-signup.php wp-trackback.php xmlrpc.php
  21. 21. @tweetingsherry #phpuk17
  22. 22. @tweetingsherry #phpuk17 Our users can change our codebase using the editor tool
  23. 23. @tweetingsherry #phpuk17 ... 
 define('DISALLOW_FILE_EDIT', true); /wp-config.php
  24. 24. @tweetingsherry #phpuk17 ... 
 define('DISALLOW_FILE_EDIT', true); /wp-config.php define('AUTOMATIC_UPDATER_DISABLED', true);
  25. 25. @tweetingsherry #phpuk17 .git index.php readme.htmllicense.txt wp-activate.php wp-admin wp-blog-header.php wp-comments- post.php wp-config- sample.php wp-config.php wp-content wp-cron.php wp-includes wp-links-opml.php wp-load.php wp-login.php wp-mail.php wp-settings.php wp-signup.php wp-trackback.php xmlrpc.php
  26. 26. @tweetingsherry #phpuk17 .git index.php readme.htmllicense.txt wp-activate.php wp-admin wp-blog-header.php wp-comments- post.php wp-config- sample.php wp-config.php wp-content wp-cron.php wp-includes wp-links-opml.php wp-load.php wp-login.php wp-mail.php wp-settings.php wp-signup.php wp-trackback.php xmlrpc.php
  27. 27. @tweetingsherry #phpuk17 .git index.php readme.htmllicense.txt wp-activate.php wp-admin wp-blog-header.php wp-comments- post.php wp-config- sample.php wp-config.php wp-content wp-cron.php wp-includes wp-links-opml.php wp-load.php wp-login.php wp-mail.php wp-settings.php wp-signup.php wp-trackback.php xmlrpc.php
  28. 28. @tweetingsherry #phpuk17 .git index.php wp-config.php readme.htmllicense.txt wp-activate.php wp-admin wp-blog-header.php wp-comments- post.php wp-config- sample.php wp-content wp-cron.php wp-includes wp-links-opml.php wp-load.php wp-login.php wp-mail.php wp-settings.php wp-signup.php wp-trackback.php xmlrpc.php
  29. 29. @tweetingsherry #phpuk17 .git index.php wp-config.phpwordpress
  30. 30. @tweetingsherry #phpuk17 .git index.php wp-config.phpwordpress
  31. 31. @tweetingsherry #phpuk17 .git index.php wp-config.phpwordpress
  32. 32. @tweetingsherry #phpuk17 .git index.php wp-config.phpwordpress
  33. 33. @tweetingsherry #phpuk17 .git index.php wp-config.phpwordpress
  34. 34. @tweetingsherry #phpuk17 if (!defined('ABSPATH')) {
 define( 'ABSPATH', dirname(__FILE__) . '/' );
 }
 /wp-config.php...
  35. 35. @tweetingsherry #phpuk17 if (!defined('ABSPATH')) {
 define( 'ABSPATH', dirname(__FILE__) . '/wordpress/' );
 }
 /wp-config.php...
  36. 36. @tweetingsherry #phpuk17 option_value https://site.com https://site.com WordPress Just another WordPress site ... option_name siteurl home blogname blogdescription ... wp_options
  37. 37. @tweetingsherry #phpuk17 option_value https://site.com https://site.com WordPress Just another WordPress site ... /wordpress option_name siteurl home blogname blogdescription ... wp_options
  38. 38. @tweetingsherry #phpuk17 .git index.php wp-config.phpwordpress
  39. 39. @tweetingsherry #phpuk17 .git index.php wp-config.phpwordpress mments- t.php wp-config- sample.php wp-content wp-cron.php wp-includes wp-links-opml.php wp-load.php wp-logi
  40. 40. @tweetingsherry #phpuk17 .git index.php wp-config.phpwordpress mments- t.php wp-config- sample.php wp-content wp-cron.php index.php wp-includes plugins themes wp-links-opml.php wp-load.php wp-logi
  41. 41. @tweetingsherry #phpuk17 .git index.php wp-config.phpwordpress mments- t.php wp-config- sample.php wp-content wp-cron.php index.php wp-includes plugins themes wp-links-opml.php wp-load.php wp-logi index.php hello.php
  42. 42. @tweetingsherry #phpuk17 .git index.php wp-config.phpwordpress mments- t.php wp-config- sample.php wp-content wp-cron.php index.php wp-includes plugins themes wp-links-opml.php wp-load.php wp-logi index.php twentyeleven twentytwelve twentythirteen twentyfourteen twentyfifiteen twentysixteen
  43. 43. @tweetingsherry #phpuk17 .git index.php wp-config.phpwordpress mments- t.php wp-config- sample.php wp-content wp-cron.php index.php wp-includes plugins themes wp-links-opml.php wp-load.php wp-logi wp-content index.php twentyeleven twentytwelve twentythirteen twentyfourteen twentyfifiteen twentysixteen
  44. 44. @tweetingsherry #phpuk17 .git index.php wp-config.phpwordpress wp-content plugins themes
  45. 45. @tweetingsherry #phpuk17 .git index.php wp-config.phpwordpress wp-content plugins themes advanced- custom-fields debug-bar awesome-plugin
  46. 46. @tweetingsherry #phpuk17 define( 'WP_CONTENT_DIR', $_SERVER['DOCUMENT_ROOT'] . '/wp-content' ); 
 define( 'WP_CONTENT_URL', '/wp-content' ); /wp-config.php...
  47. 47. @tweetingsherry #phpuk17 .git index.php wp-config.phpwordpress wp-content
  48. 48. @tweetingsherry #phpuk17 .git index.php wp-config.phpwordpress wp-content core code
  49. 49. @tweetingsherry #phpuk17 .git index.php wp-config.phpwordpress wp-content core code application code
  50. 50. @tweetingsherry #phpuk17 YOU MADE A NEW FOLDER I’M GLAD I CHOSE THIS TRACK
  51. 51. @tweetingsherry #phpuk17 GENE WILDER 1933-2016
  52. 52. @tweetingsherry #phpuk17 .git index.php wp-config.phpwordpress wp-content
  53. 53. @tweetingsherry #phpuk17 .git index.php wp-config.phpwordpress wp-content.gitignore
  54. 54. @tweetingsherry #phpuk17 /.DS_Store /wordpress /.gitignore
  55. 55. @tweetingsherry #phpuk17 ~ $ git clone https://github.com/chrissherry/site
  56. 56. @tweetingsherry #phpuk17 ~ $ git clone https://github.com/chrissherry/site .git index.php wp-config.php wp-content.gitignore
  57. 57. @tweetingsherry #phpuk17 ~ $ git clone https://github.com/chrissherry/site .git index.php wp-config.php wp-content.gitignore
  58. 58. @tweetingsherry #phpuk17 Dependency Management
  59. 59. @tweetingsherry #phpuk17
  60. 60. @tweetingsherry #phpuk17 &
  61. 61. @tweetingsherry #phpuk17
  62. 62. @tweetingsherry #phpuk17
  63. 63. @tweetingsherry #phpuk17 github.com/johnpbloch/wordpress
  64. 64. @tweetingsherry #phpuk17 github.com/johnpbloch/wordpress
  65. 65. @tweetingsherry #phpuk17
  66. 66. @tweetingsherry #phpuk17 Default type:library /vendor/[vendor]/[name]
  67. 67. @tweetingsherry #phpuk17 Default type:library /vendor/[vendor]/[name] Custom type: wordpress-core /wordpress
  68. 68. @tweetingsherry #phpuk17 ~/site $ composer require johnpbloch/wordpress ~/site $ composer init ~/site $ composer install
  69. 69. @tweetingsherry #phpuk17 ~/site $ composer require johnpbloch/wordpress { "require": {
 "johnpbloch/wordpress": "^4.5"
 } } /composer.json ~/site $ composer init ~/site $ composer install
  70. 70. @tweetingsherry #phpuk17 index.php wp-config.phpwordpress wp-contentcomposer.json composer.lockgitignore
  71. 71. @tweetingsherry #phpuk17 index.php wp-config.phpwordpress wp-contentcomposer.json composer.lockgitignore
  72. 72. @tweetingsherry #phpuk17 index.php wp-config.phpwordpress wp-contentcomposer.json composer.lockgitignore
  73. 73. @tweetingsherry #phpuk17 index.php wp-config.phpwordpress wp-contentcomposer.json composer.lockgitignore
  74. 74. @tweetingsherry #phpuk17 index.php wp-config.phpwordpress wp-contentcomposer.json composer.lockgitignore
  75. 75. @tweetingsherry #phpuk17 index.php wp-config.phpwordpress wp-content plugins themes advanced- custom-fields composer.json composer.lockgitignore debug-bar awesome-plugin
  76. 76. @tweetingsherry #phpuk17 wpackagist.org
  77. 77. @tweetingsherry #phpuk17 wpackagist.org type: wordpress-plugin /wp-content/plugins type: wordpress-theme /wp-content/themes Custom
  78. 78. @tweetingsherry #phpuk17 .git index.php wp-config.phpwordpress wp-content plugins themes
  79. 79. @tweetingsherry #phpuk17 github.com/composer/installers
  80. 80. @tweetingsherry #phpuk17 { "require": {
 "johnpbloch/wordpress": "^4.5", "wpackagist-plugin/advanced-custom-fields": "~4.4"
 } } /composer.json
  81. 81. @tweetingsherry #phpuk17 https://wordpress.org/plugins/advanced-custom-fields
  82. 82. @tweetingsherry #phpuk17 https://wordpress.org/plugins/advanced-custom-fields
  83. 83. @tweetingsherry #phpuk17 https://wordpress.org/plugins/advanced-custom-fields
  84. 84. @tweetingsherry #phpuk17 https://wordpress.org/plugins/advanced-custom-fields
  85. 85. @tweetingsherry #phpuk17 { "require": {
 "johnpbloch/wordpress": "^4.5", "wpackagist-plugin/advanced-custom-fields": "4.4"
 } } /composer.json
  86. 86. @tweetingsherry #phpuk17 { "require": {
 "johnpbloch/wordpress": "^4.5", "wpackagist-plugin/advanced-custom-fields": "4.4"
 } } /composer.json
  87. 87. @tweetingsherry #phpuk17 /composer.json{ "require": {
 "johnpbloch/wordpress": "^4.5", "wpackagist-plugin/advanced-custom-fields": "4.4"
 }, "repositories": [
 {
 "type": "composer",
 "url": "https://wpackagist.org"
 } ] }
  88. 88. @tweetingsherry #phpuk17 { "require": {
 "johnpbloch/wordpress": "^4.5", "wpackagist-plugin/advanced-custom-fields": "4.4"
 }, "require-dev": { "wpackagist-plugin/debug-bar": "*"
 }, "repositories":[...] } /composer.json ~/site $ composer require —-dev wpackagist-plugin/debug-bar
  89. 89. @tweetingsherry #phpuk17 index.php wp-config.phpwordpress wp-content plugins themes advanced- custom-fields composer.json composer.lockgitignore awesome-plugindebug-bar
  90. 90. @tweetingsherry #phpuk17 index.php wp-config.phpwordpress wp-content plugins themes advanced- custom-fields composer.json composer.lockgitignore awesome-plugindebug-bar
  91. 91. @tweetingsherry #phpuk17 /wordpress
 
 /wp-content/plugins/*
 !/wp-content/plugins/.gitkeep
 
 
 /.gitignore
  92. 92. @tweetingsherry #phpuk17 index.php wp-config.phpwordpress wp-content plugins themes advanced- custom-fields composer.json composer.lockgitignore awesome-plugindebug-bar
  93. 93. @tweetingsherry #phpuk17 index.php wp-config.phpwordpress wp-content plugins themes advanced- custom-fields composer.json composer.lockgitignore awesome-plugindebug-bar
  94. 94. @tweetingsherry #phpuk17 /wordpress
 
 /wp-content/plugins/*
 !/wp-content/plugins/.gitkeep !/wp-content/plugins/awesome-plugin
 
 
 
 /.gitignore
  95. 95. @tweetingsherry #phpuk17
  96. 96. @tweetingsherry #phpuk17 github.com/chrissherry/awesome-plugin
  97. 97. @tweetingsherry #phpuk17 github.com/chrissherry/awesome-plugin
  98. 98. @tweetingsherry #phpuk17 chrissherry/awesome-plugin v1.0 v2.0 TAGS v1.0 (awesome) v2.0 (more awesome!) Site B Site AGithub
  99. 99. @tweetingsherry #phpuk17 github.com/chrissherry/awesome-plugin
  100. 100. @tweetingsherry #phpuk17 github.com/chrissherry/awesome-plugin
  101. 101. @tweetingsherry #phpuk17 github.com/chrissherry/awesome-plugin/composer.json
  102. 102. @tweetingsherry #phpuk17 github.com/chrissherry/awesome-plugin/composer.json
  103. 103. @tweetingsherry #phpuk17 github.com/chrissherry/awesome-plugin/composer.json
  104. 104. @tweetingsherry #phpuk17 {
 "require": {
 {...}, "chrissherry/awesome-plugin": "~1.0" 
 } /composer.json
  105. 105. @tweetingsherry #phpuk17 {
 "require": {
 {...}, "chrissherry/awesome-plugin": "~1.0" 
 }, "repositories": [ {...}, {
 "type": "vcs", "url": "https://github.com/chrissherry/awesome-p..." } ] } /composer.json
  106. 106. @tweetingsherry #phpuk17 index.php wp-config.phpwordpress wp-content plugins themes advanced- custom-fields composer.json composer.lockgitignore awesome-plugindebug-bar
  107. 107. @tweetingsherry #phpuk17 index.php wp-config.phpwordpress wp-content plugins themes composer.json composer.lockgitignore awesome-theme
  108. 108. @tweetingsherry #phpuk17 index.php wp-config.phpwordpress wp-content plugins themes composer.json composer.lockgitignore awesome-theme storefront sydney twentysixteen
  109. 109. @tweetingsherry #phpuk17 /wordpress
 
 /wp-content/plugins/*
 !/wp-content/plugins/.gitkeep
 
 
 /.gitignore
  110. 110. @tweetingsherry #phpuk17 /wordpress
 
 /wp-content/plugins/*
 !/wp-content/plugins/.gitkeep
 
 
 /.gitignore /wp-content/themes/* !/wp-content/themes/.gitkeep
  111. 111. @tweetingsherry #phpuk17 /wordpress
 
 /wp-content/plugins/*
 !/wp-content/plugins/.gitkeep
 
 
 /.gitignore /wp-content/themes/* !/wp-content/themes/.gitkeep !/wp-content/themes/awesome-theme
  112. 112. @tweetingsherry #phpuk17 /wordpress
 
 /wp-content/plugins/*
 !/wp-content/plugins/.gitkeep
 
 
 /.gitignore
  113. 113. @tweetingsherry #phpuk17 ONE DOES NOT SIMPLY CLICK TO UPDATE THINGS
  114. 114. @tweetingsherry #phpuk17 wordpress.org/plugins/members
  115. 115. @tweetingsherry #phpuk17 { "require": { ..., "wpackagist-plugin/members": "1.1.3" }, "repositories":[...] } /composer.json ~/site $ composer require wpackagist-plugin/members
  116. 116. @tweetingsherry #phpuk17 Defined versions for dependancies
  117. 117. @tweetingsherry #phpuk17 Defined versions for dependancies Less third party code in the repository
  118. 118. @tweetingsherry #phpuk17 Defined versions for dependancies Less third party code in the repository Greater reliance on 3rd party availability
  119. 119. @tweetingsherry #phpuk17 Uploads
  120. 120. @tweetingsherry #phpuk17 Uploads
  121. 121. @tweetingsherry #phpuk17 /wordpress
 /wp-content/uploads/*
 
 /wp-content/plugins/*
 !/wp-content/plugins/.gitkeep
 ...
 /.gitignore
  122. 122. @tweetingsherry #phpuk17 s3tools.org/s3cmd
  123. 123. @tweetingsherry #phpuk17 github.com/humanmade/s3-uploads
  124. 124. @tweetingsherry #phpuk17 ~/site $ composer require hadyfayed/s3-uploads { "require": { ..., "hadyfayed/s3-uploads": "2.0" }, "repositories":[...] } /composer.json
  125. 125. @tweetingsherry #phpuk17 ~/site $ rsync -avz user@site.com:/var/www/mysite/wp-content/uploads wp-content/uploads
  126. 126. @tweetingsherry #phpuk17 Smaller repository -don’t need version control over uploads
  127. 127. @tweetingsherry #phpuk17 Smaller repository -don’t need version control over uploads Faster clone and deploy times
  128. 128. @tweetingsherry #phpuk17 Smaller repository -don’t need version control over uploads Faster clone and deploy times Remote backups of our uploads
  129. 129. @tweetingsherry #phpuk17 Databases
  130. 130. @tweetingsherry #phpuk17 prod:~/site $ mysqldump -u user -p dbname > db.sql ~/site $ scp user@site.com:site/db.sql db.sql ~/site $ mysql -u user -p dbname < db.sql
  131. 131. @tweetingsherry #phpuk17 Environments
  132. 132. @tweetingsherry #phpuk17 option_name siteurl home blogname blogdescription ... option_value https://site.com/wordpress https://site.com WordPress Just another WordPress site ... wp_options
  133. 133. @tweetingsherry #phpuk17 option_name siteurl home blogname blogdescription ... option_value https://staging.site.com/wordpre… https://staging.site.com WordPress Just another WordPress site ... wp_options
  134. 134. @tweetingsherry #phpuk17 ... ... define('WP_HOME', 'https://site.com'); define('WP_SITEURL', 'https://site.com/wordpress'); /wp-config.php
  135. 135. @tweetingsherry #phpuk17 //define('WP_HOME', 'https://site.com'); //define('WP_SITEURL', 'https://site.com/wordpress… define('WP_HOME', 'https://staging.site.com'); define('WP_SITEURL', 'https://staging.site.com/wor… /wp-config.php... ...
  136. 136. @tweetingsherry #phpuk17 server {
 listen 443;
 server_name staging.site.com; env WP_ENV=staging ... /etc/nginx/sites-enabled/vhost.conf
  137. 137. @tweetingsherry #phpuk17 server {
 listen 443;
 server_name staging.site.com; env WP_ENV=staging ... switch ($_ENV['WP_ENV']) {
 case 'staging':
 define('WP_HOME', 'https://staging.site.com… define('WP_SITEURL', 'https://staging.site.… ... /wp-config.php /etc/nginx/sites-enabled/vhost.conf
  138. 138. @tweetingsherry #phpuk17 server {
 listen 443;
 server_name staging.site.com; env WP_ENV=staging ... switch ($_ENV['WP_ENV']) {
 case 'staging':
 define('WP_HOME', 'https://staging.site.com… define('WP_SITEURL', 'https://staging.site.… ... /wp-config.php /etc/nginx/sites-enabled/vhost.conf define('WP_HOME', 'https://staging.site.com… define('WP_SITEURL', 'https://staging.site.…
  139. 139. @tweetingsherry #phpuk17 define('DB_NAME', 'database_name_here');
 define('DB_USER', 'username_here');
 define('DB_PASSWORD', 'password_here');
 define('DB_HOST', 'localhost'); define('WP_HOME', 'https://site.com'); define('WP_SITEURL', 'https://site.com/wordp… define('AUTH_KEY', 'put your unique phrase…
 define('SECURE_AUTH_KEY', 'put your unique phrase…
 define('LOGGED_IN_KEY', 'put your unique phrase… define('WP_DEBUG', true); ... /wp-config.php ...
  140. 140. @tweetingsherry #phpuk17 define('DB_NAME', 'database_name_here');
 define('DB_USER', 'username_here');
 define('DB_PASSWORD', 'password_here');
 define('DB_HOST', 'localhost'); define('WP_HOME', 'https://site.com'); define('WP_SITEURL', 'https://site.com/wordp… define('AUTH_KEY', 'put your unique phrase…
 define('SECURE_AUTH_KEY', 'put your unique phrase…
 define('LOGGED_IN_KEY', 'put your unique phrase… define('WP_DEBUG', true); ... ... /wp-config.php
  141. 141. @tweetingsherry #phpuk17 define('DB_NAME', 'database_name_here');
 define('DB_USER', 'username_here');
 define('DB_PASSWORD', 'password_here');
 define('DB_HOST', 'localhost'); define('WP_HOME', 'https://site.com'); define('WP_SITEURL', 'https://site.com/wordp… define('AUTH_KEY', 'put your unique phrase…
 define('SECURE_AUTH_KEY', 'put your unique phrase…
 define('LOGGED_IN_KEY', 'put your unique phrase…
 define('WP_DEBUG', true); ... ... /wp-config.php
  142. 142. @tweetingsherry #phpuk17 KEEP IT SAFE KEEP IT SECRET
  143. 143. @tweetingsherry #phpuk17
  144. 144. @tweetingsherry #phpuk17
  145. 145. @tweetingsherry #phpuk17 github.com/vlucas/phpdotenv
  146. 146. @tweetingsherry #phpuk17 {
 "require": {
 {...} "vlucas/phpdotenv": "^1.0"
 }, ... } /composer.json ~/site $ composer require vlucas/phpdotenv
  147. 147. @tweetingsherry #phpuk17 index.php wp-config.php wordpress wp-content composer.json composer.lock.gitignore.git.env vendor
  148. 148. @tweetingsherry #phpuk17 index.php wp-config.php wordpress wp-content composer.json composer.lock.gitignore.git.env vendor
  149. 149. @tweetingsherry #phpuk17 index.php wp-config.php wordpress wp-content composer.json composer.lock.gitignore.git.env vendor
  150. 150. @tweetingsherry #phpuk17 DB_NAME=dbname
 DB_USER=user
 DB_PASSWORD=correcthorsebatterystaple
 DB_HOST=localhost 
 WP_ENV=development
 WP_HOME=https://site.com
 WP_SITEURL=https://site.com/wordpress /.env
  151. 151. @tweetingsherry #phpuk17 DB_NAME=dbname
 DB_USER=user
 DB_PASSWORD=correcthorsebatterystaple
 DB_HOST=localhost 
 WP_ENV=development
 WP_HOME=https://site.com
 WP_SITEURL=https://site.com/wordpress /.env
  152. 152. @tweetingsherry #phpuk17 require_once dirname(__DIR__).'/vendor/autoload.php'; <?php /wp-config.php
  153. 153. @tweetingsherry #phpuk17 require_once dirname(__DIR__).'/vendor/autoload.php'; <?php /wp-config.php Dotenv::load('.env');
 

  154. 154. @tweetingsherry #phpuk17 require_once dirname(__DIR__).'/vendor/autoload.php'; <?php /wp-config.php Dotenv::load('.env');
 
 define('DB_NAME', $_SERVER['DB_NAME']));
 define('DB_USER', $_ENV['DB_USER']);
 define('DB_PASSWORD', getenv('DB_PASSWORD'));
 define('DB_HOST', getenv('DB_HOST')); define('WP_HOME', getenv('WP_HOME')); define('WP_SITEURL', getenv('WP_SITE_URL’)); ...
  155. 155. @tweetingsherry #phpuk17 require_once dirname(__DIR__).'/vendor/autoload.php'; <?php /wp-config.php Dotenv::load('.env');
 
 define('DB_NAME', $_SERVER['DB_NAME']));
 define('DB_USER', $_ENV['DB_USER']);
 define('DB_PASSWORD', getenv('DB_PASSWORD'));
 define('DB_HOST', getenv('DB_HOST')); define('WP_HOME', getenv('WP_HOME')); define('WP_SITEURL', getenv('WP_SITE_URL’)); ...
  156. 156. @tweetingsherry #phpuk17 require_once dirname(__DIR__).'/vendor/autoload.php'; <?php /wp-config.php Dotenv::load('.env');
 
 define('DB_NAME', $_SERVER['DB_NAME']));
 define('DB_USER', $_ENV['DB_USER']);
 define('DB_PASSWORD', getenv('DB_PASSWORD'));
 define('DB_HOST', getenv('DB_HOST')); ...
  157. 157. @tweetingsherry #phpuk17 require_once dirname(__DIR__).'/vendor/autoload.php'; <?php /wp-config.php Dotenv::load('.env');
 
 Dotenv::required(['DB_NAME', 'DB_USER', 'DB_PASSWORD', 'WP_HOME', 'WP_SITEURL']); define('DB_NAME', $_SERVER['DB_NAME']));
 define('DB_USER', $_ENV['DB_USER']);
 define('DB_PASSWORD', getenv('DB_PASSWORD'));
 define('DB_HOST', getenv('DB_HOST')); ...
  158. 158. @tweetingsherry #phpuk17 /.env /wordpress
 /wp-content/uploads/* 
 ...
 /.gitignore
  159. 159. @tweetingsherry #phpuk17 Easy to locate and update
  160. 160. @tweetingsherry #phpuk17 Easy to locate and update Per environment configuration
  161. 161. @tweetingsherry #phpuk17 Easy to locate and update Per environment configuration Not in source control
  162. 162. @tweetingsherry #phpuk17 Easy to locate and update Per environment configuration Not in source control Ready for open source
  163. 163. @tweetingsherry #phpuk17 Easy to locate and update Per environment configuration Not in source control Ready for open source Easy to store outside of webroot
  164. 164. @tweetingsherry #phpuk17 index.php wp-config.php wordpress wp-content composer.json composer.lock.gitignore.git.env vendor
  165. 165. @tweetingsherry #phpuk17 index.php wp-config.php wordpress wp-content composer.json composer.lock.gitignore.git.env server { ... root /var/www/site ... /etc/nginx/sites-enabled/vhost.conf vendor
  166. 166. @tweetingsherry #phpuk17 index.php wp-config.php wordpress wp-content composer.json composer.lock.gitignore.git.env web server { ... root /var/www/site ... /etc/nginx/sites-enabled/vhost.conf /web vendor
  167. 167. @tweetingsherry #phpuk17 composer.json composer.lock.gitignore.git.env web server { ... root /var/www/site ... /etc/nginx/sites-enabled/vhost.conf /web vendor
  168. 168. @tweetingsherry #phpuk17 index.php wp-config.php wordpress wp-content composer.json composer.lock.gitignore.git.env web vendor
  169. 169. @tweetingsherry #phpuk17 Only keeping what we need in version control
  170. 170. @tweetingsherry #phpuk17 Only keeping what we need in version control Dependencies managed
  171. 171. @tweetingsherry #phpuk17 Only keeping what we need in version control Dependencies managed Backups of uploads & databases
  172. 172. @tweetingsherry #phpuk17 Only keeping what we need in version control Dependencies managed Backups of uploads & databases Isolated configuration for environments
  173. 173. @tweetingsherry #phpuk17 Only keeping what we need in version control Dependencies managed Backups of uploads & databases Isolated configuration for environments
  174. 174. @tweetingsherry #phpuk17
  175. 175. @tweetingsherry #phpuk17
  176. 176. @tweetingsherry #phpuk17 roots.io/bedrock
  177. 177. @tweetingsherry #phpuk17 I DONT ALWAYS USE BEDROCK
  178. 178. @tweetingsherry #phpuk17 Only keeping what we need in version control Dependencies managed Backups of uploads & databases Isolated configuration for environments Active open source community
  179. 179. @tweetingsherry #phpuk17 index.php wp-config.php wordpress wp-content composer.json composer.lock.gitignore.git.env web vendor
  180. 180. @tweetingsherry #phpuk17 index.php wp-config.php wordpress wp-content composer.json composer.lock.gitignore.git.env web vendor
  181. 181. @tweetingsherry #phpuk17 index.php wp-config.php wp app composer.json composer.lock.gitignore.git.env web vendor
  182. 182. @tweetingsherry #phpuk17 /composer.json
  183. 183. @tweetingsherry #phpuk17 /composer.json{ ..., "extra": {
 "installer-paths": {
 "web/app/plugins/{$name}/": ["type:wordpress-plugin"],
 "web/app/themes/{$name}/": ["type:wordpress-theme"]
 }, "wordpress-install-dir": "wp"
 }
 } }
  184. 184. @tweetingsherry #phpuk17 index.php wp-config.php composer.json composer.lock.gitignore.git.env web vendor wp app
  185. 185. @tweetingsherry #phpuk17 index.php wp-config.php composer.json composer.lock.gitignore.git.env web vendor wp-contentwp app
  186. 186. @tweetingsherry #phpuk17 Virtual Machines
  187. 187. @tweetingsherry #phpuk17 vagrantup.com
  188. 188. @tweetingsherry #phpuk17 Virtual Machine (Virtual Server)
  189. 189. @tweetingsherry #phpuk17 Host Machine Virtual Machine (Virtual Server)
  190. 190. @tweetingsherry #phpuk17 PHP 7.1 Host Machine
  191. 191. @tweetingsherry #phpuk17 PHP 7.1 Host Machine
  192. 192. @tweetingsherry #phpuk17 PHP 7.1 Host Machine PHP 7.1 Remote Server A
  193. 193. @tweetingsherry #phpuk17 PHP 7.1 Host Machine PHP 7.1 Remote Server A
  194. 194. @tweetingsherry #phpuk17 Remote Server B PHP 5.2 PHP 7.1 Host Machine PHP 7.1 Remote Server A
  195. 195. @tweetingsherry #phpuk17 Remote Server B PHP 5.2 PHP 7.1 Host Machine PHP 7.1 Remote Server A FatalErrorException
  196. 196. @tweetingsherry #phpuk17 Virtual Machine A Remote Server A Remote Server BVirtual Machine B PHP 7.1 PHP 5.2 PHP 7.1 PHP 5.2
  197. 197. @tweetingsherry #phpuk17 Host machine uncluttered
  198. 198. @tweetingsherry #phpuk17 Host machine uncluttered Software versions contained
  199. 199. @tweetingsherry #phpuk17 Host machine uncluttered Software versions contained Similar as possible to production
  200. 200. @tweetingsherry #phpuk17 Host machine uncluttered Software versions contained Similar as possible to production Shared filesystem runs slow
  201. 201. @tweetingsherry #phpuk17 Host machine uncluttered Software versions contained Similar as possible to production Shared filesystem runs slow Memory hungry
  202. 202. @tweetingsherry #phpuk17 WHY IS THE RAM ALWAYS GONE
  203. 203. @tweetingsherry #phpuk17 Provisioning
  204. 204. @tweetingsherry #phpuk17 ansible.com
  205. 205. @tweetingsherry #phpuk17
  206. 206. @tweetingsherry #phpuk17 php 7.1
  207. 207. @tweetingsherry #phpuk17 php 7.1 php 7.1
  208. 208. @tweetingsherry #phpuk17 php 7.1 php 7.1 php 7.1
  209. 209. @tweetingsherry #phpuk17 php 7.1 php 7.1 php 7.1 php 7.1
  210. 210. @tweetingsherry #phpuk17 Provision servers with single command
  211. 211. @tweetingsherry #phpuk17 Provision servers with single command Descriptive configurations
  212. 212. @tweetingsherry #phpuk17 Provision servers with single command Descriptive configurations Idempotency (same when repeated)
  213. 213. @tweetingsherry #phpuk17 Provision servers with single command Descriptive configurations Idempotency (same when repeated) Reproducable servers
  214. 214. @tweetingsherry #phpuk17 roots.io/trellis
  215. 215. @tweetingsherry #phpuk17 Multisite, wp-cli, etc
  216. 216. @tweetingsherry #phpuk17 Multisite, wp-cli, etc Deploy script with build hooks
  217. 217. @tweetingsherry #phpuk17 Multisite, wp-cli, etc Deploy script with build hooks Active open source community
  218. 218. @tweetingsherry #phpuk17 Multisite, wp-cli, etc Deploy script with build hooks Active open source community Usually does more than you need
  219. 219. @tweetingsherry #phpuk17 Multisite, wp-cli, etc Deploy script with build hooks Active open source community Usually does more than you need Fiddly to update
  220. 220. @tweetingsherry #phpuk17 ~/site $ git remote add upstream https://github.com/ roots/trellis.git
  221. 221. @tweetingsherry #phpuk17 ~/site $ git remote add upstream https://github.com/ roots/trellis.git ~/site $ git remote -v origin git@github.com:chrissherry/site.git (fetch) origin git@github.com:chrissherry/site.git (push) upstream git@github.com:roots/trellis.git (fetch)
  222. 222. @tweetingsherry #phpuk17 ~/site $ git fetch upstream master ~/site $ git merge -X subtree=trellis --squash upstream/master
  223. 223. @tweetingsherry #phpuk17 MERGE CONFLICTS MERGE CONFLICTS EVERYWHERE
  224. 224. @tweetingsherry #phpuk17 roots.io/trellis
  225. 225. @tweetingsherry #phpuk17
  226. 226. @tweetingsherry #phpuk17 Autoloading
  227. 227. @tweetingsherry #phpuk17 require_once dirname(__DIR__).'/vendor/autoload.php'; <?php /wp-config.php
  228. 228. @tweetingsherry #phpuk17
  229. 229. @tweetingsherry #phpuk17
  230. 230. @tweetingsherry #phpuk17
  231. 231. @tweetingsherry #phpuk17
  232. 232. @tweetingsherry #phpuk17
  233. 233. @tweetingsherry #phpuk17
  234. 234. @tweetingsherry #phpuk17
  235. 235. @tweetingsherry #phpuk17 ~ ChrisSherry $ WordPress for the modern PHP developer
  236. 236. @tweetingsherry #phpuk17 ~ ChrisSherry $ WordPress for the modern PHP developer
  237. 237. @tweetingsherry #phpuk17 You’re awesome Thank you
  238. 238. @tweetingsherry #phpuk17 Next Talks Serving 30,000,000 Requests an Hour in the Cloud The road to continuous deployment: a case study It's all about the goto Terrence Ryan Michiel Rook Derick Rethans Main Track Sidetrack 1 Sidetrack 2

×