SlideShare a Scribd company logo
PHP Power Tools
   Michelangelo van Dam
  PHPBenelux Meeting 2010, Leuven
Michelangelo van Dam

• Independent Consultant
• Zend Certified Engineer (ZCE)
 - PHP 4 & PHP 5
 - Zend Framework
• Co-Founder of PHPBenelux
• Shepherd of “elephpant” herds
Why PHP Power Tools
• early detection of issues
• cleaner & consistent code
• knowledge about the codebase
• better code
Usual Suspects

            PHP_CodeSniffer
Example Code
•- Zend Framework QuickStart app
   http://framework.zend.com/manual/en/learning.quickstart.intro.html
VirtualHost Settings
<VirtualHost *:80>
 DocumentRoot /srv/www/quickstart/public
 ServerName quickstart.local
 ServerAdmin root@localhost
 <Directory /srv/www/quickstart/public>
  Options Indexes FollowSymlinks
  AllowOverride All
  Order allow,deny
  Allow from all
  DirectoryIndex index.php
 </Directory>
 Alias /reports /srv/www/quickstart/reports
 <Directory /srv/www/quickstart/reports>
  Options Indexes FollowSymlinks
  AllowOverride All
  Order allow,deny
  Allow from all
  DirectoryIndex index.php index.html
 </Directory>
</VirtualHost>
Showtime
Syntax Checking
•- PHPLint
   comes with PHP binary
 - validates code for syntax errors
• Website
 - http://www.icosaedro.it/phplint/
Demo PHPLint
Code Documentation
•- PHPDocumentator
    creates automated API documentation
 - based on inline code blocks
• Installation
 - pear install PhpDocumentor
• Website
 - http://www.phpdoc.org
Demo PHPDoc
Output PHPDoc
Coding Standards
•- PHP_CodeSniffer
    sniffs for coding standard violations
 - ensures code is clean and consistent
 - using standard and custom coding standards
• Installation
 - pear install PHP_CodeSniffer
• Website
 - http://pear.php.net/package/PHP_CodeSniffer
Demo PHP_CodeSniffer
PHPCPD
•- PHP Copy/Paste Detector
     detects code duplication
•- Installation
   pear channel-discover pear.phpunit.de
 - pear channel-discover components.ez.no
 - pear install --alldeps phpunit/phpcpd
• Website
 - http://github.com/sebastianbergmann/phpcpd
Demo PHPCPD
Output
Mess Detection
•- PDepend & PHPMD
     detects code mess
•- Installation
   pear channel-discover pear.pdepend.org
 - pear install pdepend/PHP_Depend
 - pear channel-discover pear.phpmd.org
 - pear install phpmd/PHP_PMD
• Websites
 - http://www.pdepend.org
 - http://www.phpmd.org
Demo detecting mess
Output codesize
Output unused code
Unit Testing
•- PHPUnit
    tests code on unit level
 - includes database tests
 - integrates well with many PHP frameworks
• Installation
 - pear channel-discover pear.phpunit.de
 - pear install phpunit/PHPUnit
• Website
 - http://www.phpunit.de
See other presentation




 http://www.slideshare.net/DragonBe/phpunit-testing-to-zendtest
Automated builds
•- Phing
    automated build tool
 - like Apache Ant
 - integrates well with other PHP tools
• Installation
 - pear channel-discover pear.phing.info
 - pear install phing/phing
• Website
 - http://phing.info
build.xml
<?xml version="1.0"?>

