The document discusses the modern developer toolbox and outlines various tools that developers can use for development environments, testing, debugging, profiling, deployment, logging, and monitoring of applications. It provides recommendations for setting up development environments on different operating systems and with tools like Vagrant, Docker, Ansible, and Homebrew. It also discusses PHP installation and editors/IDEs to use. Testing with PHPUnit, Behat, and Jenkins is covered as well as debugging with XDebug, profiling with XHProf, and deployment with Ansible, Capistrano and other options. Logging with Monolog, Logstash and Kibana is also summarized along with monitoring metrics with StatsD, Graphite and Grafana.
28. The Development Modern Developer Environment
Toolbox
Automate your setup
!
#1 Store your dot-files in Git/GitHub
29. The Development Modern Developer Environment
Toolbox
Dot files
.profile / .bash_profile / .bashrc
.gitconfig
.gitignores
.ssh/config
https://github.com/pgodel/dotfiles
https://github.com/everzet/dotfiles
30. The Development Modern Developer Environment
Toolbox
Automate your setup
!
#2 Automate your software installation
31. The Development Modern Developer Environment
Toolbox
Homebrew!
!
• hhvm
• wget
• git
• tmux
• ssh-copy-id
• brew-cask
• ansible
32. The Modern Developer Toolbox
Even .dmg’s!
!
$ brew cask install …
!
Development Environment
• google-chrome
• vagrant
• virtualbox
• iterm2
• alfred
• phpstorm
!
https://github.com/caskroom/homebrew-cask
33. The Development Modern Developer Environment
Toolbox
Installing PHP
Run Linux natively / locally
!
• REMI repo for CentOS
• PPAs for Ubuntu / Debian
34. The Development Modern Developer Environment
Toolbox
Installing PHP
Run Linux on VPS / remote
!
• REMI repo for CentOS
• PPAs for Ubuntu / Debian
35. The Development Modern Developer Environment
Toolbox
Installing PHP
Mac OSX
!
• MAMP
• Liip PHP installer
36. The Development Modern Developer Environment
Toolbox
Installing PHP
Virtual Machine
• VirtualBox / Parallels / VMware
• Vagrant
• Docker
37. The Development Modern Developer Environment
Toolbox
PHARS!
!
• Composer
• PHPUnit
• behat
• WP-CLI
• versionscan
39. ThDe eMvoeldoeprmn eDnetv Eenlovpireorn Tmooelnbtox
Vagrant
Host
Vagrant
VM VM VM
Web
DB
Server
Server
App
Server
40. ThDe eMvoeldoeprmn eDnetv Eenlovpireorn Tmooelnbtox
Docker
Host
Docker client
C
VM
Web
Server
C C
DB
Server
App
Server
41. ThDe eMvoeldoeprmn eDnetv Eenlovpireorn Tmooelnbtox
Docker
Host
Docker client
C
VM
Web
Server
C C
DB
Server
App
Server
42. ThDe eMvoeldoeprmn eDnetv Eenlovpireorn Tmooelnbtox
Docker
Host
Docker client
C
VM
Web
Server
C C
DB
Server
App
Server
43. ThDe eMvoeldoeprmn eDnetv Eenlovpireorn Tmooelnbtox
Docker
Host
Docker client
C
VM
Web
Server
C C
DB
Server
App
Server
Host
C
VM
Web
Server
C C
DB
Server
App
Server
44. ThDe eMvoeldoeprmn eDnetv Eenlovpireorn Tmooelnbtox
Docker
Host
Docker client
C
VM
Web
Server
C C
DB
Server
App
Server
Host
C
VM
Web
Server
Host
C C
DB
Server
C C
App
Server
C
Web
Server
DB
Server
App
Server
Docker
Kernel
45. The Development Modern Developer Environment
Toolbox
$ ansible-playbook -i inventories/dev
playbook.yml -v -K
https://github.com/pgodel/ansible-local-dev
47. The Development Modern Developer Environment
Toolbox
Choose the right Editor/IDE for you!
!
• PHPStorm
• Zend Studio
• TextMate
• Vim
48. The Development Modern Developer Environment
Toolbox
Choose the right Editor/IDE for you!
!
• PHPStorm!
• Zend Studio
• TextMate
• Vim
49. The Development Modern Developer Environment
Toolbox
Choose the right Editor/IDE for you!
!
• PHPStorm!
• Fast
• Syntax highlighting with PHP 5.6
• Git diffs and other actions
• Breakpoints
• and much more!
!
!
50. Development Environment
Setting up SSH
$ ssh-keygen -t dsa
~/.ssh/id_dsa.pub
!
$ ssh-copy-id user@remote-host
~/.ssh/authorized_keys
~/.ssh/authorized_keys2
!
$ ssh-add
51. Development Environment
Setting up SSH
~/.ssh/config
Host *
ForwardAgent yes
Port 22123
!
Host gh
HostName github.com
Port 22
PreferredAuthentications publickey
IdentityFile ~/.ssh/me_rsa
52. Development Environment
Virtual Document Root
UseCanonicalName Off
!
VirtualDocumentRoot /var/www/vhosts/%0/web
!
<Location /var/www/vhosts>
AllowOverride All
Options +FollowSymLinks
</Location>
example.com => /var/www/vhosts/example.com/web
example2.com => /var/www/vhosts/example2.com/web
88. Deployment
Effing Package Management
Build packages for multiple platforms (deb, rpm, etc) with great ease and sanity.
fpm -s dir -t rpm -n "webapp" -v 1.0 /var/www/webapp
!
fpm -s dir -t deb -a all -n webapp -v 1.0 /etc/apache2/
conf.d/my.conf /var/www/webapp
https://github.com/jordansissel/fpm
93. Monolog
Logging
use MonologLogger;
use MonologHandlerStreamHandler;
!
// create a log channel
$log = new Logger('name');
$log->pushHandler(new StreamHandler('path/to/your.log',
Logger::WARNING));
!
// add records to the log
$log->addWarning('Foo');
$log->addError('Bar');
101. Monitoring
StatsD + liuggio/statsd-php-client
$sender = new SocketSender(/*'localhost', 8126, 'udp'*/);
!
$client = new StatsdClient($sender);
$factory = new StatsdDataFactory('LiuggioStatsdClientEntityStatsdData');
!
// create the data with the factory
$data[] = $factory->timing('usageTime', 100);
$data[] = $factory->increment('visitor');
$data[] = $factory->decrement('click');
$data[] = $factory->gauge('gaugor', 333);
$data[] = $factory->set('uniques', 765);
!
// send the data as array or directly as object
$client->send($data);
102. Monitoring
StatsD + liuggio/statsd-php-client
$data[] = $factory->timing('usageTime', 100);!
!
// send the data as array or directly as object
$client->send($data);
103. Monitoring
StatsD + liuggio/statsd-php-client
$data[] = $factory->increment('visitor');!
!
// send the data as array or directly as object
$client->send($data);
104. Monitoring
StatsD + liuggio/statsd-php-client
$data[] = $factory->decrement('click');!
!
// send the data as array or directly as object
$client->send($data);
105. Monitoring
StatsD + liuggio/statsd-php-client
$data[] = $factory->gauge('gaugor', 333);!
!
// send the data as array or directly as object
$client->send($data);
109. Monitoring
Apache Requests
<Location /server-status>
SetHandler server-status
Order deny,allow
Deny from all
Allow from .your_domain.com
</Location>
!
ExtendedStatus On