Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Local development improvements

wernerkrauss
September 23, 2020

Local development improvements

Talk given at https://2020.stripecon.eu

TwistedBytes' vagrant box: www.derkbox.com

wernerkrauss

September 23, 2020
Tweet

More Decks by wernerkrauss

Other Decks in Programming

Transcript

  1. Who am I? • Werner M. Krauß • Living in

    Bad Ischl, Austria • wmk on slack • PHP since 1998 • Freelancer since 2006 (netwerkstatt) • Silverstripe since 2009 (V 2.3) • Creator of www.silverstrip.es
  2. What’s this talk about? • My development setup ◦ PHPStorm

    ◦ Vagrant ◦ Derk’s TwistedBytes Vagrant box • Cool settings to ease the daily development tasks • Tips and tricks
  3. Pros and Cons + easy set up virtual machine for

    local development + same development environment for the whole team + many ways to configure it + preconfigured boxes with huge functionalities - slow shared folder on windows - upgrading the box destroys it’s database
  4. What do we need? • PHPStorm / Intellij Idea •

    VirtualBox and Vagrant • Hostmanager plugin for nice local URLs • TwistedBytes’ webserver box aka DerkBox(box templates)
  5. PHPStorm Vagrant tools • The IDE can control and communicate

    with the VM • Shortcuts for starting, stopping, suspending, resuming, reloading and destroying the VM • can easily connect to the VM and configure paths, PHP interpreter, composer, PHPUnit etc...
  6. Eat fresh: only the best ingredients • Apache with PHP

    5.6, 7.0, …, 7.4, 8.0-beta • MariaDB, PostgreSQL • PhpMyAdmin • Mailcatcher • redis • sspak
  7. Box Configuration • a bunch of config files in different

    directories • configure webserver root and https • install additional packages • Switch PHP versions on the fly • Switch xdebug on and off • import/export databases • folder for PHPMyAdmin’s database imports
  8. Built in DB import & export • can be triggered

    from vagrant/private/ mysqldump-trigger.conf and mysqlload-trigger.conf • saves and loads dumps in own folder
  9. Configuring PHPStorm • Add box as remote PHP interpreter •

    Setup Composer • Xdebug & PHPUnit path mapping
  10. Composer • manage packages on the box • Installs via

    remote interpreter on the box • no need to match the local PHP version • caveat: github token for composer might be needed
  11. Xdebug • Cannot live without it • Easy mapping with

    PHPStorm • Slows down PHP Interpreter • Can be switched off in the box if not needed (e.g. for frontend work)
  12. PHPUnit • Run tests remotely from your IDE • nice

    output • one click to the source of errors • possibility to debug unit tests
  13. remote tools run commands on the vagrant box with one

    click • flush caches ◦ use “silverstripe-cache” folder in project root • vendor expose • dev/build • sake
  14. Advanced Change xdebug settings for ngrok • php.ini changes can

    be done in vagrant/config/ php-fpm-pool.conf