<project name="zfqs" description="Zend Framework QuickStart" default="build" >
        <target name="version">
                <version releasetype="Bugfix" file="build.version" property="version.number"/>
        </target>

       <target name="phplint">
               <mkdir dir="./reports/phplint" />
               <phplint file="./application/models" haltonfailure="false" tofile="./reports/phplint/errors.txt"/>
       </target>

       <target name="pdepend">
               <mkdir dir="./reports/pdepend" />
               <copy file="./build_pdepend.html" tofile="./reports/pdepend/index.html" overwrite="true" />
               <exec command="/usr/bin/pdepend
                       --summary-xml=./reports/pdepend/summary.xml
                       --jdepend-chart=./reports/pdepend/jdepend.svg
                       --overview-pyramid=./reports/pdepend/pyramid.svg
                       ./application/models"
                       dir="./" />
       </target>

       <target name="phpmd">
               <mkdir dir="./reports/phpmd" />
               <exec command="/usr/bin/phpmd ./application/models html codesize --reportfile ./reports/phpmd/codesize.html" dir="./" />
               <exec command="/usr/bin/phpmd ./application/models html unusedcode --reportfile ./reports/phpmd/unusedcode.html" dir="./" />
       </target>

       <target name="phpcs">
               <mkdir dir="./reports/phpcs" />
               <exec command="/usr/bin/phpcs -n --standard=Zend --report=summary ./application/models > ./reports/phpcs/summary.txt" dir="./" />
               <exec command="/usr/bin/phpcs -n --standard=Zend --report=source ./application/models > ./reports/phpcs/source.txt" dir="./" />
               <exec command="/usr/bin/phpcs -n --standard=Zend --report=checkstyle ./application/models > ./reports/phpcs/checkstyle.xml" dir="./" />
       </target>

       <target name="phpcpd">
               <mkdir dir="./reports/phpcpd" />
               <exec command="/usr/bin/phpcpd --log-pmd ./reports/phpcpd/pmd-cpd.xml ./application/models" dir="./" />
       </target>

       <target name="phpdoc">
               <mkdir dir="./reports/phpdoc" />
               <exec command="phpdoc -d ./application/models -q -t ./reports/phpdoc -o HTML:frames:earthli" dir="./" />
       </target>

        <target name="build" depends="version,phplint,pdepend,phpmd,phpcs,phpcpd,phpdoc">
                <echo msg="Finishing build process ${version.number}" />
        </target>
</project>
project definition
<?xml version="1.0"?>

<project name="zfqs" description="Zend Framework QuickStart" default="build" >
…
</project>
target version
<target name="version">
    <version releasetype="Bugfix"
             file="build.version" property="version.number"/>
</target>




In file “build.version” we have the version number as the following sequence:

MAJOR.MINOR.BUGFIX (starting at 0.0.0)
target phplint
<target name="phplint">
   <mkdir dir="./reports/phplint" />
   <phplint file="./application/models"
            haltonfailure="false" tofile="./reports/phplint/errors.txt"/>
</target>
target pdepend
<target name="pdepend">
    <mkdir dir="./reports/pdepend" />
    <copy file="./build_pdepend.html"
          tofile="./reports/pdepend/index.html" overwrite="true" />
    <exec command="/usr/bin/pdepend
                        --summary-xml=./reports/pdepend/summary.xml
                        --jdepend-chart=./reports/pdepend/jdepend.svg
                        --overview-pyramid=./reports/pdepend/pyramid.svg
                        ./application/models"
                        dir="./" />
</target>
target phpmd
<target name="phpmd">
    <mkdir dir="./reports/phpmd" />
    <exec command="/usr/bin/phpmd ./application/models html codesize
          --reportfile ./reports/phpmd/codesize.html" dir="./" />
    <exec command="/usr/bin/phpmd ./application/models html unusedcode
          --reportfile ./reports/phpmd/unusedcode.html" dir="./" />
</target>
target phpcs
<target name="phpcs">
    <mkdir dir="./reports/phpcs" />
    <exec command="/usr/bin/phpcs -n
            --standard=Zend --report=summary
            ./application/models > ./reports/phpcs/summary.txt"
            dir="./" />
    <exec command="/usr/bin/phpcs -n
            --standard=Zend --report=source
            ./application/models > ./reports/phpcs/source.txt"
            dir="./" />
    <exec command="/usr/bin/phpcs -n
            --standard=Zend --report=checkstyle
            ./application/models > ./reports/phpcs/checkstyle.xml"
            dir="./" />
</target>
target phpcpd
<target name="phpcpd">
    <mkdir dir="./reports/phpcpd" />
    <exec command="/usr/bin/phpcpd
            --log-pmd ./reports/phpcpd/pmd-cpd.xml ./application/models"
            dir="./" />
</target>
target phpdoc
<target name="phpdoc">
    <mkdir dir="./reports/phpdoc" />
    <exec command="phpdoc -d ./application/models -q
            -t ./reports/phpdoc -o HTML:frames:earthli"
            dir="./" />
</target>
target build
<target name="build"
        depends="version,phplint,pdepend,phpmd,phpcs,phpcpd,phpdoc">
    <echo msg="Finishing build process ${version.number}" />
</target>
Demo building all
Demo building target
Our reports section
Summary


   PHP offers lots of tools
more consistent and clean code
     automated process
Thank you


            Slides on slideshare
http://www.slideshare.net/group/phpbenelux

    Don’t forget to thank our sponsor

More Related Content

What's hot

Apache Presentation
Apache PresentationApache Presentation
Apache Presentation
Ankush Jain
 
