The document discusses industrializing PHP applications in the cloud using Microsoft Azure. It introduces the speaker, Thomas Rabaix, and explains that industrialization involves following standards, automating workflows, and using libraries. Key standards discussed include PSR-0 for autoloading, PSR-1/2 for coding standards, and PSR-3 for logging interfaces. Industrialization allows code to be more easily reused, integrated and understood.
2. Industrialise
PHP
in
the
cloud
with
@
ZendCon
Europe
Who
?
• Thomas
Rabaix
– Software
Architect
@
– Symfony
Expert
– Sonata
Project
lead
dev
– Social
– https://github.com/rande
– https://twitter.com/th0masr
4. Industrialise
PHP
in
the
cloud
with
@
ZendCon
Europe
Industrialisation
•
•
•
•
•
Respect
Standards
Don’t
reinvent
the
wheel
Create
a
valid
workflow
Never
break
the
workflow
Automate
the
workflow
• Be
lazy
6. Industrialise
PHP
in
the
cloud
with
@
ZendCon
Europe
Libraries
• Foundation
behind
projects
• How
easy
a
library
can
be
reused
?
• How
easy
a
library
can
be
integrated
into
your
project?
7. Industrialise
PHP
in
the
cloud
with
@
ZendCon
Europe
PHP
FIG
PHP
FRAMEWORK
INTEROP
GROUP
8. Industrialise
PHP
in
the
cloud
with
@
ZendCon
Europe
Group
Members
• Agavi
~
David
Zülke
(@dzuelke)
• Laravel
~
Taylor
Otwell
(@taylorotwell)
• AWS
SDK
for
PHP
(Amazon
Web
Services)
~
Michael
Dowling
(@mtdowling)
• Lithium
~
Nate
Abele
(@nateabele)
• Apache
log4php
~
Ivan
Habunek
(@ihabunek)
• phpBB
~
Nils
Adermann
(@naderman)
• Assetic
and
Buzz
~
Kris
Wallsmith
(@kriswallsmith)
• phpDocumentor
~
Mike
van
Riel
(@mvriel)
• Aura
Project
and
Solar
Framework
~
Paul
M.
Jones
(@pmjones)
• PPI
Framework
~
Paul
Dragoonis
(@dr4goonis)
• CakePHP
~
Larry
Masters
(@PhpNut)
• PyroCMS
~
Phil
Sturgeon
(@philsturgeon)
• PEAR
~
Brett
Bieber
(@saltybeagle)
• Propel
~
William
Durand
(@couac)
• Composer
and
Packagist
~
Jordi
Boggiano
(@seldaek)
• SabreDAV
~
Evert
Pot
(@evertp)
• Contao
Open
Source
CMS
~
Leo
Feyer
(@leofeyer)
• SugarCRM
~
John
Mertic
(@jmertic)
• Doctrine
~
Guilherme
Blanco
(@guilhermeblanco)
• Symfony2
~
Bernhard
Schussek
(@webmozart)
• Drupal
~
Larry
Garfield
(@Crell)
• eZ
Publish
~
Andre
Romcke
(@andrerom)
• TYPO3
Flow
~
Karsten
Dambekalns
(@kdambekalns)
• Jackalope
~
Lukas
Kahwe
Smith
(@lsmith)
• Joomla
~
Don
Gilbert
(@dilbert4life)
• The
community
at
large
~
Cal
Evans
(@CalEvans)
• Yii
framework
~
Alexander
Makarov@sam_dark)
• Zend
Framework
2
~
Pádraic
Brady
(@padraicb)
• Zikula
~
Karma
Dordrak
(@zikuladrak)
9. Industrialise
PHP
in
the
cloud
with
@
ZendCon
Europe
PSR
#0
-‐
Autoloading
Standard
• Are
you
still
using
include
in
your
project
?
• Defines
how
class
can
be
loaded
• <Vendor Name>(<Namespace>)*<Class Name>
10. Industrialise
PHP
in
the
cloud
with
@
ZendCon
Europe
PSR
#1
/
#2
–
Coding
Standard
• Understanding
syntax
vs
understanding
code
• Same
syntax
across
libraries
11. Industrialise
PHP
in
the
cloud
with
@
ZendCon
Europe
PSR
#3
–
LoggerInterface
• Every
projects
need
logs
• Need
a
common
interface
to
write
log
• You
don’t
want
to
write
a
wrapper
for
each
library
12. Industrialise
PHP
in
the
cloud
with
@
ZendCon
Europe
Industrialisation
• Industrialisation
is
about
using
standards
• Share
the
same
rules
• if
as
a
vendor
you
want
your
code
to
be
used
• if
as
a
recruiter
want
new
people
to
get
into
a
project
quickly
13. Industrialise
PHP
in
the
cloud
with
@
ZendCon
Europe
It’s
PHP
code
after
all
FRAMEWORKS
(AND
ALIKE)
14. Industrialise
PHP
in
the
cloud
with
@
ZendCon
Europe
Select
your
own
•
•
•
•
•
•
•
•
•
•
Zend
Framework
Laravel
Symfony2
Silex
CakePHP
CodeIgniter
Wordpress
Drupal
ezPublish
Insert
your
favorite
solution
14
15. Industrialise
PHP
in
the
cloud
with
@
ZendCon
Europe
A
revolution
in
the
PHP
world
COMPOSER
16. Industrialise
PHP
in
the
cloud
with
@
ZendCon
Europe
Composer
• …
is
a
dependency
manager
tracking
local
dependencies
of
your
projects
and
libraries.
• …
is
2
years
old
only
• …
is
a
revolution
in
the
PHP
world
– 18
894
packages
– 89
689
007
installed
packages
(since
2012-‐04-‐13)
!
Default
definitions
available
on
packagist.org
17.
18.
19. Industrialise
PHP
in
the
cloud
with
@
ZendCon
Europe
Composer
•
•
•
•
•
99%
of
packages
are
hosted
on
Github
Github
has
downtime
or
rate
limits
Repositories
can
disappear
Need
speed
Security
Policies
!
• Mirror
Packagist's
definitions
and
Github’s
repositories!
https://github.com/ekino/php-‐mirroring
24. Industrialise
PHP
in
the
cloud
with
@
ZendCon
Europe
Running
the
code
PHP
ENVIRONMENTS
25. Industrialise
PHP
in
the
cloud
with
@
ZendCon
Europe
Too
many
environments
• How
many
php
runtimes
do
you
have
?
– cli,
php-‐cgi,
php-‐fpm,
mod_php5,
hhvm
• How
many
distributions
do
you
have
?
– Ubuntu,
debian,
redhat,
centos,
etc
..
• How
many
systems
are
required
by
the
project
?
– mysql,
memcached,
varnish,
mongodb,
etc
…
• How
long
does
it
take
to
introduce
a
new
developer
into
the
team
?
26. Industrialise
PHP
in
the
cloud
with
@
ZendCon
Europe
virtual
development
environments
VAGRANT
27. Industrialise
PHP
in
the
cloud
with
@
ZendCon
Europe
Vagrant
• Abstracted
layer
to
control
VM
– VirtualBox,
VMWare,
and
many
more
• Can
boot
any
kind
of
distribution
to
match
client
requirements
• Simple
configuration
file,
but
powerful
features
30. Industrialise
PHP
in
the
cloud
with
@
ZendCon
Europe
• All
developers
can
now
use
the
same
distribution
• This
is
not
enough
– How
to
match
clients
system
requirements
?
– How
to
avoid
complex
setup
done
by
each
developer
on
the
VM
?
31. Industrialise
PHP
in
the
cloud
with
@
ZendCon
Europe
Automate
your
infrastructure
PROVISIONING
32. Industrialise
PHP
in
the
cloud
with
@
ZendCon
Europe
Provisioning
• Define
system
configuration
• Apply
the
configuration
to
a
host
• Ensure
quick
system
installation
– Everything
is
in
the
code
– Definitions
are
stored
in
your
git
repository
33. Industrialise
PHP
in
the
cloud
with
@
ZendCon
Europe
Provisioning
:
Puppet
• Ruby
tools
• A
node
is
a
host
in
your
infrastructure
• Lots
of
modules
to
setup
system
–
apache,
apt,
composer,
concat,
exim,
java,
jenkins,
memcached,
mysql,
nginx,
php,
redis,
resolver,
ruby,
stdlib,
varnish,
wget,
and
many
more
…
– https://forge.puppetlabs.com/
39. Industrialise
PHP
in
the
cloud
with
@
ZendCon
Europe
$ git clone git://mygit/myproject.git
$ cd myproject
$ vagrant up —provision *
* just wait a few minutes
41. Industrialise
PHP
in
the
cloud
with
@
ZendCon
Europe
Is
my
code
working?
Are
the
client
requirements
working?
QUALITY
ASSURANCE
42. Industrialise
PHP
in
the
cloud
with
@
ZendCon
Europe
Unit
Tests
• Why
testing
?
• ensure
the
code
is
working
as
expected
• allow
safe
refactoring
• Test
one
class
or
one
function
• Different
solutions
• PHPUnit,
the
default
one
• Atoum,
an
alternative
• PHPSpec
44. Industrialise
PHP
in
the
cloud
with
@
ZendCon
Europe
Functional
Tests
• Run
scenarios
depending
on
user’s
requirements
• Check
if
classes
work
properly
together
• Behat
+
Mink
• Run
http
requests
on
the
web
application
• Different
drivers:
Goutte,
Selenium,
Sahi,
Zombie
46. Industrialise
PHP
in
the
cloud
with
@
ZendCon
Europe
Integration
Tests
• How
to
check
if
the
code
is
working
with
the
infrastructure
…
• Run
tests
against
the
new
release
• Need
to
deploy
the
code
first
…
47. Industrialise
PHP
in
the
cloud
with
@
ZendCon
Europe
Remote
multi-‐server
automation
tool
CAPISTRANO
48. Industrialise
PHP
in
the
cloud
with
@
ZendCon
Europe
•
•
•
•
Deploy
code
into
remote
servers
Task
can
be
run
in
parallel
on
different
remote
servers
Task
definition
in
ruby
style
Simple
commands,
but
powerful
options
48
51. Industrialise
PHP
in
the
cloud
with
@
ZendCon
Europe
Azure
• Create
a
new
VM
for
the
integration
tests
• For
now
Azure
VMs
are
not
puppet
ready
– You
need
to
install
puppet
and
rubygems
– But
you
can
create
your
own
vhd
image
• We
create
a
sonata-‐dev
instance
56. Industrialise
PHP
in
the
cloud
with
@
ZendCon
Europe
A
continuous
integration
server
JENKINS
57. Industrialise
PHP
in
the
cloud
with
@
ZendCon
Europe
Jenkins
• Continuous
integration
server
• Run
tasks
and
publish
results
– Can
be
used
with
many
testing
frameworks
– Many
plugins
57
70. Industrialise
PHP
in
the
cloud
with
@
ZendCon
Europe
PHP
industrialisation
is
about
…
Respecting
Standards
Reusing
tools
Selecting
your
own
tools
Creating
a
valid
workflow
Automating
the
workflow
72. Going
further
@
ZendCon
Vagrant,
puppet
&
chef
for
beginners
-‐
Thijs
Fery
Compose
this!
-‐
Matthew
Weier
O’Phinney
Phing
for
power
users
-‐
Stephan
Hochdörfer
Jenkins
entwined
with
deployment
and
pragmatism
-‐
Eric
Ritchie
• Beyond
PHP:
it
is
not
( just)
about
the
code!
-‐
Wim
Godden
• Essential
Git
for
Developers
-‐
Adam
Culp
•
•
•
•
72