SlideShare ist ein Scribd-Unternehmen logo
1 von 39
Downloaden Sie, um offline zu lesen
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/

Weitere ähnliche Inhalte

Was ist angesagt?

Deploying Perl apps on dotCloud
Deploying Perl apps on dotCloudDeploying Perl apps on dotCloud
Deploying Perl apps on dotClouddaoswald
 
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_controlByeongKyu 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 mrubyHiroshi 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 WorldSATOSHI TAGOMORI
 
Ripping web accessible .git files
Ripping web accessible .git filesRipping web accessible .git files
Ripping web accessible .git filesVlatko 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 AndroidVlatko 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 VCSVlatko Kosturjak
 
parenscript-tutorial
parenscript-tutorialparenscript-tutorial
parenscript-tutorialtutorialsruby
 
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 2015Giorgio 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 MinutesHiroshi 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 #ACRVJuxi 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 crazyHonza Horák
 
Hijacking Ruby Syntax in Ruby
Hijacking Ruby Syntax in RubyHijacking Ruby Syntax in Ruby
Hijacking Ruby Syntax in RubySATOSHI TAGOMORI
 
Middleware as Code with mruby
Middleware as Code with mrubyMiddleware as Code with mruby
Middleware as Code with mrubyHiroshi SHIBATA
 
このPHP拡張がすごい!2017
このPHP拡張がすごい!2017このPHP拡張がすごい!2017
このPHP拡張がすごい!2017sasezaki
 

Was ist angesagt? (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
 

Ähnlich wie 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 Toolsrjsmelo
 
[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 2011Michelangelo 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 LibrariesPantheon
 
Toolbox of a Ruby Team
Toolbox of a Ruby TeamToolbox of a Ruby Team
Toolbox of a Ruby TeamArto Artnik
 
Using the new WordPress REST API
Using the new WordPress REST APIUsing the new WordPress REST API
Using the new WordPress REST APICaldera 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 projectCodium
 
Start tracking your ruby infrastructure
Start tracking your ruby infrastructureStart tracking your ruby infrastructure
Start tracking your ruby infrastructureSergiy Kukunin
 
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 - SunshinePHPDana Luther
 
Docker based Architecture by Denys Serdiuk
Docker based Architecture by Denys SerdiukDocker based Architecture by Denys Serdiuk
Docker based Architecture by Denys SerdiukLohika_Odessa_TechTalks
 
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 ShapovalGlobalLogic Ukraine
 
Control your deployments with Capistrano
Control your deployments with CapistranoControl your deployments with Capistrano
Control your deployments with CapistranoRamazan K
 

Ähnlich wie 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
 

Kürzlich hochgeladen

PE 459 LECTURE 2- natural gas basic concepts and properties
PE 459 LECTURE 2- natural gas basic concepts and propertiesPE 459 LECTURE 2- natural gas basic concepts and properties
PE 459 LECTURE 2- natural gas basic concepts and propertiessarkmank1
 
Hospital management system project report.pdf
Hospital management system project report.pdfHospital management system project report.pdf
Hospital management system project report.pdfKamal Acharya
 
AIRCANVAS[1].pdf mini project for btech students
AIRCANVAS[1].pdf mini project for btech studentsAIRCANVAS[1].pdf mini project for btech students
AIRCANVAS[1].pdf mini project for btech studentsvanyagupta248
 
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptxS1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptxSCMS School of Architecture
 
Double Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueDouble Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueBhangaleSonal
 
Design For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startDesign For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startQuintin Balsdon
 
data_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfdata_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfJiananWang21
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXssuser89054b
 
Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...
Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...
Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...drmkjayanthikannan
 
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...Amil baba
 
Verification of thevenin's theorem for BEEE Lab (1).pptx
Verification of thevenin's theorem for BEEE Lab (1).pptxVerification of thevenin's theorem for BEEE Lab (1).pptx
Verification of thevenin's theorem for BEEE Lab (1).pptxchumtiyababu
 
Generative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTGenerative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTbhaskargani46
 
Work-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptxWork-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptxJuliansyahHarahap1
 
Computer Lecture 01.pptxIntroduction to Computers
Computer Lecture 01.pptxIntroduction to ComputersComputer Lecture 01.pptxIntroduction to Computers
Computer Lecture 01.pptxIntroduction to ComputersMairaAshraf6
 
Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VDineshKumar4165
 
Block diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptBlock diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptNANDHAKUMARA10
 
Orlando’s Arnold Palmer Hospital Layout Strategy-1.pptx
Orlando’s Arnold Palmer Hospital Layout Strategy-1.pptxOrlando’s Arnold Palmer Hospital Layout Strategy-1.pptx
Orlando’s Arnold Palmer Hospital Layout Strategy-1.pptxMuhammadAsimMuhammad6
 
Online electricity billing project report..pdf
Online electricity billing project report..pdfOnline electricity billing project report..pdf
Online electricity billing project report..pdfKamal Acharya
 

Kürzlich hochgeladen (20)

PE 459 LECTURE 2- natural gas basic concepts and properties
PE 459 LECTURE 2- natural gas basic concepts and propertiesPE 459 LECTURE 2- natural gas basic concepts and properties
PE 459 LECTURE 2- natural gas basic concepts and properties
 
Hospital management system project report.pdf
Hospital management system project report.pdfHospital management system project report.pdf
Hospital management system project report.pdf
 
AIRCANVAS[1].pdf mini project for btech students
AIRCANVAS[1].pdf mini project for btech studentsAIRCANVAS[1].pdf mini project for btech students
AIRCANVAS[1].pdf mini project for btech students
 
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptxS1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
 
Double Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueDouble Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torque
 
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
 
Design For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startDesign For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the start
 
data_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfdata_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdf
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
 
Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...
Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...
Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...
 
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
 
Verification of thevenin's theorem for BEEE Lab (1).pptx
Verification of thevenin's theorem for BEEE Lab (1).pptxVerification of thevenin's theorem for BEEE Lab (1).pptx
Verification of thevenin's theorem for BEEE Lab (1).pptx
 
Generative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTGenerative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPT
 
Work-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptxWork-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptx
 
Computer Lecture 01.pptxIntroduction to Computers
Computer Lecture 01.pptxIntroduction to ComputersComputer Lecture 01.pptxIntroduction to Computers
Computer Lecture 01.pptxIntroduction to Computers
 
Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - V
 
Block diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptBlock diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.ppt
 
Orlando’s Arnold Palmer Hospital Layout Strategy-1.pptx
Orlando’s Arnold Palmer Hospital Layout Strategy-1.pptxOrlando’s Arnold Palmer Hospital Layout Strategy-1.pptx
Orlando’s Arnold Palmer Hospital Layout Strategy-1.pptx
 
Online electricity billing project report..pdf
Online electricity billing project report..pdfOnline electricity billing project report..pdf
Online electricity billing project report..pdf
 
Integrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - NeometrixIntegrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - Neometrix
 

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/