Drupal 8 handsdown learning, tips & tricks

Artem Miroshnyk

Artem Miroshnyk

m1r1k

  • Novasol A/S
  • Web developer
  • Open source contributor

Agenda

  • Required fundamentals
  • Symfony and Drupal APIs
  • Code examples
  • Tools like xDebug, IDEs, composer
  • Useful tools
  • Questions

Required fundamentals

PHP 5.4+

Required fundamentals

PHP 5.4+

  • OOP
  • PSR standards
  • Traits
  • Anonymous functions
  • Exceptions

Required fundamentals

PHP 5.4+

Symfony

  • DI & DIC - https://goo.gl/9SK1h9
  • HTTP Foundation - http://goo.gl/XqCa6B

Symfony API

Components in D8 core

(that you will use/touch/debug at least couple of times per project)

  • Dependency injection
  • Serializer
  • Validator
  • Http Foundation
  • EventDispatcher
  • Twig!

New Drupal 8 API

  • Entity API

  • Configuration management
  • Routing & Controllers
  • Services
  • Plugins

What is the easiest way to write common piece of code?

What is the easiest way to write common piece of code?

Copy & Paste & Modify

or for better remembering

Rewrite it manually from example

What is the best place for implementation example?

What is the best place for implementation example?

Fancy documentation!

What is the best place for implementation example?

Fancy documentation!

Code from core or contrib module

  • ~1000 interfaces
  • ~10,000 classes
  • Type hinting where possible

Drupal 8 + vendors code base

Use IDEs

Please

Use IDEs

  • Deep code suggestion
  • Deep errors/warnings highlighting
  • Fast and intelligent search
  • Plugins for Drupal and Symfony  

Do not use dpm($node);

Please

Use Xdebug

  • Break points/ conditional breakpoints

  • Call stack with variables values for each step

  • Flexible real time watchers

  • Built-in profiler (but XhProf is better still :))

  • All variables from current scope

  • Debug everything - Webpage, Rest calls, Ajax, Drush, PHPUnit, Behat, etc 

Composer

  • Class autoloading
  • Dependency manager
  • Project builder
  • https://packagist.org/

Drupal Console

https://drupalconsole.com/

Drupal Console

https://www.drupal.org/list-changes/drupal

Change records

https://www.drupal.org/list-changes/drupal

Thank you

Questions?

Made with Slides.com