SlideShare a Scribd company logo
PHP
Development Tools
Why I like PHPStorm
● You can develop applications in PHP versions 5.3/5.4/5.5/5.6/7.0/7.1, SQL & PL/SQL,
JavaScript, XML, HTML, CSS.
● You can add functionality to our IDE by installing plugins (Bash, Symfony, Laravel,
Magento 2, NodeJS, LiveEdit, Spy-JS, Meteor).
● Support for Vagrant and Docker, Docker Compose, SSH console & remote tools.
● Databases and SQL Editor in PhpStorm (MySQL, PostgreSQL, Oracle, SQLite, etc)
● Coding style Support PSR1/PSR2, PHPDoc support.
● Version control systems integration Git, Subversion, Mercurial, Perforce, CVS, TFS
● Duplicated Code Detector. PHP Code Sniffer (phpcs) that checks for code smells on
the fly. Local History. Debugging with Xdebug and ZendDebugger.
Advantages of Using Docker
Portability across machines – an application and all its dependencies
can be bundled into a single container that can be transferred to
another machine that runs Docker, and executed there without
compatibility issues.
Version control and component reuse – you can track successive
versions of a container, inspect differences, or roll-back to previous
versions.
Sharing – you can use a remote repository to share your container
with others.
Client, Docker Host, Registry
Docker Usage
~$ docker pull node:latest
~$ docker run -it --name="angular_test" node:latest /bin/bash
~$ npm install -g @angular/cli
~$ docker build -t angular-img .
~$ docker commit -m="This a test angular image" angular_test my.gitlabrepo/test_repo
~$ docker login && docker push my/test_repo
Docker File Example
FROM php:5.6-fpm
RUN apt-get update && apt-get install -y libfreetype6-dev libicu-dev libjpeg62-turbo-dev 
libmcrypt-dev libpng-dev libxslt1-dev
RUN docker-php-ext-install gd mcrypt mbstring sockets zip xsl soap
RUN pecl install xdebug-2.5.5 && docker-php-ext-enable xdebug
ADD ./etc/init.d/php/run.sh /run.sh
RUN curl -Lsf 'https://storage.googleapis.com/golang/go1.8.3.linux-amd64.tar.gz' 
| tar -C '/usr/local' -xvzf -
ENV PATH /usr/local/go/bin:$PATH
RUN go get github.com/mailhog/mhsendmail
RUN cp /root/go/bin/mhsendmail /usr/bin/mhsendmail
Solr Docker File
FROM java:6
RUN mkdir -p /opt/solr
RUN cd /tmp && curl https://archive.apache.org/dist/lucene/solr/3.6.1/apache-solr-3.6.1.tgz | tar xvz &&
mv -v apache-solr-3.6.1/* /opt/solr
EXPOSE 8983
VOLUME ["/opt/solr/example/solr/data", "/opt/solr/example/solr/conf"]
WORKDIR /opt/solr/example
CMD java -jar start.jar
Every Day Docker Commands
~$ docker ps -a
~$ docker stop|start|restart container_name
~$ docker run --name ubuntu -d ubuntu /bin/sh -c "while true; do echo hello world; sleep 1; done"
~$ docker exec -it ubuntu bash
~$ docker logs ubuntu
~$ docker history ubuntu
~$ docker stats
Docker Search
~$ docker search node
NAME DESCRIPTION STARS OFFICIAL AUTOMATED
node Node.js is a JavaScript-based platform for... 5829 [OK]
mhart/alpine-node Minimal Node.js built on Alpine Linux 366
mongo-express Web-based MongoDB admin interface, written... 269 [OK]
nodered/node-red-docker Node-RED Docker images. 168 [OK]
iojs io.js is an npm compatible platform origin... 126 [OK]
prom/node-exporter 83 [OK]
readytalk/nodejs Node.js based off the official Debian W
One Line Scripts
~$ curl -s https://registry.hub.docker.com//v1/repositories/php/tags | php -r
'print_r(json_decode(file_get_contents("php://stdin")));' | grep fpm | head -20
~$ sudo nano /usr/local/bin/docker-tags
~$ sudo chmod +x /usr/local/bin/docker-tags
#!/usr/bin/env bash
curl -s https://registry.hub.docker.com//v1/repositories/$1/tags | php -r
'print_r(json_decode(file_get_contents("php://stdin")));' | grep name | grep $2 | head -$3
Docker Tags
~$ docker-tags php fpm 10
[name] => 5-fpm-alpine
[name] => 5-fpm-alpine3.4
[name] => 5-fpm-alpine3.7
[name] => 5-fpm-jessie
[name] => 5-fpm-stretch
[name] => 5.4-fpm
[name] => 5.4.35-fpm
[name] => 5.4.36-fpm
[name] => 5.4.37-fpm
[name] => 5.4.38-fpm
One Line Scripts PHP
~$ sudo nano /usr/local/bin/docker-tag-php
#!/usr/bin/php -q
<?php
$repoCh = curl_init('https://registry.hub.docker.com//v1/repositories/' . $argv[1] . '/tags');
curl_setopt($repoCh, CURLOPT_RETURNTRANSFER, 1);
foreach (json_decode(curl_exec($repoCh)) as $tag) {
echo $tag->name . PHP_EOL;
}
curl_close($repoCh);
~$ sudo chmod +x /usr/local/bin/docker-tag-php
Docker Tags PHP
~$ docker-tags-php node | grep jessie | tail -n 10
8.11-jessie
8.11.2-jessie
8.11.3-jessie
9-jessie
9.11-jessie
9.11.1-jessie
9.11.2-jessie
boron-jessie
carbon-jessie
jessie
Kinematic
Portainer
docker-compose up
Runs services via docker-compose util:
● db - MySql database service
● app - PHP5.6-FPM service
● web - Nginx web server
● redis - Redis session and cache storage
● mongo - Mongo NoSql storage used for price service
● rabbit - RabbitMQ queue server
● solr -Apache Solr service for fulltext search
● bps - Backend price service on Python Tornado
● fps - Frontend price service on PHP
● worker - PHP worker for background jobs
● cron - Run application schedule tasks
● mailservice - Caught all mail from application
Docker Compose File Example
version: '3'
services:
influx:
image: influxdb
volumes:
- ./docker/var/lib/influx:/var/lib/influxdb
- ./docker/etc/init.d/influxdb:/docker-entrypoint-initdb.d
grafana:
image: grafana/grafana
ports:
- 127.0.0.1:3000:3000
volumes:
- ./docker/var/lib/grafana:/var/lib/grafana
depends_on:
- influx
cadvisor:
image: google/cadvisor
ports:
- 127.0.0.1:8080:8080
command: -logtostderr -docker_only -storage_driver=influxdb -storage_driver_db=cadvisor -storage_driver_host=influx:8086
Grafana
Coding style guide PSR-1
● Files MUST use only <?php and <?= tags.
● Files MUST use only UTF-8 without BOM for PHP code.
● Files SHOULD either declare symbols (classes, functions, constants, etc.) or cause
side-effects (e.g. generate output, change .ini settings, etc.) but SHOULD NOT do both.
● Namespaces and classes MUST follow an “autoloading” PSR: [PSR-0, PSR-4].
● Class names MUST be declared in StudlyCaps.
● Class constants MUST be declared in all uppercase with underscore separators.
● Method names MUST be declared in camelCase.
Coding style guide PSR-2
● Code MUST use 4 spaces for indenting, not tabs.
● There MUST NOT be a hard limit on line length; the soft limit MUST be 120
characters; lines SHOULD be 80 characters or less.
● There MUST be one blank line after the namespace declaration, and there
MUST be one blank line after the block of use declarations.
● Opening braces for classes MUST go on the next line, and closing braces MUST
go on the next line after the body.
● Opening braces for methods MUST go on the next line, and closing braces MUST
go on the next line after the body.
● Visibility MUST be declared on all properties and methods; abstract and
final MUST be declared before the visibility; static MUST be declared
after the visibility.
● Control structure keywords MUST have one space after them; method and
function calls MUST NOT.
● Opening braces for control structures MUST go on the same line, and closing
braces MUST go on the next line after the body.
● Opening parentheses for control structures MUST NOT have a space after them,
and closing parentheses for control structures MUST NOT have a space before.
File | Settings | Editor | Code Style | PHP
PHP Code Sniffer
● WordPress-Coding-SWordPress-Coding-Standardstandards/
● object-calisthenics/phpcs-calisthenics-rules
● yiisoft/yii2-coding-standards
● Symplify/EasyCodingStandard
● joomla/coding-standards
~$ sudo nano composer.json
{
"require": {
"magento-ecg/coding-standard": ">=3.0",
"squizlabs/php_codesniffer": "3.*"
}
}
PHP CS Setup
Setup PHPCS in PHPStorm:
In PHPStorm open File > Settings > Languages & Frameworks> PHP > Code Sniffer
Click to configuration, in opened popup click to the (+) and provide path to phpcs launcher.
PHP MD Setup
Setup PHPMD in PHPStorm:
In PHPStorm open File > Settings > Languages & Frameworks> PHP > Mess Detector
Click to configuration, in opened popup click to the (+) and provide path to phpmd launcher.
PHPCS Inspection Configuration
PHPMD Inspection Configuration
Document Rules
PHPDocs Rules:
● Each method in project MUST contain - @param, @return, @throws tags, and short method description.
● Each property and constant in project MUST contain - @var tag, and short property description.
● Each class and interface MUST contain - @category, @package, @author, @copyright, @license, @link and
short desc.
● Each file MUST contain - @category, @package, @author, @copyright, @license, @link and NOTICE OF
LICENSE
● Each public method in observe is in the listening to a magento event MUST contain - @see with value
event_name
● All PHP files MUST start with php tag, and MUST contain a empty line in end of file without php close tag.
● Each deprecated method MUST contain - @depricated and @see tags, @see -
class_method_with_new_functionality
Postman Introduction
Postman
Postman is API development and testing tool you can download from https://www.getpostman.com/apps
Xdebug Installation
~$ sudo apt install php-xdebug
~$ sudo phpenmod xdebug && php -m | grep xdebug
~$ sudo nano /etc/php/{php-version}/mods-available/xdebug.ini
[Xdebug]
zend_extension=<full_path_to_xdebug_extension>
xdebug.remote_enable=1
xdebug.remote_host=<the host where PhpStorm is running (e.g. localhost)>
xdebug.remote_port=<the port to which Xdebug tries to connect on the host where PhpStorm is
running (default 9000)>
xdebug.remote_autostart=1
Postman Collections
A Postman Collection is an Executable API Description. With Postman collections you can:
● Publishing an API collection can be done via a Run In Postman button, embedded within the publisher’s
site, and downloading a Postman Collection directly into the developer’s Postman instance.
● API Monitoring is a scheduled service to run a Postman Collection, reporting results based on tests
embedded in the collection, and reported in the user’s Postman dashboard.
● API Documentation publishes a shareable, customized view of the API’s Postman Collection - helping
developers onboard quickly to an API.
● Developers can create a Mock Server from a collection, allowing API users to view example request &
response pairs, even before the API is complete.
● Developers can Debug APIs by creating requests, adding tests, and examining responses.
How It’s Work
Debug PHP in Docker
Our php docker image already contain Xdebug in path/to/project/docker/php-fpm.dockerfile ;
xdebug configuration are in path/to/project/docker/etc/xdebug.ini ;
PHP Environment Variables are in path/to/project/docker/php.env ;
Environment Variables used for PHP Storm and Xdebug:
XDEBUG_CONFIG=remote_host=172.17.0.1 - IDE machine IP address
PHP_IDE_CONFIG=serverName=example - server name in PHPSTORM
Get your IP address in docker network (ifconfig (Unix) or ipconfig (Win)) and put to remote_host
~$ ifconfig
docker0 Link encap:Ethernet HWaddr #########
inet addr:172.17.0.1 Bcast:0.0.0.0 Mask:255.255.0.0
param
Xdebug Configuration In Docker
Mount to the php container xdebug.ini file next content:
xdebug.default_enable=1
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_port=19000
xdebug.remote_autostart=1
xdebug.remote_connect_back=1
xdebug.idekey="PHPSTORM"
In PHP dockerfile php-fpm.dockerfile
RUN pecl install xdebug-2.5.5 
&& docker-php-ext-enable xdebug
Configure Xdebug in Storm
Configure Server
Configure Proxy
Xdebug Profiling
xdebug.profiler_enable=1 or xdebug.profiler_enable_trigger=1 and activate it by XDEBUG_PROFILE
GET/POST parameter. xdebug.profiler_output_dir=/path/to/volume/profiler_output
Useful Links
● Docker & Docker-Compose
https://docs.docker.com/docker-for-windows/
https://docs.docker.com/docker-for-windows/install/
https://kitematic.com/
https://docs.docker.com/compose/install/
https://docs.docker.com/compose/gettingstarted/
● Xdebug configuration
https://gist.github.com/chadrien/c90927ec2d160ffea9c4
https://xdebug.org/
https://www.jetbrains.com/help/phpstorm/configuring-xdebug.html
● Coding style guide
https://www.php-fig.org/psr/psr-1/
https://www.php-fig.org/psr/psr-2/
Useful Links (2)
● PHPMD & PHPCS & PHPDOCS
https://phpmd.org/rules/index.html
https://phpmd.org/download/index.html
https://github.com/squizlabs/PHP_CodeSniffer
https://confluence.jetbrains.com/display/PhpStorm/PHP+Code+Sniffer+in+PhpStorm
https://confluence.jetbrains.com/display/PhpStorm/PHP+Mess+Detector+in+PhpStorm
https://www.phpdoc.org/
https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards
https://github.com/object-calisthenics/phpcs-calisthenics-rules
https://github.com/magento-ecg/coding-standard
https://github.com/joomla/coding-standards
● POSTMAN
https://habr.com/company/kolesa/blog/351250/
https://www.getpostman.com/

More Related Content

What's hot

Deploying Perl apps on dotCloud
Deploying Perl apps on dotCloudDeploying Perl apps on dotCloud
Deploying Perl apps on dotCloud
daoswald
 
Modeling and Control Robot Arm using Gazebo, MoveIt!, ros_control
Modeling and Control Robot Arm using Gazebo, MoveIt!, ros_controlModeling and Control Robot Arm using Gazebo, MoveIt!, ros_control
Modeling and Control Robot Arm using Gazebo, MoveIt!, ros_control
ByeongKyu Ahn
 
Fighting API Compatibility On Fluentd Using "Black Magic"
Fighting API Compatibility On Fluentd Using "Black Magic"Fighting API Compatibility On Fluentd Using "Black Magic"
Fighting API Compatibility On Fluentd Using "Black Magic"
SATOSHI TAGOMORI
 
Middleware as Code with mruby
Middleware as Code with mrubyMiddleware as Code with mruby
Middleware as Code with mruby
Hiroshi SHIBATA
 
Modern Black Mages Fighting in the Real World
Modern Black Mages Fighting in the Real WorldModern Black Mages Fighting in the Real World
Modern Black Mages Fighting in the Real World
SATOSHI TAGOMORI
 
Rest, sockets em golang
Rest, sockets em golangRest, sockets em golang
Rest, sockets em golang
jefferson Otoni Lima
 
Ripping web accessible .git files
Ripping web accessible .git filesRipping web accessible .git files
Ripping web accessible .git files
Vlatko Kosturjak
 
Porting your favourite cmdline tool to Android
Porting your favourite cmdline tool to AndroidPorting your favourite cmdline tool to Android
Porting your favourite cmdline tool to Android
Vlatko Kosturjak
 
Wonderful world of (distributed) SCM or VCS
Wonderful world of (distributed) SCM or VCSWonderful world of (distributed) SCM or VCS
Wonderful world of (distributed) SCM or VCS
Vlatko Kosturjak
 
parenscript-tutorial
parenscript-tutorialparenscript-tutorial
parenscript-tutorialtutorialsruby
 
RubyGems 3 & 4
RubyGems 3 & 4RubyGems 3 & 4
RubyGems 3 & 4
Hiroshi SHIBATA
 
Debugging Ruby (with Pry)
Debugging Ruby (with Pry)Debugging Ruby (with Pry)
Debugging Ruby (with Pry)
LukeBergen
 
Import golang; struct microservice - Codemotion Rome 2015
Import golang; struct microservice - Codemotion Rome 2015Import golang; struct microservice - Codemotion Rome 2015
Import golang; struct microservice - Codemotion Rome 2015
Giorgio Cefaro
 
Debugging Rails 3 Applications
Debugging Rails 3 ApplicationsDebugging Rails 3 Applications
Debugging Rails 3 ApplicationsNathan Broadbent
 
Large-scaled Deploy Over 100 Servers in 3 Minutes
Large-scaled Deploy Over 100 Servers in 3 MinutesLarge-scaled Deploy Over 100 Servers in 3 Minutes
Large-scaled Deploy Over 100 Servers in 3 Minutes
Hiroshi SHIBATA
 
ROS Hands-On Intro/Tutorial (Robotic Vision Summer School 2015) #RVSS #ACRV
ROS Hands-On Intro/Tutorial (Robotic Vision Summer School 2015) #RVSS #ACRVROS Hands-On Intro/Tutorial (Robotic Vision Summer School 2015) #RVSS #ACRV
ROS Hands-On Intro/Tutorial (Robotic Vision Summer School 2015) #RVSS #ACRV
Juxi Leitner
 
Take care of hundred containers and not go crazy
Take care of hundred containers and not go crazyTake care of hundred containers and not go crazy
Take care of hundred containers and not go crazy
Honza Horák
 
Hijacking Ruby Syntax in Ruby
Hijacking Ruby Syntax in RubyHijacking Ruby Syntax in Ruby
Hijacking Ruby Syntax in Ruby
SATOSHI TAGOMORI
 
Middleware as Code with mruby
Middleware as Code with mrubyMiddleware as Code with mruby
Middleware as Code with mruby
Hiroshi SHIBATA
 
このPHP拡張がすごい!2017
このPHP拡張がすごい!2017このPHP拡張がすごい!2017
このPHP拡張がすごい!2017
sasezaki
 

What's hot (20)

Deploying Perl apps on dotCloud
Deploying Perl apps on dotCloudDeploying Perl apps on dotCloud
Deploying Perl apps on dotCloud
 
Modeling and Control Robot Arm using Gazebo, MoveIt!, ros_control
Modeling and Control Robot Arm using Gazebo, MoveIt!, ros_controlModeling and Control Robot Arm using Gazebo, MoveIt!, ros_control
Modeling and Control Robot Arm using Gazebo, MoveIt!, ros_control
 
Fighting API Compatibility On Fluentd Using "Black Magic"
Fighting API Compatibility On Fluentd Using "Black Magic"Fighting API Compatibility On Fluentd Using "Black Magic"
Fighting API Compatibility On Fluentd Using "Black Magic"
 
Middleware as Code with mruby
Middleware as Code with mrubyMiddleware as Code with mruby
Middleware as Code with mruby
 
Modern Black Mages Fighting in the Real World
Modern Black Mages Fighting in the Real WorldModern Black Mages Fighting in the Real World
Modern Black Mages Fighting in the Real World
 
Rest, sockets em golang
Rest, sockets em golangRest, sockets em golang
Rest, sockets em golang
 
Ripping web accessible .git files
Ripping web accessible .git filesRipping web accessible .git files
Ripping web accessible .git files
 
Porting your favourite cmdline tool to Android
Porting your favourite cmdline tool to AndroidPorting your favourite cmdline tool to Android
Porting your favourite cmdline tool to Android
 
Wonderful world of (distributed) SCM or VCS
Wonderful world of (distributed) SCM or VCSWonderful world of (distributed) SCM or VCS
Wonderful world of (distributed) SCM or VCS
 
parenscript-tutorial
parenscript-tutorialparenscript-tutorial
parenscript-tutorial
 
RubyGems 3 & 4
RubyGems 3 & 4RubyGems 3 & 4
RubyGems 3 & 4
 
Debugging Ruby (with Pry)
Debugging Ruby (with Pry)Debugging Ruby (with Pry)
Debugging Ruby (with Pry)
 
Import golang; struct microservice - Codemotion Rome 2015
Import golang; struct microservice - Codemotion Rome 2015Import golang; struct microservice - Codemotion Rome 2015
Import golang; struct microservice - Codemotion Rome 2015
 
Debugging Rails 3 Applications
Debugging Rails 3 ApplicationsDebugging Rails 3 Applications
Debugging Rails 3 Applications
 
Large-scaled Deploy Over 100 Servers in 3 Minutes
Large-scaled Deploy Over 100 Servers in 3 MinutesLarge-scaled Deploy Over 100 Servers in 3 Minutes
Large-scaled Deploy Over 100 Servers in 3 Minutes
 
ROS Hands-On Intro/Tutorial (Robotic Vision Summer School 2015) #RVSS #ACRV
ROS Hands-On Intro/Tutorial (Robotic Vision Summer School 2015) #RVSS #ACRVROS Hands-On Intro/Tutorial (Robotic Vision Summer School 2015) #RVSS #ACRV
ROS Hands-On Intro/Tutorial (Robotic Vision Summer School 2015) #RVSS #ACRV
 
Take care of hundred containers and not go crazy
Take care of hundred containers and not go crazyTake care of hundred containers and not go crazy
Take care of hundred containers and not go crazy
 
Hijacking Ruby Syntax in Ruby
Hijacking Ruby Syntax in RubyHijacking Ruby Syntax in Ruby
Hijacking Ruby Syntax in Ruby
 
Middleware as Code with mruby
Middleware as Code with mrubyMiddleware as Code with mruby
Middleware as Code with mruby
 
このPHP拡張がすごい!2017
このPHP拡張がすごい!2017このPHP拡張がすごい!2017
このPHP拡張がすごい!2017
 

Similar to PHP Development Tools

Extending OpenShift Origin: Build Your Own Cartridge with Bill DeCoste of Red...
Extending OpenShift Origin: Build Your Own Cartridge with Bill DeCoste of Red...Extending OpenShift Origin: Build Your Own Cartridge with Bill DeCoste of Red...
Extending OpenShift Origin: Build Your Own Cartridge with Bill DeCoste of Red...
OpenShift Origin
 
PHP QA Tools
PHP QA ToolsPHP QA Tools
PHP QA Tools
rjsmelo
 
[HKDUG] #20161210 - BarCamp Hong Kong 2016 - What's News in PHP?
[HKDUG] #20161210 - BarCamp Hong Kong 2016 - What's News in PHP?[HKDUG] #20161210 - BarCamp Hong Kong 2016 - What's News in PHP?
[HKDUG] #20161210 - BarCamp Hong Kong 2016 - What's News in PHP?
Wong Hoi Sing Edison
 
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
 
Workshop: Symfony2 Intruduction: (Controller, Routing, Model)
Workshop: Symfony2 Intruduction: (Controller, Routing, Model)Workshop: Symfony2 Intruduction: (Controller, Routing, Model)
Workshop: Symfony2 Intruduction: (Controller, Routing, Model)
Antonio Peric-Mazar
 
Development Workflow Tools for Open-Source PHP Libraries
Development Workflow Tools for Open-Source PHP LibrariesDevelopment Workflow Tools for Open-Source PHP Libraries
Development Workflow Tools for Open-Source PHP Libraries
Pantheon
 
Toolbox of a Ruby Team
Toolbox of a Ruby TeamToolbox of a Ruby Team
Toolbox of a Ruby Team
Arto Artnik
 
Using the new WordPress REST API
Using the new WordPress REST APIUsing the new WordPress REST API
Using the new WordPress REST API
Caldera Labs
 
Nagios Conference 2014 - Spenser Reinhardt - Detecting Security Breaches With...
Nagios Conference 2014 - Spenser Reinhardt - Detecting Security Breaches With...Nagios Conference 2014 - Spenser Reinhardt - Detecting Security Breaches With...
Nagios Conference 2014 - Spenser Reinhardt - Detecting Security Breaches With...
Nagios
 
Learned lessons in a real world project
Learned lessons in a real world projectLearned lessons in a real world project
Learned lessons in a real world project
Codium
 
Start tracking your ruby infrastructure
Start tracking your ruby infrastructureStart tracking your ruby infrastructure
Start tracking your ruby infrastructure
Sergiy Kukunin
 
Php Power Tools
Php Power ToolsPhp Power Tools
Php Power Tools
Michelangelo van Dam
 
Automation day red hat ansible
   Automation day red hat ansible    Automation day red hat ansible
Automation day red hat ansible
Rodrigo Missiaggia
 
OpenShift Origin Community Day (Boston) Extending OpenShift Origin: Build You...
OpenShift Origin Community Day (Boston) Extending OpenShift Origin: Build You...OpenShift Origin Community Day (Boston) Extending OpenShift Origin: Build You...
OpenShift Origin Community Day (Boston) Extending OpenShift Origin: Build You...
OpenShift Origin
 
Hands on Docker - Launch your own LEMP or LAMP stack - SunshinePHP
Hands on Docker - Launch your own LEMP or LAMP stack - SunshinePHPHands on Docker - Launch your own LEMP or LAMP stack - SunshinePHP
Hands on Docker - Launch your own LEMP or LAMP stack - SunshinePHP
Dana Luther
 
Docker based Architecture by Denys Serdiuk
Docker based Architecture by Denys SerdiukDocker based Architecture by Denys Serdiuk
Docker based Architecture by Denys Serdiuk
Lohika_Odessa_TechTalks
 
Composer
ComposerComposer
Go Is Your Next Language — Sergii Shapoval
Go Is Your Next Language — Sergii ShapovalGo Is Your Next Language — Sergii Shapoval
Go Is Your Next Language — Sergii Shapoval
GlobalLogic Ukraine
 
Control your deployments with Capistrano
Control your deployments with CapistranoControl your deployments with Capistrano
Control your deployments with Capistrano
Ramazan K
 

Similar to PHP Development Tools (20)

Extending OpenShift Origin: Build Your Own Cartridge with Bill DeCoste of Red...
Extending OpenShift Origin: Build Your Own Cartridge with Bill DeCoste of Red...Extending OpenShift Origin: Build Your Own Cartridge with Bill DeCoste of Red...
Extending OpenShift Origin: Build Your Own Cartridge with Bill DeCoste of Red...
 
PHP QA Tools
PHP QA ToolsPHP QA Tools
PHP QA Tools
 
[HKDUG] #20161210 - BarCamp Hong Kong 2016 - What's News in PHP?
[HKDUG] #20161210 - BarCamp Hong Kong 2016 - What's News in PHP?[HKDUG] #20161210 - BarCamp Hong Kong 2016 - What's News in PHP?
[HKDUG] #20161210 - BarCamp Hong Kong 2016 - What's News in PHP?
 
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
 
Workshop: Symfony2 Intruduction: (Controller, Routing, Model)
Workshop: Symfony2 Intruduction: (Controller, Routing, Model)Workshop: Symfony2 Intruduction: (Controller, Routing, Model)
Workshop: Symfony2 Intruduction: (Controller, Routing, Model)
 
Development Workflow Tools for Open-Source PHP Libraries
Development Workflow Tools for Open-Source PHP LibrariesDevelopment Workflow Tools for Open-Source PHP Libraries
Development Workflow Tools for Open-Source PHP Libraries
 
Toolbox of a Ruby Team
Toolbox of a Ruby TeamToolbox of a Ruby Team
Toolbox of a Ruby Team
 
Using the new WordPress REST API
Using the new WordPress REST APIUsing the new WordPress REST API
Using the new WordPress REST API
 
Nagios Conference 2014 - Spenser Reinhardt - Detecting Security Breaches With...
Nagios Conference 2014 - Spenser Reinhardt - Detecting Security Breaches With...Nagios Conference 2014 - Spenser Reinhardt - Detecting Security Breaches With...
Nagios Conference 2014 - Spenser Reinhardt - Detecting Security Breaches With...
 
Learned lessons in a real world project
Learned lessons in a real world projectLearned lessons in a real world project
Learned lessons in a real world project
 
Start tracking your ruby infrastructure
Start tracking your ruby infrastructureStart tracking your ruby infrastructure
Start tracking your ruby infrastructure
 
Composer Helpdesk
Composer HelpdeskComposer Helpdesk
Composer Helpdesk
 
Php Power Tools
Php Power ToolsPhp Power Tools
Php Power Tools
 
Automation day red hat ansible
   Automation day red hat ansible    Automation day red hat ansible
Automation day red hat ansible
 
OpenShift Origin Community Day (Boston) Extending OpenShift Origin: Build You...
OpenShift Origin Community Day (Boston) Extending OpenShift Origin: Build You...OpenShift Origin Community Day (Boston) Extending OpenShift Origin: Build You...
OpenShift Origin Community Day (Boston) Extending OpenShift Origin: Build You...
 
Hands on Docker - Launch your own LEMP or LAMP stack - SunshinePHP
Hands on Docker - Launch your own LEMP or LAMP stack - SunshinePHPHands on Docker - Launch your own LEMP or LAMP stack - SunshinePHP
Hands on Docker - Launch your own LEMP or LAMP stack - SunshinePHP
 
Docker based Architecture by Denys Serdiuk
Docker based Architecture by Denys SerdiukDocker based Architecture by Denys Serdiuk
Docker based Architecture by Denys Serdiuk
 
Composer
ComposerComposer
Composer
 
Go Is Your Next Language — Sergii Shapoval
Go Is Your Next Language — Sergii ShapovalGo Is Your Next Language — Sergii Shapoval
Go Is Your Next Language — Sergii Shapoval
 
Control your deployments with Capistrano
Control your deployments with CapistranoControl your deployments with Capistrano
Control your deployments with Capistrano
 

Recently uploaded

Cosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdfCosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdf
Kamal Acharya
 
ASME IX(9) 2007 Full Version .pdf
ASME IX(9)  2007 Full Version       .pdfASME IX(9)  2007 Full Version       .pdf
ASME IX(9) 2007 Full Version .pdf
AhmedHussein950959
 
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptxCFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
R&R Consult
 
weather web application report.pdf
weather web application report.pdfweather web application report.pdf
weather web application report.pdf
Pratik Pawar
 
Standard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - NeometrixStandard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - Neometrix
Neometrix_Engineering_Pvt_Ltd
 
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdf
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdfGoverning Equations for Fundamental Aerodynamics_Anderson2010.pdf
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdf
WENKENLI1
 
ethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.pptethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.ppt
Jayaprasanna4
 
Fundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptxFundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptx
manasideore6
 
Hierarchical Digital Twin of a Naval Power System
Hierarchical Digital Twin of a Naval Power SystemHierarchical Digital Twin of a Naval Power System
Hierarchical Digital Twin of a Naval Power System
Kerry Sado
 
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
bakpo1
 
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
Amil Baba Dawood bangali
 
block diagram and signal flow graph representation
block diagram and signal flow graph representationblock diagram and signal flow graph representation
block diagram and signal flow graph representation
Divya Somashekar
 
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
zwunae
 
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang,  ICLR 2024, MLILAB, KAIST AI.pdfJ.Yang,  ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
MLILAB
 
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Dr.Costas Sachpazis
 
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdfTop 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Teleport Manpower Consultant
 
ethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.pptethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.ppt
Jayaprasanna4
 
Investor-Presentation-Q1FY2024 investor presentation document.pptx
Investor-Presentation-Q1FY2024 investor presentation document.pptxInvestor-Presentation-Q1FY2024 investor presentation document.pptx
Investor-Presentation-Q1FY2024 investor presentation document.pptx
AmarGB2
 
Runway Orientation Based on the Wind Rose Diagram.pptx
Runway Orientation Based on the Wind Rose Diagram.pptxRunway Orientation Based on the Wind Rose Diagram.pptx
Runway Orientation Based on the Wind Rose Diagram.pptx
SupreethSP4
 
power quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptxpower quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptx
ViniHema
 

Recently uploaded (20)

Cosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdfCosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdf
 
ASME IX(9) 2007 Full Version .pdf
ASME IX(9)  2007 Full Version       .pdfASME IX(9)  2007 Full Version       .pdf
ASME IX(9) 2007 Full Version .pdf
 
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptxCFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
 
weather web application report.pdf
weather web application report.pdfweather web application report.pdf
weather web application report.pdf
 
Standard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - NeometrixStandard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - Neometrix
 
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdf
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdfGoverning Equations for Fundamental Aerodynamics_Anderson2010.pdf
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdf
 
ethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.pptethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.ppt
 
Fundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptxFundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptx
 
Hierarchical Digital Twin of a Naval Power System
Hierarchical Digital Twin of a Naval Power SystemHierarchical Digital Twin of a Naval Power System
Hierarchical Digital Twin of a Naval Power System
 
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
 
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
 
block diagram and signal flow graph representation
block diagram and signal flow graph representationblock diagram and signal flow graph representation
block diagram and signal flow graph representation
 
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
 
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang,  ICLR 2024, MLILAB, KAIST AI.pdfJ.Yang,  ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
 
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
 
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdfTop 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
 
ethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.pptethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.ppt
 
Investor-Presentation-Q1FY2024 investor presentation document.pptx
Investor-Presentation-Q1FY2024 investor presentation document.pptxInvestor-Presentation-Q1FY2024 investor presentation document.pptx
Investor-Presentation-Q1FY2024 investor presentation document.pptx
 
Runway Orientation Based on the Wind Rose Diagram.pptx
Runway Orientation Based on the Wind Rose Diagram.pptxRunway Orientation Based on the Wind Rose Diagram.pptx
Runway Orientation Based on the Wind Rose Diagram.pptx
 
power quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptxpower quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptx
 

PHP Development Tools

  • 2. Why I like PHPStorm ● You can develop applications in PHP versions 5.3/5.4/5.5/5.6/7.0/7.1, SQL & PL/SQL, JavaScript, XML, HTML, CSS. ● You can add functionality to our IDE by installing plugins (Bash, Symfony, Laravel, Magento 2, NodeJS, LiveEdit, Spy-JS, Meteor). ● Support for Vagrant and Docker, Docker Compose, SSH console & remote tools. ● Databases and SQL Editor in PhpStorm (MySQL, PostgreSQL, Oracle, SQLite, etc) ● Coding style Support PSR1/PSR2, PHPDoc support. ● Version control systems integration Git, Subversion, Mercurial, Perforce, CVS, TFS ● Duplicated Code Detector. PHP Code Sniffer (phpcs) that checks for code smells on the fly. Local History. Debugging with Xdebug and ZendDebugger.
  • 3. Advantages of Using Docker Portability across machines – an application and all its dependencies can be bundled into a single container that can be transferred to another machine that runs Docker, and executed there without compatibility issues. Version control and component reuse – you can track successive versions of a container, inspect differences, or roll-back to previous versions. Sharing – you can use a remote repository to share your container with others.
  • 5. Docker Usage ~$ docker pull node:latest ~$ docker run -it --name="angular_test" node:latest /bin/bash ~$ npm install -g @angular/cli ~$ docker build -t angular-img . ~$ docker commit -m="This a test angular image" angular_test my.gitlabrepo/test_repo ~$ docker login && docker push my/test_repo
  • 6. Docker File Example FROM php:5.6-fpm RUN apt-get update && apt-get install -y libfreetype6-dev libicu-dev libjpeg62-turbo-dev libmcrypt-dev libpng-dev libxslt1-dev RUN docker-php-ext-install gd mcrypt mbstring sockets zip xsl soap RUN pecl install xdebug-2.5.5 && docker-php-ext-enable xdebug ADD ./etc/init.d/php/run.sh /run.sh RUN curl -Lsf 'https://storage.googleapis.com/golang/go1.8.3.linux-amd64.tar.gz' | tar -C '/usr/local' -xvzf - ENV PATH /usr/local/go/bin:$PATH RUN go get github.com/mailhog/mhsendmail RUN cp /root/go/bin/mhsendmail /usr/bin/mhsendmail
  • 7. Solr Docker File FROM java:6 RUN mkdir -p /opt/solr RUN cd /tmp && curl https://archive.apache.org/dist/lucene/solr/3.6.1/apache-solr-3.6.1.tgz | tar xvz && mv -v apache-solr-3.6.1/* /opt/solr EXPOSE 8983 VOLUME ["/opt/solr/example/solr/data", "/opt/solr/example/solr/conf"] WORKDIR /opt/solr/example CMD java -jar start.jar
  • 8. Every Day Docker Commands ~$ docker ps -a ~$ docker stop|start|restart container_name ~$ docker run --name ubuntu -d ubuntu /bin/sh -c "while true; do echo hello world; sleep 1; done" ~$ docker exec -it ubuntu bash ~$ docker logs ubuntu ~$ docker history ubuntu ~$ docker stats
  • 9. Docker Search ~$ docker search node NAME DESCRIPTION STARS OFFICIAL AUTOMATED node Node.js is a JavaScript-based platform for... 5829 [OK] mhart/alpine-node Minimal Node.js built on Alpine Linux 366 mongo-express Web-based MongoDB admin interface, written... 269 [OK] nodered/node-red-docker Node-RED Docker images. 168 [OK] iojs io.js is an npm compatible platform origin... 126 [OK] prom/node-exporter 83 [OK] readytalk/nodejs Node.js based off the official Debian W
  • 10. One Line Scripts ~$ curl -s https://registry.hub.docker.com//v1/repositories/php/tags | php -r 'print_r(json_decode(file_get_contents("php://stdin")));' | grep fpm | head -20 ~$ sudo nano /usr/local/bin/docker-tags ~$ sudo chmod +x /usr/local/bin/docker-tags #!/usr/bin/env bash curl -s https://registry.hub.docker.com//v1/repositories/$1/tags | php -r 'print_r(json_decode(file_get_contents("php://stdin")));' | grep name | grep $2 | head -$3
  • 11. Docker Tags ~$ docker-tags php fpm 10 [name] => 5-fpm-alpine [name] => 5-fpm-alpine3.4 [name] => 5-fpm-alpine3.7 [name] => 5-fpm-jessie [name] => 5-fpm-stretch [name] => 5.4-fpm [name] => 5.4.35-fpm [name] => 5.4.36-fpm [name] => 5.4.37-fpm [name] => 5.4.38-fpm
  • 12. One Line Scripts PHP ~$ sudo nano /usr/local/bin/docker-tag-php #!/usr/bin/php -q <?php $repoCh = curl_init('https://registry.hub.docker.com//v1/repositories/' . $argv[1] . '/tags'); curl_setopt($repoCh, CURLOPT_RETURNTRANSFER, 1); foreach (json_decode(curl_exec($repoCh)) as $tag) { echo $tag->name . PHP_EOL; } curl_close($repoCh); ~$ sudo chmod +x /usr/local/bin/docker-tag-php
  • 13. Docker Tags PHP ~$ docker-tags-php node | grep jessie | tail -n 10 8.11-jessie 8.11.2-jessie 8.11.3-jessie 9-jessie 9.11-jessie 9.11.1-jessie 9.11.2-jessie boron-jessie carbon-jessie jessie
  • 16. docker-compose up Runs services via docker-compose util: ● db - MySql database service ● app - PHP5.6-FPM service ● web - Nginx web server ● redis - Redis session and cache storage ● mongo - Mongo NoSql storage used for price service ● rabbit - RabbitMQ queue server ● solr -Apache Solr service for fulltext search ● bps - Backend price service on Python Tornado ● fps - Frontend price service on PHP ● worker - PHP worker for background jobs ● cron - Run application schedule tasks ● mailservice - Caught all mail from application
  • 17. Docker Compose File Example version: '3' services: influx: image: influxdb volumes: - ./docker/var/lib/influx:/var/lib/influxdb - ./docker/etc/init.d/influxdb:/docker-entrypoint-initdb.d grafana: image: grafana/grafana ports: - 127.0.0.1:3000:3000 volumes: - ./docker/var/lib/grafana:/var/lib/grafana depends_on: - influx cadvisor: image: google/cadvisor ports: - 127.0.0.1:8080:8080 command: -logtostderr -docker_only -storage_driver=influxdb -storage_driver_db=cadvisor -storage_driver_host=influx:8086
  • 19. Coding style guide PSR-1 ● Files MUST use only <?php and <?= tags. ● Files MUST use only UTF-8 without BOM for PHP code. ● Files SHOULD either declare symbols (classes, functions, constants, etc.) or cause side-effects (e.g. generate output, change .ini settings, etc.) but SHOULD NOT do both. ● Namespaces and classes MUST follow an “autoloading” PSR: [PSR-0, PSR-4]. ● Class names MUST be declared in StudlyCaps. ● Class constants MUST be declared in all uppercase with underscore separators. ● Method names MUST be declared in camelCase.
  • 20. Coding style guide PSR-2 ● Code MUST use 4 spaces for indenting, not tabs. ● There MUST NOT be a hard limit on line length; the soft limit MUST be 120 characters; lines SHOULD be 80 characters or less. ● There MUST be one blank line after the namespace declaration, and there MUST be one blank line after the block of use declarations. ● Opening braces for classes MUST go on the next line, and closing braces MUST go on the next line after the body. ● Opening braces for methods MUST go on the next line, and closing braces MUST go on the next line after the body. ● Visibility MUST be declared on all properties and methods; abstract and final MUST be declared before the visibility; static MUST be declared after the visibility. ● Control structure keywords MUST have one space after them; method and function calls MUST NOT. ● Opening braces for control structures MUST go on the same line, and closing braces MUST go on the next line after the body. ● Opening parentheses for control structures MUST NOT have a space after them, and closing parentheses for control structures MUST NOT have a space before.
  • 21. File | Settings | Editor | Code Style | PHP
  • 22. PHP Code Sniffer ● WordPress-Coding-SWordPress-Coding-Standardstandards/ ● object-calisthenics/phpcs-calisthenics-rules ● yiisoft/yii2-coding-standards ● Symplify/EasyCodingStandard ● joomla/coding-standards ~$ sudo nano composer.json { "require": { "magento-ecg/coding-standard": ">=3.0", "squizlabs/php_codesniffer": "3.*" } }
  • 23. PHP CS Setup Setup PHPCS in PHPStorm: In PHPStorm open File > Settings > Languages & Frameworks> PHP > Code Sniffer Click to configuration, in opened popup click to the (+) and provide path to phpcs launcher.
  • 24. PHP MD Setup Setup PHPMD in PHPStorm: In PHPStorm open File > Settings > Languages & Frameworks> PHP > Mess Detector Click to configuration, in opened popup click to the (+) and provide path to phpmd launcher.
  • 27. Document Rules PHPDocs Rules: ● Each method in project MUST contain - @param, @return, @throws tags, and short method description. ● Each property and constant in project MUST contain - @var tag, and short property description. ● Each class and interface MUST contain - @category, @package, @author, @copyright, @license, @link and short desc. ● Each file MUST contain - @category, @package, @author, @copyright, @license, @link and NOTICE OF LICENSE ● Each public method in observe is in the listening to a magento event MUST contain - @see with value event_name ● All PHP files MUST start with php tag, and MUST contain a empty line in end of file without php close tag. ● Each deprecated method MUST contain - @depricated and @see tags, @see - class_method_with_new_functionality
  • 28. Postman Introduction Postman Postman is API development and testing tool you can download from https://www.getpostman.com/apps
  • 29. Xdebug Installation ~$ sudo apt install php-xdebug ~$ sudo phpenmod xdebug && php -m | grep xdebug ~$ sudo nano /etc/php/{php-version}/mods-available/xdebug.ini [Xdebug] zend_extension=<full_path_to_xdebug_extension> xdebug.remote_enable=1 xdebug.remote_host=<the host where PhpStorm is running (e.g. localhost)> xdebug.remote_port=<the port to which Xdebug tries to connect on the host where PhpStorm is running (default 9000)> xdebug.remote_autostart=1
  • 30. Postman Collections A Postman Collection is an Executable API Description. With Postman collections you can: ● Publishing an API collection can be done via a Run In Postman button, embedded within the publisher’s site, and downloading a Postman Collection directly into the developer’s Postman instance. ● API Monitoring is a scheduled service to run a Postman Collection, reporting results based on tests embedded in the collection, and reported in the user’s Postman dashboard. ● API Documentation publishes a shareable, customized view of the API’s Postman Collection - helping developers onboard quickly to an API. ● Developers can create a Mock Server from a collection, allowing API users to view example request & response pairs, even before the API is complete. ● Developers can Debug APIs by creating requests, adding tests, and examining responses.
  • 32. Debug PHP in Docker Our php docker image already contain Xdebug in path/to/project/docker/php-fpm.dockerfile ; xdebug configuration are in path/to/project/docker/etc/xdebug.ini ; PHP Environment Variables are in path/to/project/docker/php.env ; Environment Variables used for PHP Storm and Xdebug: XDEBUG_CONFIG=remote_host=172.17.0.1 - IDE machine IP address PHP_IDE_CONFIG=serverName=example - server name in PHPSTORM Get your IP address in docker network (ifconfig (Unix) or ipconfig (Win)) and put to remote_host ~$ ifconfig docker0 Link encap:Ethernet HWaddr ######### inet addr:172.17.0.1 Bcast:0.0.0.0 Mask:255.255.0.0 param
  • 33. Xdebug Configuration In Docker Mount to the php container xdebug.ini file next content: xdebug.default_enable=1 xdebug.remote_enable=1 xdebug.remote_handler=dbgp xdebug.remote_port=19000 xdebug.remote_autostart=1 xdebug.remote_connect_back=1 xdebug.idekey="PHPSTORM" In PHP dockerfile php-fpm.dockerfile RUN pecl install xdebug-2.5.5 && docker-php-ext-enable xdebug
  • 37. Xdebug Profiling xdebug.profiler_enable=1 or xdebug.profiler_enable_trigger=1 and activate it by XDEBUG_PROFILE GET/POST parameter. xdebug.profiler_output_dir=/path/to/volume/profiler_output
  • 38. Useful Links ● Docker & Docker-Compose https://docs.docker.com/docker-for-windows/ https://docs.docker.com/docker-for-windows/install/ https://kitematic.com/ https://docs.docker.com/compose/install/ https://docs.docker.com/compose/gettingstarted/ ● Xdebug configuration https://gist.github.com/chadrien/c90927ec2d160ffea9c4 https://xdebug.org/ https://www.jetbrains.com/help/phpstorm/configuring-xdebug.html ● Coding style guide https://www.php-fig.org/psr/psr-1/ https://www.php-fig.org/psr/psr-2/
  • 39. Useful Links (2) ● PHPMD & PHPCS & PHPDOCS https://phpmd.org/rules/index.html https://phpmd.org/download/index.html https://github.com/squizlabs/PHP_CodeSniffer https://confluence.jetbrains.com/display/PhpStorm/PHP+Code+Sniffer+in+PhpStorm https://confluence.jetbrains.com/display/PhpStorm/PHP+Mess+Detector+in+PhpStorm https://www.phpdoc.org/ https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards https://github.com/object-calisthenics/phpcs-calisthenics-rules https://github.com/magento-ecg/coding-standard https://github.com/joomla/coding-standards ● POSTMAN https://habr.com/company/kolesa/blog/351250/ https://www.getpostman.com/