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

Talk Cakefest 2023 - How to use your IDE effectivly for CakePHP

Mark Sch.
September 30, 2023

Talk Cakefest 2023 - How to use your IDE effectivly for CakePHP

Tips for an IDE-based productivity booster using plugins, annotations, and more.
Maximize the speed to develop with CakePHP, leaving every other framework lightyears behind.

Mark Sch.

September 30, 2023
Tweet

More Decks by Mark Sch.

Other Decks in Technology

Transcript

  1. About Mark Scherer @dereuromark • Senior Software Developer & Tooling

    Architect in Berlin, Germany • CakePHP Core Developer for 13+ years • Plugin specialist and Tooling expert
  2. Agenda • CakePHP 5 and PHPStorm • IdeHelper ◦ IDE

    usability and speed up tips for maximum rapid developing in CakePHP ◦ Annotations ◦ Autocomplete/Typehinting • PHPStan/Psalm compatibility
  3. CakePHP 5 and PHPStorm • By default very high support

    • Plugins recommended ◦ https:/ /plugins.jetbrains.com/plugin/9927-deep-assoc-completion see https:/ /github.com/dereuromark/cakephp-ide-helper/wiki/PHPStorm 4
  4. CakePHP 5 and PHPStorm • Settings => Inspections ◦ Code

    style: uncheck Unnecessary fully qualified name (we need this for doc blocks) ◦ General: Static method called as dynamic, uncheck if you don't want to be alerted about PHPUnit code smells. • Settings => Code Style ◦ Code Conversion => Array Declaration Style: Force short declaration style ◦ Code Conversion => Array Declaration Style: Add comma after last element in multiline array see https:/ /github.com/dereuromark/cakephp-ide-helper/wiki/PHPStorm 5
  5. IdeHelper 6 • Annotate • Generate Code Complete / Meta

    File https:/ /github.com/dereuromark/cakephp-ide-helper + (optional) https:/ /github.com/dereuromark/cakephp-ide-helper-extra
  6. Code Complete / Meta File 8 • Generate meta files

    for IDE • Very specific format/content usually
  7. Code Complete / Meta File • Magic string autocomplete from

    start to end • Route path handling ◦ UrlHelper::urlFromPath() ◦ HtmlHelper::linkFromPath() ◦ urlArray() convenience function 9
  8. Coding Session IdeHelper task as real life solution: - Queue

    createJob() and isQueued() support https:/ /github.com/dereuromark/cakephp-queue -> Queue/Generator/Task/QueuedJobTask.php - other examples? 10
  9. Coding Session IdeHelper task as real life solution: - Icons

    in templates https:/ /github.com/dereuromark/cakephp-ide-helper-extra -> src/Tools/Generator/Task/IconRenderTask.php - other examples? 11
  10. PHPStan/Psalm compatibility • Most IdeHelper adjustments already also provide support

    here. • On top use https:/ /github.com/CakeDC/cakephp-phpstan In your phpstan.neon then add 12 includes: - vendor/cakedc/cakephp-phpstan/extension.neon