bringing modern php development to ibm i (zendcon 2016)
TRANSCRIPT
@asgrim
Bringing Modern PHP Development to IBM i
James TitcumbZendCon 2016
Who is this guy?
James Titcumbwww.jamestitcumb.com
www.roave.com
www.phphants.co.uk
www.phpsouthcoast.co.uk
@asgrim
@asgrim
ZendCon 2015.
@asgrim
Hey James!
@asgrim
Sure...
@asgrim
...
@asgrim
IBM i
@asgrim
Let’s get comfortable.
@asgrim
RPG
@asgrim
RPG !== Rocket Propelled Grenade
@asgrim
The preconception...
@asgrim
@asgrim
Image: http://www.gregdonner.org/workbench/wb_10.html
@asgrim
But.
@asgrim
tn5250
@asgrim
CALL QP2TERM
@asgrim
@asgrim
SSH
@asgrim
BASH
@asgrim
~/.profile
SHELL=/bin/bash exec /bin/bash
# or /QOpenSys/QIBM/ProdData/OPS/tools/bin/bash
@asgrim
~/.bashrc
# set a fancy prompt (non-color, unless we know we "want" color)
case "$TERM" in
xterm-color) color_prompt=yes;;
esac
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u' \
'@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
export PATH=$PATH:/usr/local/zendsvr6/bin
@asgrim
vi
$ vi <filename>
xterm-256color: Unknown terminal type
[Hit return to continue]
@asgrim
vi
$ export TERM=xterm
$ vi <filename>
@asgrim
Permissions
@asgrim
git
@asgrim
GitHub
@asgrim
http://yips.idevcloud.com/wiki/index.php/PASE/Git
@asgrim
PHP !!!
@asgrim
@asgrim
Composer
@asgrim
Composer installation
$ php -r "copy('https://getcomposer.org/installer',
'composer-setup.php');"
$ php -r "if (hash_file('SHA384', 'composer-setup.php') ===
'...') { echo 'Installer verified'; } else { echo
'Installer corrupt'; unlink('composer-setup.php'); } echo
PHP_EOL;"
$ php composer-setup.php
$ php -r "unlink('composer-setup.php');"
@asgrim
Composer installation
$ mv composer.phar /usr/local/zendsvr6/bin/composer
$ composer ______ / ____/___ ____ ___ ____ ____ ________ _____ / / / __ \/ __ `__ \/ __ \/ __ \/ ___/ _ \/ ___// /___/ /_/ / / / / / / /_/ / /_/ (__ ) __/ /\____/\____/_/ /_/ /_/ .___/\____/____/\___/_/ /_/
Composer version 1.2.1 2016-09-12 11:27:19
$
@asgrim
GitHub Flow
@asgrim
master
@asgrim
my-feature
master
@asgrim
my-feature
master
@asgrim
my-feature
master
@asgrim
Rebasing
@asgrim
my-featureA
master
B
@asgrim
my-featureA
master
B
A
@asgrim
my-featureA
master
B
A
B
@asgrim
my-feature
master
A
B
@asgrim
master
A
B
!my-feature
A
B
@asgrim
my-feature
master
A
B
A
B
!
@asgrim
Development Practices
@asgrim
Code Defensively
@asgrim
SOLID
@asgrim
Composition over Inheritance
@asgrim
Composition over Inheritance
final class Thing implements ThingInterface{ public function foo() { // (does something) }}final class CachingThing implements ThingInterface{ public function __construct(ThingInterface $real, CacheInterface $cache) { $this->real = $real; $this->cache = $cache; } public function foo() { if (!$this->cache->has('foo')) { $this->cache->put('foo', $this->real->foo()); } return $this->cache->get('foo'); }}
@asgrim
Testing
@asgrim
Naming things
@asgrim
Separation of concerns
@asgrim
Use PHP 7 (when it’s out)
@asgrim
Automate all the things!
@asgrim
phpunit
@asgrim
xdebug
@asgrim
phpcs
@asgrim
phpmd
@asgrim
Your favourite IDE
@asgrim
phpcpd
@asgrim
php -l <filename>
@asgrim
Behat
@asgrim
Continuous Integration
@asgrim
Jenkins
@asgrim
jenkins-php.org
@asgrim
Bamboo
@asgrim
TeamCity + Upsource
@asgrim
Run it on IBM i
@asgrim
Integrate with GitHub
@asgrim
@asgrim
Code Review
@asgrim
Code Reviews
@asgrim
Good design
@asgrim
Semantics & Readability
@asgrim
Does it actually work?
@asgrim
Security
@asgrim
Performance
@asgrim
@asgrim
Behat on IBM i
@asgrim
Local Development
@asgrim
Vagrant
@asgrim
What about Docker?
@asgrim
Database
@asgrim
DB2 for LUW vs DB2 for i
@asgrim
https://github.com/alanseiden/doctrine-dbal-ibmi
@asgrim
Doctrine ORM
@asgrim
Migrations
@asgrim
Deployment
@asgrim
Deployment Automation
@asgrim
Rollback
@asgrim
Summary
● Set up a familiar working environment● Git + GitHub● Use Zend Server for PHP● Composer for dependencies● GitHub Flow + rebasing branching strategy● Use good development practices● Automate testing, coverage, coding standards, etc.● Set up Continuous Integration builds● Code Review every change (PR)● Local development makes things easier● Use a good DBAL● One-click-deployments are mandatory
Any questions?
http://joind.in/
James Titcumb @asgrim