Installing php and my sql locally using xampp
Installing php and my sql locally using xamppInstalling php and my sql locally using xampp
Installing php and my sql locally using xampp
peyman Ghader Kurehpaz
 
Creating custom themes in AtoM
Creating custom themes in AtoMCreating custom themes in AtoM
Creating custom themes in AtoM
Artefactual Systems - AtoM
 
Phalcon 2 - PHP Brazil Conference
Phalcon 2 - PHP Brazil ConferencePhalcon 2 - PHP Brazil Conference
Phalcon 2 - PHP Brazil Conference
Jackson F. de A. Mafra
 
$ make install
$ make install$ make install
$ make install
Marios Isaakidis
 
PHP Dependency Management with Composer
PHP Dependency Management with ComposerPHP Dependency Management with Composer
PHP Dependency Management with Composer
Adam Englander
 
How to install and configure LEMP stack
How to install and configure LEMP stackHow to install and configure LEMP stack
How to install and configure LEMP stack
RootGate
 
Linux Webserver Installation Command and GUI.ppt
Linux Webserver Installation Command and GUI.pptLinux Webserver Installation Command and GUI.ppt
Linux Webserver Installation Command and GUI.pptwebhostingguy
 
How to Submit a plugin to WordPress.org Repository
How to Submit a plugin to WordPress.org RepositoryHow to Submit a plugin to WordPress.org Repository
How to Submit a plugin to WordPress.org Repository
Tareq Hasan
 
Dependency management with Composer
Dependency management with ComposerDependency management with Composer
Dependency management with ComposerJason Grimes
 
Debian source list generator
Debian source list generatorDebian source list generator
Debian source list generator
JessalynCo
 
Dockerizing WordPress
Dockerizing WordPressDockerizing WordPress
Dockerizing WordPress
dotCloud
 
&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />tutorialsruby
 
PHP Conference - Phalcon hands-on
PHP Conference - Phalcon hands-onPHP Conference - Phalcon hands-on
PHP Conference - Phalcon hands-on
Jackson F. de A. Mafra
 
PHP and FastCGI Performance Optimizations
PHP and FastCGI Performance OptimizationsPHP and FastCGI Performance Optimizations
PHP and FastCGI Performance Optimizations
Alessandro Pilotti
 

What's hot (18)

Apache Presentation
Apache PresentationApache Presentation
Apache Presentation
 
Installing php and my sql locally using xampp
Installing php and my sql locally using xamppInstalling php and my sql locally using xampp
Installing php and my sql locally using xampp
 
Apache
ApacheApache
Apache
 
Creating custom themes in AtoM
Creating custom themes in AtoMCreating custom themes in AtoM
Creating custom themes in AtoM
 
Phalcon 2 - PHP Brazil Conference
Phalcon 2 - PHP Brazil ConferencePhalcon 2 - PHP Brazil Conference
Phalcon 2 - PHP Brazil Conference
 
$ make install
$ make install$ make install
$ make install
 
PHP Dependency Management with Composer
PHP Dependency Management with ComposerPHP Dependency Management with Composer
PHP Dependency Management with Composer
 
How to install and configure LEMP stack
How to install and configure LEMP stackHow to install and configure LEMP stack
How to install and configure LEMP stack
 
Linux Webserver Installation Command and GUI.ppt
Linux Webserver Installation Command and GUI.pptLinux Webserver Installation Command and GUI.ppt
Linux Webserver Installation Command and GUI.ppt
 
How to Submit a plugin to WordPress.org Repository
How to Submit a plugin to WordPress.org RepositoryHow to Submit a plugin to WordPress.org Repository
How to Submit a plugin to WordPress.org Repository
 
Dependency management with Composer
Dependency management with ComposerDependency management with Composer
Dependency management with Composer
 
Debian source list generator
Debian source list generatorDebian source list generator
Debian source list generator
 
Perl
PerlPerl
Perl
 
Dockerizing WordPress
Dockerizing WordPressDockerizing WordPress
Dockerizing WordPress
 
&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />
 
nir
nirnir
nir
 
PHP Conference - Phalcon hands-on
PHP Conference - Phalcon hands-onPHP Conference - Phalcon hands-on
PHP Conference - Phalcon hands-on
 
PHP and FastCGI Performance Optimizations
PHP and FastCGI Performance OptimizationsPHP and FastCGI Performance Optimizations
PHP and FastCGI Performance Optimizations
 

Viewers also liked

Srs2 Job Portal
Srs2 Job PortalSrs2 Job Portal
Srs2 Job Portal
Be-call Khyaju
 
