Local development improvements

9748d71c4e18135a4f044d5b93af0ee3?s=47 wernerkrauss
September 23, 2020

Local development improvements

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

TwistedBytes' vagrant box: www.derkbox.com

9748d71c4e18135a4f044d5b93af0ee3?s=128

wernerkrauss

September 23, 2020
Tweet

Transcript

  1. Local development improvements TwistedBytes’ Vagrant Box & PHPStorm Tips and

    Tricks
  2. 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
  3. 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
  4. Vagrant

  5. 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
  6. What do we need? • PHPStorm / Intellij Idea •

    VirtualBox and Vagrant • Hostmanager plugin for nice local URLs • TwistedBytes’ webserver box aka DerkBox(box templates)
  7. 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...
  8. The Box

  9. Eat fresh: only the best ingredients • Apache with PHP

    5.6, 7.0, …, 7.4, 8.0-beta • MariaDB, PostgreSQL • PhpMyAdmin • Mailcatcher • redis • sspak
  10. Configure box via Vagrantfile •

  11. 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
  12. PMA: PhpMyAdmin • available under “<host>/pma” • Import dumps from

    “vagrant/pma_upload”
  13. 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
  14. Still not enough? • add your own binaries to vagrant/private/bin

  15. The IDE

  16. Configuring PHPStorm • Add box as remote PHP interpreter •

    Setup Composer • Xdebug & PHPUnit path mapping
  17. 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
  18. 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)
  19. PHPUnit • Run tests remotely from your IDE • nice

    output • one click to the source of errors • possibility to debug unit tests
  20. 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
  21. Advanced Change xdebug settings for ngrok • php.ini changes can

    be done in vagrant/config/ php-fpm-pool.conf
  22. Thank you www.silverstrip.es www.netwerkstatt.at