Download - WordPress for the modern PHP developer
@tweetingsherry #phpuk17
~ ChrisSherry $ WordPress for the modern PHP developer
@tweetingsherry #phpuk17
~ ChrisSherry $ WordPress for the modern PHP developer
@tweetingsherry #phpuk17
~ ChrisSherry $ WordPress for the modern PHP developer
@tweetingsherry #phpuk17
@tweetingsherry #phpuk17
@tweetingsherry #phpuk17
@tweetingsherry #phpuk17
@tweetingsherry #phpuk17
@tweetingsherry #phpuk17
@tweetingsherry #phpuk17
@tweetingsherry #phpuk17
@tweetingsherry #phpuk17
Version Control
@tweetingsherry #phpuk17
See who changed what, when
@tweetingsherry #phpuk17
See who changed what, whenMultiple people working on the same files simultaneously
@tweetingsherry #phpuk17
See who changed what, whenMultiple people working on the same files simultaneouslyWork on features in parallel
@tweetingsherry #phpuk17
See who changed what, whenMultiple people working on the same files simultaneouslyWork on features in parallelRoll back to previous versions
@tweetingsherry #phpuk17
See who changed what, whenMultiple people working on the same files simultaneouslyWork on features in parallelRoll back to previous versionsGo home on time
@tweetingsherry #phpuk17
ALL THE THINGS
~/site $ git init ~/site $ git add —-all
@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
@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
@tweetingsherry #phpuk17
@tweetingsherry #phpuk17
Our users can change our codebase using the editor tool
@tweetingsherry #phpuk17
... define('DISALLOW_FILE_EDIT', true);
/wp-config.php
@tweetingsherry #phpuk17
... define('DISALLOW_FILE_EDIT', true);
/wp-config.php
define('AUTOMATIC_UPDATER_DISABLED', true);
@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
@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
@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
@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
@tweetingsherry #phpuk17
.git index.php wp-config.phpwordpress
@tweetingsherry #phpuk17
.git index.php wp-config.phpwordpress
@tweetingsherry #phpuk17
.git index.php wp-config.phpwordpress
@tweetingsherry #phpuk17
.git index.php wp-config.phpwordpress
@tweetingsherry #phpuk17
.git index.php wp-config.phpwordpress
@tweetingsherry #phpuk17
if (!defined('ABSPATH')) { define(
'ABSPATH', dirname(__FILE__) . '/'
);}
/wp-config.php...
@tweetingsherry #phpuk17
if (!defined('ABSPATH')) { define(
'ABSPATH', dirname(__FILE__) . '/wordpress/'
); }
/wp-config.php...
@tweetingsherry #phpuk17
option_value https://site.com https://site.com WordPress Just another WordPress site ...
option_name siteurl
home blogname
blogdescription ...
wp_options
@tweetingsherry #phpuk17
option_value https://site.com https://site.com WordPress Just another WordPress site ...
/wordpressoption_name
siteurl home
blogname blogdescription
...
wp_options
@tweetingsherry #phpuk17
.git index.php wp-config.phpwordpress
@tweetingsherry #phpuk17
.git index.php wp-config.phpwordpress
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
@tweetingsherry #phpuk17
.git index.php wp-config.phpwordpress
wp-comments- post.php
wp-config- sample.php
wp-content wp-cron.php
index.php
wp-includes
plugins themes
wp-links-opml.php wp-load.php wp-login.php
@tweetingsherry #phpuk17
.git index.php wp-config.phpwordpress
wp-comments- post.php
wp-config- sample.php
wp-content wp-cron.php
index.php
wp-includes
plugins themes
wp-links-opml.php wp-load.php wp-login.php
index.php hello.php
@tweetingsherry #phpuk17
.git index.php wp-config.phpwordpress
wp-comments- post.php
wp-config- sample.php
wp-content wp-cron.php
index.php
wp-includes
plugins themes
wp-links-opml.php wp-load.php wp-login.php
index.php twentyeleven twentytwelve twentythirteen twentyfourteen twentyfifiteen twentysixteen
@tweetingsherry #phpuk17
.git index.php wp-config.phpwordpress
wp-comments- post.php
wp-config- sample.php
wp-content wp-cron.php
index.php
wp-includes
plugins themes
wp-links-opml.php wp-load.php wp-login.php
wp-content
index.php twentyeleven twentytwelve twentythirteen twentyfourteen twentyfifiteen twentysixteen
@tweetingsherry #phpuk17
.git index.php wp-config.phpwordpress wp-content
plugins themes
@tweetingsherry #phpuk17
.git index.php wp-config.phpwordpress wp-content
plugins themes
advanced-custom-fields debug-bar awesome-plugin
@tweetingsherry #phpuk17
define( 'WP_CONTENT_DIR', $_SERVER['DOCUMENT_ROOT'] . '/wp-content' ); define( 'WP_CONTENT_URL', '/wp-content' );
/wp-config.php...
@tweetingsherry #phpuk17
.git index.php wp-config.phpwordpress wp-content
@tweetingsherry #phpuk17
.git index.php wp-config.phpwordpress wp-content
core code
@tweetingsherry #phpuk17
.git index.php wp-config.phpwordpress wp-content
core code application code
@tweetingsherry #phpuk17
YOU MADE A NEW FOLDER
I’M GLAD I CHOSE THIS TRACK
@tweetingsherry #phpuk17
GENE WILDER 1933-2016
@tweetingsherry #phpuk17
.git index.php wp-config.phpwordpress wp-content
@tweetingsherry #phpuk17
.git index.php wp-config.phpwordpress wp-content.gitignore
@tweetingsherry #phpuk17
/.DS_Store
/wordpress
/.gitignore
@tweetingsherry #phpuk17
~ $ git clone https://github.com/chrissherry/site
@tweetingsherry #phpuk17
~ $ git clone https://github.com/chrissherry/site
.git index.php wp-config.php wp-content.gitignore
@tweetingsherry #phpuk17
~ $ git clone https://github.com/chrissherry/site
.git index.php wp-config.php wp-content.gitignore
@tweetingsherry #phpuk17
Dependency Management
@tweetingsherry #phpuk17
@tweetingsherry #phpuk17
&
@tweetingsherry #phpuk17
@tweetingsherry #phpuk17
@tweetingsherry #phpuk17
github.com/johnpbloch/wordpress
@tweetingsherry #phpuk17
github.com/johnpbloch/wordpress
@tweetingsherry #phpuk17
@tweetingsherry #phpuk17
Default
type:library
/vendor/[vendor]/[name]
@tweetingsherry #phpuk17
Default
type:library
/vendor/[vendor]/[name]
Custom
type: wordpress-core
/wordpress
@tweetingsherry #phpuk17
~/site $ composer require johnpbloch/wordpress
~/site $ composer init
~/site $ composer install
@tweetingsherry #phpuk17
~/site $ composer require johnpbloch/wordpress
{ "require": { "johnpbloch/wordpress": "^4.5"}
}
/composer.json
~/site $ composer init
~/site $ composer install
@tweetingsherry #phpuk17
index.php wp-config.phpwordpress wp-contentcomposer.json composer.lock.gitignore
@tweetingsherry #phpuk17
index.php wp-config.phpwordpress wp-contentcomposer.json composer.lock.gitignore
@tweetingsherry #phpuk17
index.php wp-config.phpwordpress wp-contentcomposer.json composer.lock.gitignore
@tweetingsherry #phpuk17
index.php wp-config.phpwordpress wp-contentcomposer.json composer.lock.gitignore
@tweetingsherry #phpuk17
index.php wp-config.phpwordpress wp-contentcomposer.json composer.lock.gitignore
@tweetingsherry #phpuk17
index.php wp-config.phpwordpress wp-content
plugins themes
advanced-custom-fields
composer.json composer.lock.gitignore
debug-bar awesome-plugin
@tweetingsherry #phpuk17
wpackagist.org
@tweetingsherry #phpuk17
wpackagist.org
type: wordpress-plugin /wp-content/plugins type: wordpress-theme /wp-content/themes
Custom
@tweetingsherry #phpuk17
.git index.php wp-config.phpwordpress wp-content
plugins themes
@tweetingsherry #phpuk17
github.com/composer/installers
@tweetingsherry #phpuk17
{ "require": { "johnpbloch/wordpress": "^4.5", "wpackagist-plugin/advanced-custom-fields": "~4.4"}
}
/composer.json
@tweetingsherry #phpuk17
https://wordpress.org/plugins/advanced-custom-fields
@tweetingsherry #phpuk17
https://wordpress.org/plugins/advanced-custom-fields
@tweetingsherry #phpuk17
https://wordpress.org/plugins/advanced-custom-fields
@tweetingsherry #phpuk17
https://wordpress.org/plugins/advanced-custom-fields
@tweetingsherry #phpuk17
{ "require": { "johnpbloch/wordpress": "^4.5", "wpackagist-plugin/advanced-custom-fields": "4.4"}
}
/composer.json
@tweetingsherry #phpuk17
{ "require": { "johnpbloch/wordpress": "^4.5", "wpackagist-plugin/advanced-custom-fields": "4.4"}
}
/composer.json
@tweetingsherry #phpuk17
/composer.json{ "require": { "johnpbloch/wordpress": "^4.5", "wpackagist-plugin/advanced-custom-fields": "4.4"}, "repositories": [ { "type": "composer", "url": "https://wpackagist.org" } ]
}
@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
@tweetingsherry #phpuk17
index.php wp-config.phpwordpress wp-content
plugins themes
advanced- custom-fields
composer.json composer.lock.gitignore
awesome-plugindebug-bar
@tweetingsherry #phpuk17
index.php wp-config.phpwordpress wp-content
plugins themes
advanced- custom-fields
composer.json composer.lock.gitignore
awesome-plugindebug-bar
@tweetingsherry #phpuk17
/wordpress/wp-content/plugins/* !/wp-content/plugins/.gitkeep
/.gitignore
@tweetingsherry #phpuk17
index.php wp-config.phpwordpress wp-content
plugins themes
advanced- custom-fields
composer.json composer.lock.gitignore
awesome-plugindebug-bar
@tweetingsherry #phpuk17
index.php wp-config.phpwordpress wp-content
plugins themes
advanced- custom-fields
composer.json composer.lock.gitignore
awesome-plugindebug-bar
@tweetingsherry #phpuk17
/wordpress/wp-content/plugins/*!/wp-content/plugins/.gitkeep !/wp-content/plugins/awesome-plugin
/.gitignore
@tweetingsherry #phpuk17
@tweetingsherry #phpuk17
github.com/chrissherry/awesome-plugin
@tweetingsherry #phpuk17
github.com/chrissherry/awesome-plugin
@tweetingsherry #phpuk17
chrissherry/awesome-plugin v1.0
v2.0
TAGS v1.0 (awesome)v2.0 (more awesome!) Site B
Site AGithub
@tweetingsherry #phpuk17
github.com/chrissherry/awesome-plugin
@tweetingsherry #phpuk17
github.com/chrissherry/awesome-plugin
@tweetingsherry #phpuk17
github.com/chrissherry/awesome-plugin/composer.json
@tweetingsherry #phpuk17
github.com/chrissherry/awesome-plugin/composer.json
@tweetingsherry #phpuk17
github.com/chrissherry/awesome-plugin/composer.json
@tweetingsherry #phpuk17
{ "require": { {...}, "chrissherry/awesome-plugin": "~1.0" }
/composer.json
@tweetingsherry #phpuk17
{ "require": { {...}, "chrissherry/awesome-plugin": "~1.0" } , "repositories": [ {...},
{ "type": "vcs", "url": "https://github.com/chrissherry/awesome-p..." }
] }
/composer.json
@tweetingsherry #phpuk17
index.php wp-config.phpwordpress wp-content
plugins themes
advanced-custom-fields
composer.json composer.lock.gitignore
awesome-plugindebug-bar
@tweetingsherry #phpuk17
index.php wp-config.phpwordpress wp-content
plugins themes
composer.json composer.lock.gitignore
awesome-theme
@tweetingsherry #phpuk17
index.php wp-config.phpwordpress wp-content
plugins themes
composer.json composer.lock.gitignore
awesome-theme storefront sydney twentysixteen
@tweetingsherry #phpuk17
/wordpress/wp-content/plugins/* !/wp-content/plugins/.gitkeep
/.gitignore
@tweetingsherry #phpuk17
/wordpress/wp-content/plugins/* !/wp-content/plugins/.gitkeep
/.gitignore
/wp-content/themes/* !/wp-content/themes/.gitkeep
@tweetingsherry #phpuk17
/wordpress/wp-content/plugins/* !/wp-content/plugins/.gitkeep
/.gitignore
/wp-content/themes/* !/wp-content/themes/.gitkeep!/wp-content/themes/awesome-theme
@tweetingsherry #phpuk17
/wordpress/wp-content/plugins/* !/wp-content/plugins/.gitkeep
/.gitignore
@tweetingsherry #phpuk17
ONE DOES NOT SIMPLY
CLICK TO UPDATE THINGS
@tweetingsherry #phpuk17
{ "require": { ..., "wpackagist-plugin/members": "1.1.3" },
"repositories":[...] }
/composer.json
~/site $ composer require wpackagist-plugin/members
@tweetingsherry #phpuk17
Defined versions for dependancies
@tweetingsherry #phpuk17
Defined versions for dependanciesLess third party code in the repository
@tweetingsherry #phpuk17
Defined versions for dependanciesLess third party code in the repositoryGreater reliance on 3rd party availability
@tweetingsherry #phpuk17
Uploads
@tweetingsherry #phpuk17
Uploads
@tweetingsherry #phpuk17
/wordpress
/wp-content/uploads/* /wp-content/plugins/*!/wp-content/plugins/.gitkeep
...
/.gitignore
@tweetingsherry #phpuk17
s3tools.org/s3cmd
@tweetingsherry #phpuk17
github.com/humanmade/s3-uploads
@tweetingsherry #phpuk17
~/site $ composer require hadyfayed/s3-uploads
{ "require": { ..., "hadyfayed/s3-uploads": "2.0" },
"repositories":[...] }
/composer.json
@tweetingsherry #phpuk17
~/site $ rsync -avz [email protected]:/var/www/mysite/wp-content/uploads wp-content/uploads
@tweetingsherry #phpuk17
Smaller repository -don’t need version control over uploads
@tweetingsherry #phpuk17
Smaller repository -don’t need version control over uploadsFaster clone and deploy times
@tweetingsherry #phpuk17
Smaller repository -don’t need version control over uploadsFaster clone and deploy timesRemote backups of our uploads
@tweetingsherry #phpuk17
Databases
@tweetingsherry #phpuk17
prod:~/site $ mysqldump -u user -p dbname > db.sql
~/site $ scp [email protected]:site/db.sql db.sql
~/site $ mysql -u user -p dbname < db.sql
@tweetingsherry #phpuk17
Environments
@tweetingsherry #phpuk17
option_name siteurl
home blogname
blogdescription ...
option_value https://site.com/wordpress https://site.com WordPress Just another WordPress site ...
wp_options
@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
@tweetingsherry #phpuk17
...
...
define('WP_HOME', 'https://site.com'); define('WP_SITEURL', 'https://site.com/wordpress');
/wp-config.php
@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...
...
@tweetingsherry #phpuk17
server { listen 443; server_name staging.site.com; env WP_ENV=staging ...
/etc/nginx/sites-enabled/vhost.conf
@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
@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.…
@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
...
@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
@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
@tweetingsherry #phpuk17
KEEP IT SAFE
KEEP IT SECRET
@tweetingsherry #phpuk17
@tweetingsherry #phpuk17
@tweetingsherry #phpuk17
github.com/vlucas/phpdotenv
@tweetingsherry #phpuk17
{ "require": { {...} "vlucas/phpdotenv": "^1.0" }, ...
}
/composer.json
~/site $ composer require vlucas/phpdotenv
@tweetingsherry #phpuk17
index.php
wp-config.php
wordpress
wp-content
composer.json composer.lock.gitignore.git.env
vendor
@tweetingsherry #phpuk17
index.php
wp-config.php
wordpress
wp-content
composer.json composer.lock.gitignore.git.env
vendor
@tweetingsherry #phpuk17
index.php
wp-config.php
wordpress
wp-content
composer.json composer.lock.gitignore.git.env
vendor
@tweetingsherry #phpuk17
DB_NAME=dbnameDB_USER=userDB_PASSWORD=correcthorsebatterystapleDB_HOST=localhost WP_ENV=developmentWP_HOME=https://site.comWP_SITEURL=https://site.com/wordpress
/.env
@tweetingsherry #phpuk17
DB_NAME=dbnameDB_USER=userDB_PASSWORD=correcthorsebatterystapleDB_HOST=localhost WP_ENV=developmentWP_HOME=https://site.comWP_SITEURL=https://site.com/wordpress
/.env
@tweetingsherry #phpuk17
require_once dirname(__DIR__).'/vendor/autoload.php';<?php /wp-config.php
@tweetingsherry #phpuk17
require_once dirname(__DIR__).'/vendor/autoload.php';<?php /wp-config.php
Dotenv::load('.env');
@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’)); ...
@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’)); ...
@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')); ...
@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')); ...
@tweetingsherry #phpuk17
/.env
/wordpress
/wp-content/uploads/* ...
/.gitignore
@tweetingsherry #phpuk17
Easy to locate and update
@tweetingsherry #phpuk17
Easy to locate and updatePer environment configuration
@tweetingsherry #phpuk17
Easy to locate and updatePer environment configurationNot in source control
@tweetingsherry #phpuk17
Easy to locate and updatePer environment configurationNot in source controlReady for open source
@tweetingsherry #phpuk17
Easy to locate and updatePer environment configurationNot in source controlReady for open sourceEasy to store outside of webroot
@tweetingsherry #phpuk17
index.php
wp-config.php
wordpress
wp-content
composer.json composer.lock.gitignore.git.env
vendor
@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
@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
@tweetingsherry #phpuk17
composer.json composer.lock.gitignore.git.env web
server { ... root /var/www/site ...
/etc/nginx/sites-enabled/vhost.conf
/web
vendor
@tweetingsherry #phpuk17
index.php wp-config.php wordpress wp-content
composer.json composer.lock.gitignore.git.env web vendor
@tweetingsherry #phpuk17
Only keeping what we need in version control
@tweetingsherry #phpuk17
Only keeping what we need in version controlDependencies managed
@tweetingsherry #phpuk17
Only keeping what we need in version controlDependencies managedBackups of uploads & databases
@tweetingsherry #phpuk17
Only keeping what we need in version controlDependencies managedBackups of uploads & databasesIsolated configuration for environments
@tweetingsherry #phpuk17
Only keeping what we need in version controlDependencies managedBackups of uploads & databasesIsolated configuration for environments
@tweetingsherry #phpuk17
@tweetingsherry #phpuk17
@tweetingsherry #phpuk17
roots.io/bedrock
@tweetingsherry #phpuk17
I DONT ALWAYS USE BEDROCK
@tweetingsherry #phpuk17
Only keeping what we need in version control Dependencies managed Backups of uploads & databases Isolated configuration for environmentsActive open source community
@tweetingsherry #phpuk17
index.php wp-config.php wordpress wp-content
composer.json composer.lock.gitignore.git.env web vendor
@tweetingsherry #phpuk17
index.php wp-config.php wordpress wp-content
composer.json composer.lock.gitignore.git.env web vendor
@tweetingsherry #phpuk17
index.php wp-config.php wp app
composer.json composer.lock.gitignore.git.env web vendor
@tweetingsherry #phpuk17
/composer.json
@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" } } }
@tweetingsherry #phpuk17
index.php wp-config.php
composer.json composer.lock.gitignore.git.env web vendor
wp app
@tweetingsherry #phpuk17
index.php wp-config.php
composer.json composer.lock.gitignore.git.env web vendor
wp-contentwp app
@tweetingsherry #phpuk17
Virtual Machines
@tweetingsherry #phpuk17
vagrantup.com
@tweetingsherry #phpuk17
Virtual Machine(Virtual Server)
@tweetingsherry #phpuk17
Host MachineVirtual Machine(Virtual Server)
@tweetingsherry #phpuk17
PHP 7.1
Host Machine
@tweetingsherry #phpuk17
PHP 7.1
Host Machine
@tweetingsherry #phpuk17
PHP 7.1
Host Machine
PHP 7.1
Remote Server A
@tweetingsherry #phpuk17
PHP 7.1
Host Machine
PHP 7.1
Remote Server A
@tweetingsherry #phpuk17
Remote Server B
PHP 5.2
PHP 7.1
Host Machine
PHP 7.1
Remote Server A
@tweetingsherry #phpuk17
Remote Server B
PHP 5.2
PHP 7.1
Host Machine
PHP 7.1
Remote Server A
FatalErrorException
@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
@tweetingsherry #phpuk17
Host machine uncluttered
@tweetingsherry #phpuk17
Host machine unclutteredSoftware versions contained
@tweetingsherry #phpuk17
Host machine unclutteredSoftware versions containedSimilar as possible to production
@tweetingsherry #phpuk17
Host machine unclutteredSoftware versions containedSimilar as possible to productionShared filesystem runs slow
@tweetingsherry #phpuk17
Host machine unclutteredSoftware versions containedSimilar as possible to productionShared filesystem runs slowMemory hungry
@tweetingsherry #phpuk17
WHY IS THE RAM
ALWAYS GONE
@tweetingsherry #phpuk17
Provisioning
@tweetingsherry #phpuk17
ansible.com
@tweetingsherry #phpuk17
@tweetingsherry #phpuk17
php 7.1
@tweetingsherry #phpuk17
php 7.1php 7.1
@tweetingsherry #phpuk17
php 7.1
php 7.1
php 7.1
@tweetingsherry #phpuk17
php 7.1
php 7.1php 7.1
php 7.1
@tweetingsherry #phpuk17
Provision servers with single command
@tweetingsherry #phpuk17
Provision servers with single commandDescriptive configurations
@tweetingsherry #phpuk17
Provision servers with single commandDescriptive configurationsIdempotency (same when repeated)
@tweetingsherry #phpuk17
Provision servers with single commandDescriptive configurationsIdempotency (same when repeated)Reproducable servers
@tweetingsherry #phpuk17
roots.io/trellis
@tweetingsherry #phpuk17
Multisite, wp-cli, etc
@tweetingsherry #phpuk17
Multisite, wp-cli, etcDeploy script with build hooks
@tweetingsherry #phpuk17
Multisite, wp-cli, etcDeploy script with build hooksActive open source community
@tweetingsherry #phpuk17
Multisite, wp-cli, etcDeploy script with build hooksActive open source communityUsually does more than you need
@tweetingsherry #phpuk17
Multisite, wp-cli, etcDeploy script with build hooksActive open source communityUsually does more than you needFiddly to update
@tweetingsherry #phpuk17
~/site $ git remote add upstream https://github.com/ roots/trellis.git
@tweetingsherry #phpuk17
~/site $ git remote add upstream https://github.com/ roots/trellis.git
~/site $ git remote -v origin [email protected]:chrissherry/site.git (fetch) origin [email protected]:chrissherry/site.git (push) upstream [email protected]:roots/trellis.git (fetch)
@tweetingsherry #phpuk17
~/site $ git fetch upstream master
~/site $ git merge -X subtree=trellis --squash upstream/master
@tweetingsherry #phpuk17
MERGE CONFLICTS
MERGE CONFLICTS EVERYWHERE
@tweetingsherry #phpuk17
roots.io/trellis
@tweetingsherry #phpuk17
@tweetingsherry #phpuk17
Autoloading
@tweetingsherry #phpuk17
require_once dirname(__DIR__).'/vendor/autoload.php';<?php
/wp-config.php
@tweetingsherry #phpuk17
@tweetingsherry #phpuk17
@tweetingsherry #phpuk17
@tweetingsherry #phpuk17
@tweetingsherry #phpuk17
@tweetingsherry #phpuk17
@tweetingsherry #phpuk17
@tweetingsherry #phpuk17
~ ChrisSherry $ WordPress for the modern PHP developer
@tweetingsherry #phpuk17
~ ChrisSherry $ WordPress for the modern PHP developer
@tweetingsherry #phpuk17 You’re awesome
Thank you
@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