Online Job Portal Document
Online Job Portal DocumentOnline Job Portal Document
Online Job Portal DocumentAvinash Singh
 
JOB PORTAL SYSTEM
JOB PORTAL SYSTEMJOB PORTAL SYSTEM
JOB PORTAL SYSTEM
PIYUSH Dubey
 
online job portal system
online job portal systemonline job portal system
online job portal systemKrishna Ranjan
 
Online job portal
Online job portal Online job portal
Online job portal
Aj Maurya
 
Project report-on-student-information-management-system-php-mysql
Project report-on-student-information-management-system-php-mysqlProject report-on-student-information-management-system-php-mysql
Project report-on-student-information-management-system-php-mysqlRaj Sharma
 

Viewers also liked (6)

Srs2 Job Portal
Srs2 Job PortalSrs2 Job Portal
Srs2 Job Portal
 
Online Job Portal Document
Online Job Portal DocumentOnline Job Portal Document
Online Job Portal Document
 
JOB PORTAL SYSTEM
JOB PORTAL SYSTEMJOB PORTAL SYSTEM
JOB PORTAL SYSTEM
 
online job portal system
online job portal systemonline job portal system
online job portal system
 
Online job portal
Online job portal Online job portal
Online job portal
 
Project report-on-student-information-management-system-php-mysql
Project report-on-student-information-management-system-php-mysqlProject report-on-student-information-management-system-php-mysql
Project report-on-student-information-management-system-php-mysql
 

Similar to Php Power Tools

Improving QA on PHP projects - confoo 2011
Improving QA on PHP projects - confoo 2011Improving QA on PHP projects - confoo 2011
Improving QA on PHP projects - confoo 2011
Michelangelo van Dam
 
Improving qa on php projects
Improving qa on php projectsImproving qa on php projects
Improving qa on php projects
Michelangelo van Dam
 
Write php deploy everywhere
Write php deploy everywhereWrite php deploy everywhere
Write php deploy everywhere
Michelangelo van Dam
 
PHP Development Tools
PHP  Development ToolsPHP  Development Tools
PHP Development Tools
Antony Abramchenko
 
Building com Phing - 7Masters PHP
Building com Phing - 7Masters PHPBuilding com Phing - 7Masters PHP
Building com Phing - 7Masters PHP
iMasters
 
Ant vs Phing
Ant vs PhingAnt vs Phing
Ant vs Phing
Manuel Baldassarri
 
Phing
PhingPhing
Phing
mdekrijger
 
Symfony2 for Midgard Developers
Symfony2 for Midgard DevelopersSymfony2 for Midgard Developers
Symfony2 for Midgard Developers
Henri Bergius
 
Web-Performance
Web-PerformanceWeb-Performance
Web-Performance
Walter Ebert
 
Head First Zend Framework - Part 1 Project & Application
Head First Zend Framework - Part 1 Project & ApplicationHead First Zend Framework - Part 1 Project & Application
Head First Zend Framework - Part 1 Project & ApplicationJace Ju
 
Building Web Applications with Zend Framework
Building Web Applications with Zend FrameworkBuilding Web Applications with Zend Framework
Building Web Applications with Zend Framework
Phil Brown
 
Xdebug - Derick Rethans - Barcelona PHP Conference 2008
Xdebug - Derick Rethans - Barcelona PHP Conference 2008Xdebug - Derick Rethans - Barcelona PHP Conference 2008
Xdebug - Derick Rethans - Barcelona PHP Conference 2008phpbarcelona
 
Advanced Eclipse Workshop (held at IPC2010 -spring edition-)
Advanced Eclipse Workshop (held at IPC2010 -spring edition-)Advanced Eclipse Workshop (held at IPC2010 -spring edition-)
Advanced Eclipse Workshop (held at IPC2010 -spring edition-)
Bastian Feder
 
Continous delivery with Jenkins and Chef
Continous delivery with Jenkins and ChefContinous delivery with Jenkins and Chef
Continous delivery with Jenkins and Chefdefrag2
 
WordCamp Montreal 2016 WP-API + React with server rendering
WordCamp Montreal 2016  WP-API + React with server renderingWordCamp Montreal 2016  WP-API + React with server rendering
WordCamp Montreal 2016 WP-API + React with server rendering
Ziad Saab
 
Magento 2 Development
Magento 2 DevelopmentMagento 2 Development
Magento 2 Development
Duke Dao
 
