Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Transforming Magento (NomadMage 2017)
Search
Christopher Pitt
April 19, 2017
Programming
2
100
Transforming Magento (NomadMage 2017)
Christopher Pitt
April 19, 2017
Tweet
Share
More Decks by Christopher Pitt
See All by Christopher Pitt
Making Robots (PHP Unicorn Conf)
chrispitt
1
190
Forget What You Know
chrispitt
1
150
Monads In PHP → php[tek]
chrispitt
3
500
Breaking The Enigma → php[tek]
chrispitt
0
200
Turn on the Generator!
chrispitt
0
170
Implementing Languages (FluentConf)
chrispitt
1
350
Async PHP (Sunshine)
chrispitt
0
460
Helpful Robot
chrispitt
0
110
Async PHP
chrispitt
14
7.4k
Other Decks in Programming
See All in Programming
[SRE NEXT] 複雑なシステムにおけるUser Journey SLOの導入
yakenji
0
600
Python型ヒント完全ガイド 初心者でも分かる、現代的で実践的な使い方
mickey_kubo
1
250
レトロゲームから学ぶ通信技術の歴史
kimkim0106
0
120
新メンバーも今日から大活躍!SREが支えるスケールし続ける組織のオンボーディング
honmarkhunt
5
9.1k
MCPを使ってイベントソーシングのAIコーディングを効率化する / Streamlining Event Sourcing AI Coding with MCP
tomohisa
0
180
生成AI時代のコンポーネントライブラリの作り方
touyou
1
290
Yes, You Can Work on Rails & any other Gem
kaspth
0
110
The Modern View Layer Rails Deserves: A Vision For 2025 And Beyond @ RailsConf 2025, Philadelphia, PA
marcoroth
2
760
CDK引数設計道場100本ノック
badmintoncryer
2
520
Android 16KBページサイズ対応をはじめからていねいに
mine2424
0
570
Advanced Micro Frontends: Multi Version/ Framework Scenarios @WAD 2025, Berlin
manfredsteyer
PRO
0
410
NPOでのDevinの活用
codeforeveryone
0
930
Featured
See All Featured
How to Ace a Technical Interview
jacobian
278
23k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
130
19k
VelocityConf: Rendering Performance Case Studies
addyosmani
332
24k
YesSQL, Process and Tooling at Scale
rocio
173
14k
Side Projects
sachag
455
43k
Site-Speed That Sticks
csswizardry
10
710
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
357
30k
[RailsConf 2023] Rails as a piece of cake
palkan
55
5.7k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
181
54k
A Tale of Four Properties
chriscoyier
160
23k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
21
1.3k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
231
53k
Transcript
TRANSFORMING MAGENTO
HI
THANKS: NOMADMAGE AND NOMADPHP
DISCLAIMER: I'M REALLY NEW
DISCLAIMER: HERE BE DRAGONS
! composer require tinify/magento2
LOOK AT THESE GETTERS AND SETTERS
EVER MISS FEATURES FROM ANOTHER LANGUAGE?
TECHNICALLY: MAGIC METHODS
IMAGINE WE COULD USE THIS SYNTAX...
ALAS, THE TESTS FAIL
! composer require pre/class-accessors
WHAT'S THIS, THE TESTS PASS
WHAT HAPPENED?
WHAT IF WE WANT OUR OWN MAGIC METHODS?
YOU HEAR ABOUT THE TRAILING COMMAS PROPOSAL?
wiki.php.net/rfc/list-syntax-trailing-commas
SIDETRACK: STRANGE INCONSISTENCIES...
LET'S TRY
! composer require pre/trailing-commas
SOMETHING SERIOUSER
HANDS UP IF YOU'VE EVER USED DEPENDENCY INJECTION
LOOK AT THAT XML!
! composer require pre/parameter-loaders
! composer require pre/property-loaders
CODE YOUR MUM WOULD APPROVE OF
SOMETHING SIMPLER
EVER OPEN A FILE HANDLE ...OR CREATE A MUTEX LOCK?
CAN'T RETURN IMMEDIATELY BECAUSE OF STUPID FILES
! composer require pre/deferred
WITH 50% MORE BLOCKS
$handle = fopen("path/to/file); defer { fclose($handle); unlink("path/to/file"); } return fgets($handle);
HOW DOES THIS WORK?
SPOILERS: JUNE 22ND, NOMADPHP
PAUL'S [FOURTH] STANDARDS RECOMMENDATION
COMPILES: File.pre ! File.php
github.com/marcioAlmada/yay
WHAT DOES THIS CODE LOOK LIKE?
class Sprocket { public $name = new Translatable(static::class); public function
turn($spanner = factory("spanner")) { return $spanner->use($this); } }
class Sprocket { use \Pre\PropertyLoaders\PropertyLoadersTrait; private $name; private function loadNameProperty()
{ $this->name = new Translatable(static::class); } public function turn($spanner = null) { if (is_null($spanner)) { $spanner = factory("spanner"); } return $spanner->use($this); } }
! composer require friendsofphp/php-cs-fixer
IS IT SLOW?
! composer du -o
! composer dump-autoload --optimize
MAKES A LOCK FILE
GREAT FOR DEV GREAT FOR PROD
CAN I USE THIS TO MAKE MY OWN SYNTAX?
OTHER THINGS: ▸ immutable classes ▸ short arrow functions
WHY WOULD I USE THIS?
REASONS TO USE: ▸ You like the syntax I've shown
▸ You repeat code ▸ You repeat code
REASONS TO USE: ▸ New syntax could be clearer and
more concise ▸ You want features from other languages ▸ You want to support old PHP
process .."/helpers.pre";
process __DIR__ . "/helpers.pre";
\Pre\processAndRequire(__DIR__ . "/helpers.pre");
process __DIR__ . "/helpers.pre";
process .."/helpers.pre";
REASONS NOT TO USE: ▸ No IDE support ▸ You
have to teach developers new syntax ▸ You have to learn how .gitignore files work
HOW TO GET THOSE REASONS OFF THE PLANE: [HUMANELY] ▸
Pay someone to develop IDE support (or do it yourself) ▸ Help me make the docs better ▸ Learn how .gitignore files work
twitter.com/assertchris preprocess.io