Profiling PHP with Xdebug / Webgrind
Profiling PHP with Xdebug / WebgrindProfiling PHP with Xdebug / Webgrind
Profiling PHP with Xdebug / Webgrind
Sam Keen
 

Similar to Php Power Tools (20)

Improving QA on PHP projects - confoo 2011
Improving QA on PHP projects - confoo 2011Improving QA on PHP projects - confoo 2011
Improving QA on PHP projects - confoo 2011
 
Improving qa on php projects
Improving qa on php projectsImproving qa on php projects
Improving qa on php projects
 
Write php deploy everywhere
Write php deploy everywhereWrite php deploy everywhere
Write php deploy everywhere
 
Write php deploy everywhere tek11
Write php deploy everywhere   tek11Write php deploy everywhere   tek11
Write php deploy everywhere tek11
 
PHP Development Tools
PHP  Development ToolsPHP  Development Tools
PHP Development Tools
 
Building com Phing - 7Masters PHP
Building com Phing - 7Masters PHPBuilding com Phing - 7Masters PHP
Building com Phing - 7Masters PHP
 
Ant vs Phing
Ant vs PhingAnt vs Phing
Ant vs Phing
 
Phing
PhingPhing
Phing
 
Symfony2 for Midgard Developers
Symfony2 for Midgard DevelopersSymfony2 for Midgard Developers
Symfony2 for Midgard Developers
 
Web-Performance
Web-PerformanceWeb-Performance
Web-Performance
 
Head First Zend Framework - Part 1 Project & Application
Head First Zend Framework - Part 1 Project & ApplicationHead First Zend Framework - Part 1 Project & Application
Head First Zend Framework - Part 1 Project & Application
 
Cooking with Chef
Cooking with ChefCooking with Chef
Cooking with Chef
 
Zend
ZendZend
Zend
 
Building Web Applications with Zend Framework
Building Web Applications with Zend FrameworkBuilding Web Applications with Zend Framework
Building Web Applications with Zend Framework
 
Xdebug - Derick Rethans - Barcelona PHP Conference 2008
Xdebug - Derick Rethans - Barcelona PHP Conference 2008Xdebug - Derick Rethans - Barcelona PHP Conference 2008
Xdebug - Derick Rethans - Barcelona PHP Conference 2008
 
Advanced Eclipse Workshop (held at IPC2010 -spring edition-)
Advanced Eclipse Workshop (held at IPC2010 -spring edition-)Advanced Eclipse Workshop (held at IPC2010 -spring edition-)
Advanced Eclipse Workshop (held at IPC2010 -spring edition-)
 
Continous delivery with Jenkins and Chef
Continous delivery with Jenkins and ChefContinous delivery with Jenkins and Chef
Continous delivery with Jenkins and Chef
 
WordCamp Montreal 2016 WP-API + React with server rendering
WordCamp Montreal 2016  WP-API + React with server renderingWordCamp Montreal 2016  WP-API + React with server rendering
WordCamp Montreal 2016 WP-API + React with server rendering
 
Magento 2 Development
Magento 2 DevelopmentMagento 2 Development
Magento 2 Development
 
Profiling PHP with Xdebug / Webgrind
Profiling PHP with Xdebug / WebgrindProfiling PHP with Xdebug / Webgrind
Profiling PHP with Xdebug / Webgrind
 

More from Michelangelo van Dam

GDPR Art. 25 - Privacy by design and default
GDPR Art. 25 - Privacy by design and defaultGDPR Art. 25 - Privacy by design and default
GDPR Art. 25 - Privacy by design and default
Michelangelo van Dam
 
Moving from app services to azure functions
Moving from app services to azure functionsMoving from app services to azure functions
Moving from app services to azure functions
Michelangelo van Dam
 
Privacy by design
Privacy by designPrivacy by design
Privacy by design
Michelangelo van Dam
 
DevOps or DevSecOps
DevOps or DevSecOpsDevOps or DevSecOps
DevOps or DevSecOps
Michelangelo van Dam
 
Privacy by design
Privacy by designPrivacy by design
Privacy by design
Michelangelo van Dam
 
Continuous deployment 2.0
Continuous deployment 2.0Continuous deployment 2.0
Continuous deployment 2.0
Michelangelo van Dam
 
Let your tests drive your code
Let your tests drive your codeLet your tests drive your code
Let your tests drive your code
Michelangelo van Dam
 
General Data Protection Regulation, a developer's story
General Data Protection Regulation, a developer's storyGeneral Data Protection Regulation, a developer's story
General Data Protection Regulation, a developer's story
Michelangelo van Dam
 
Leveraging a distributed architecture to your advantage
Leveraging a distributed architecture to your advantageLeveraging a distributed architecture to your advantage
Leveraging a distributed architecture to your advantage
Michelangelo van Dam
 
The road to php 7.1
The road to php 7.1The road to php 7.1
The road to php 7.1
Michelangelo van Dam
 
Open source for a successful business
Open source for a successful businessOpen source for a successful business
Open source for a successful business
Michelangelo van Dam
 
Decouple your framework now, thank me later
Decouple your framework now, thank me laterDecouple your framework now, thank me later
Decouple your framework now, thank me later
Michelangelo van Dam
 
Deploy to azure in less then 15 minutes
Deploy to azure in less then 15 minutesDeploy to azure in less then 15 minutes
Deploy to azure in less then 15 minutes
Michelangelo van Dam
 
Azure and OSS, a match made in heaven
Azure and OSS, a match made in heavenAzure and OSS, a match made in heaven
Azure and OSS, a match made in heaven
Michelangelo van Dam
 
Getting hands dirty with php7
Getting hands dirty with php7Getting hands dirty with php7
Getting hands dirty with php7
Michelangelo van Dam
 
Zf2 how arrays will save your project
Zf2   how arrays will save your projectZf2   how arrays will save your project
Zf2 how arrays will save your projectMichelangelo van Dam
 
Create, test, secure, repeat
Create, test, secure, repeatCreate, test, secure, repeat
Create, test, secure, repeat
Michelangelo van Dam
 
The Continuous PHP Pipeline
The Continuous PHP PipelineThe Continuous PHP Pipeline
The Continuous PHP Pipeline
Michelangelo van Dam
 
PHPUnit Episode iv.iii: Return of the tests
PHPUnit Episode iv.iii: Return of the testsPHPUnit Episode iv.iii: Return of the tests
PHPUnit Episode iv.iii: Return of the tests
Michelangelo van Dam
 
Easily extend your existing php app with an api
Easily extend your existing php app with an apiEasily extend your existing php app with an api
Easily extend your existing php app with an api
Michelangelo van Dam
 

More from Michelangelo van Dam (20)

GDPR Art. 25 - Privacy by design and default
GDPR Art. 25 - Privacy by design and defaultGDPR Art. 25 - Privacy by design and default
GDPR Art. 25 - Privacy by design and default
 
Moving from app services to azure functions
Moving from app services to azure functionsMoving from app services to azure functions
Moving from app services to azure functions
 
Privacy by design
Privacy by designPrivacy by design
Privacy by design
 
DevOps or DevSecOps
DevOps or DevSecOpsDevOps or DevSecOps
DevOps or DevSecOps
 
Privacy by design
Privacy by designPrivacy by design
Privacy by design
 
Continuous deployment 2.0
Continuous deployment 2.0Continuous deployment 2.0
Continuous deployment 2.0
 
Let your tests drive your code
Let your tests drive your codeLet your tests drive your code
Let your tests drive your code
 
General Data Protection Regulation, a developer's story
General Data Protection Regulation, a developer's storyGeneral Data Protection Regulation, a developer's story
General Data Protection Regulation, a developer's story
 
Leveraging a distributed architecture to your advantage
Leveraging a distributed architecture to your advantageLeveraging a distributed architecture to your advantage
Leveraging a distributed architecture to your advantage
 
The road to php 7.1
The road to php 7.1The road to php 7.1
The road to php 7.1
 
Open source for a successful business
Open source for a successful businessOpen source for a successful business
Open source for a successful business
 
Decouple your framework now, thank me later
Decouple your framework now, thank me laterDecouple your framework now, thank me later
Decouple your framework now, thank me later
 
Deploy to azure in less then 15 minutes
Deploy to azure in less then 15 minutesDeploy to azure in less then 15 minutes
Deploy to azure in less then 15 minutes
 
Azure and OSS, a match made in heaven
Azure and OSS, a match made in heavenAzure and OSS, a match made in heaven
Azure and OSS, a match made in heaven
 
Getting hands dirty with php7
Getting hands dirty with php7Getting hands dirty with php7
Getting hands dirty with php7
 
Zf2 how arrays will save your project
Zf2   how arrays will save your projectZf2   how arrays will save your project
Zf2 how arrays will save your project
 
Create, test, secure, repeat
Create, test, secure, repeatCreate, test, secure, repeat
Create, test, secure, repeat
 
The Continuous PHP Pipeline
The Continuous PHP PipelineThe Continuous PHP Pipeline
The Continuous PHP Pipeline
 
PHPUnit Episode iv.iii: Return of the tests
PHPUnit Episode iv.iii: Return of the testsPHPUnit Episode iv.iii: Return of the tests
PHPUnit Episode iv.iii: Return of the tests
 
Easily extend your existing php app with an api
Easily extend your existing php app with an apiEasily extend your existing php app with an api
Easily extend your existing php app with an api
 

Recently uploaded

From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
Product School
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
Cheryl Hung
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
Alison B. Lowndes
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
DianaGray10
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Thierry Lestable
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Inflectra
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
Jemma Hussein Allen
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Jeffrey Haguewood
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
DianaGray10
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
Product School
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Product School
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
91mobiles
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
Elena Simperl
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Product School
 

Recently uploaded (20)

From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
 

Php Power Tools

  • 1. PHP Power Tools Michelangelo van Dam PHPBenelux Meeting 2010, Leuven
  • 2. Michelangelo van Dam • Independent Consultant • Zend Certified Engineer (ZCE) - PHP 4 & PHP 5 - Zend Framework • Co-Founder of PHPBenelux • Shepherd of “elephpant” herds
  • 3. Why PHP Power Tools • early detection of issues • cleaner & consistent code • knowledge about the codebase • better code
  • 4. Usual Suspects PHP_CodeSniffer
  • 5. Example Code •- Zend Framework QuickStart app http://framework.zend.com/manual/en/learning.quickstart.intro.html
  • 6. VirtualHost Settings <VirtualHost *:80> DocumentRoot /srv/www/quickstart/public ServerName quickstart.local ServerAdmin root@localhost <Directory /srv/www/quickstart/public> Options Indexes FollowSymlinks AllowOverride All Order allow,deny Allow from all DirectoryIndex index.php </Directory> Alias /reports /srv/www/quickstart/reports <Directory /srv/www/quickstart/reports> Options Indexes FollowSymlinks AllowOverride All Order allow,deny Allow from all DirectoryIndex index.php index.html </Directory> </VirtualHost>
  • 8. Syntax Checking •- PHPLint comes with PHP binary - validates code for syntax errors • Website - http://www.icosaedro.it/phplint/
  • 10. Code Documentation •- PHPDocumentator creates automated API documentation - based on inline code blocks • Installation - pear install PhpDocumentor • Website - http://www.phpdoc.org
  • 13. Coding Standards •- PHP_CodeSniffer sniffs for coding standard violations - ensures code is clean and consistent - using standard and custom coding standards • Installation - pear install PHP_CodeSniffer • Website - http://pear.php.net/package/PHP_CodeSniffer
  • 15. PHPCPD •- PHP Copy/Paste Detector detects code duplication •- Installation pear channel-discover pear.phpunit.de - pear channel-discover components.ez.no - pear install --alldeps phpunit/phpcpd • Website - http://github.com/sebastianbergmann/phpcpd
  • 18. Mess Detection •- PDepend & PHPMD detects code mess •- Installation pear channel-discover pear.pdepend.org - pear install pdepend/PHP_Depend - pear channel-discover pear.phpmd.org - pear install phpmd/PHP_PMD • Websites - http://www.pdepend.org - http://www.phpmd.org
  • 22. Unit Testing •- PHPUnit tests code on unit level - includes database tests - integrates well with many PHP frameworks • Installation - pear channel-discover pear.phpunit.de - pear install phpunit/PHPUnit • Website - http://www.phpunit.de
  • 23. See other presentation http://www.slideshare.net/DragonBe/phpunit-testing-to-zendtest
  • 24. Automated builds •- Phing automated build tool - like Apache Ant - integrates well with other PHP tools • Installation - pear channel-discover pear.phing.info - pear install phing/phing • Website - http://phing.info
  • 25. build.xml <?xml version="1.0"?> <project name="zfqs" description="Zend Framework QuickStart" default="build" > <target name="version"> <version releasetype="Bugfix" file="build.version" property="version.number"/> </target> <target name="phplint"> <mkdir dir="./reports/phplint" /> <phplint file="./application/models" haltonfailure="false" tofile="./reports/phplint/errors.txt"/> </target> <target name="pdepend"> <mkdir dir="./reports/pdepend" /> <copy file="./build_pdepend.html" tofile="./reports/pdepend/index.html" overwrite="true" /> <exec command="/usr/bin/pdepend --summary-xml=./reports/pdepend/summary.xml --jdepend-chart=./reports/pdepend/jdepend.svg --overview-pyramid=./reports/pdepend/pyramid.svg ./application/models" dir="./" /> </target> <target name="phpmd"> <mkdir dir="./reports/phpmd" /> <exec command="/usr/bin/phpmd ./application/models html codesize --reportfile ./reports/phpmd/codesize.html" dir="./" /> <exec command="/usr/bin/phpmd ./application/models html unusedcode --reportfile ./reports/phpmd/unusedcode.html" dir="./" /> </target> <target name="phpcs"> <mkdir dir="./reports/phpcs" /> <exec command="/usr/bin/phpcs -n --standard=Zend --report=summary ./application/models > ./reports/phpcs/summary.txt" dir="./" /> <exec command="/usr/bin/phpcs -n --standard=Zend --report=source ./application/models > ./reports/phpcs/source.txt" dir="./" /> <exec command="/usr/bin/phpcs -n --standard=Zend --report=checkstyle ./application/models > ./reports/phpcs/checkstyle.xml" dir="./" /> </target> <target name="phpcpd"> <mkdir dir="./reports/phpcpd" /> <exec command="/usr/bin/phpcpd --log-pmd ./reports/phpcpd/pmd-cpd.xml ./application/models" dir="./" /> </target> <target name="phpdoc"> <mkdir dir="./reports/phpdoc" /> <exec command="phpdoc -d ./application/models -q -t ./reports/phpdoc -o HTML:frames:earthli" dir="./" /> </target> <target name="build" depends="version,phplint,pdepend,phpmd,phpcs,phpcpd,phpdoc"> <echo msg="Finishing build process ${version.number}" /> </target> </project>
  • 26. project definition <?xml version="1.0"?> <project name="zfqs" description="Zend Framework QuickStart" default="build" > … </project>
  • 27. target version <target name="version"> <version releasetype="Bugfix" file="build.version" property="version.number"/> </target> In file “build.version” we have the version number as the following sequence: MAJOR.MINOR.BUGFIX (starting at 0.0.0)
  • 28. target phplint <target name="phplint"> <mkdir dir="./reports/phplint" /> <phplint file="./application/models" haltonfailure="false" tofile="./reports/phplint/errors.txt"/> </target>
  • 29. target pdepend <target name="pdepend"> <mkdir dir="./reports/pdepend" /> <copy file="./build_pdepend.html" tofile="./reports/pdepend/index.html" overwrite="true" /> <exec command="/usr/bin/pdepend --summary-xml=./reports/pdepend/summary.xml --jdepend-chart=./reports/pdepend/jdepend.svg --overview-pyramid=./reports/pdepend/pyramid.svg ./application/models" dir="./" /> </target>
  • 30. target phpmd <target name="phpmd"> <mkdir dir="./reports/phpmd" /> <exec command="/usr/bin/phpmd ./application/models html codesize --reportfile ./reports/phpmd/codesize.html" dir="./" /> <exec command="/usr/bin/phpmd ./application/models html unusedcode --reportfile ./reports/phpmd/unusedcode.html" dir="./" /> </target>
  • 31. target phpcs <target name="phpcs"> <mkdir dir="./reports/phpcs" /> <exec command="/usr/bin/phpcs -n --standard=Zend --report=summary ./application/models > ./reports/phpcs/summary.txt" dir="./" /> <exec command="/usr/bin/phpcs -n --standard=Zend --report=source ./application/models > ./reports/phpcs/source.txt" dir="./" /> <exec command="/usr/bin/phpcs -n --standard=Zend --report=checkstyle ./application/models > ./reports/phpcs/checkstyle.xml" dir="./" /> </target>
  • 32. target phpcpd <target name="phpcpd"> <mkdir dir="./reports/phpcpd" /> <exec command="/usr/bin/phpcpd --log-pmd ./reports/phpcpd/pmd-cpd.xml ./application/models" dir="./" /> </target>
  • 33. target phpdoc <target name="phpdoc"> <mkdir dir="./reports/phpdoc" /> <exec command="phpdoc -d ./application/models -q -t ./reports/phpdoc -o HTML:frames:earthli" dir="./" /> </target>
  • 34. target build <target name="build" depends="version,phplint,pdepend,phpmd,phpcs,phpcpd,phpdoc"> <echo msg="Finishing build process ${version.number}" /> </target>
  • 38. Summary PHP offers lots of tools more consistent and clean code automated process
  • 39. Thank you Slides on slideshare http://www.slideshare.net/group/phpbenelux Don’t forget to thank our sponsor

Editor's Notes