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
130
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
230
Forget What You Know
chrispitt
1
170
Monads In PHP → php[tek]
chrispitt
3
560
Breaking The Enigma → php[tek]
chrispitt
0
250
Turn on the Generator!
chrispitt
0
180
Implementing Languages (FluentConf)
chrispitt
1
370
Async PHP (Sunshine)
chrispitt
0
500
Helpful Robot
chrispitt
0
150
Async PHP
chrispitt
14
7.5k
Other Decks in Programming
See All in Programming
Cyrius ーLinux非依存にコンテナをネイティブ実行する専用OSー
n4mlz
0
240
Geminiをパートナーに神社DXシステムを個人開発した話(いなめぐDX 開発振り返り)
fujiba
0
100
Fundamentals of Software Engineering In the Age of AI
therealdanvega
2
290
守る「だけ」の優しいEMを抜けて、 事業とチームを両方見る視点を身につけた話
maroon8021
3
1.3k
PHPのバージョンアップ時にも役立ったAST(2026年版)
matsuo_atsushi
0
240
AI時代のシステム設計:ドメインモデルで変更しやすさを守る設計戦略
masuda220
PRO
6
1.1k
What Spring Developers Should Know About Jakarta EE
ivargrimstad
0
620
CSC307 Lecture 15
javiergs
PRO
0
260
我々はなぜ「層」を分けるのか〜「関心の分離」と「抽象化」で手に入れる変更に強いシンプルな設計〜 #phperkaigi / PHPerKaigi 2026
shogogg
2
390
Java 21/25 Virtual Threads 소개
debop
0
270
ロボットのための工場に灯りは要らない
watany
12
3.2k
存在論的プログラミング: 時間と存在を記述する
koriym
4
480
Featured
See All Featured
16th Malabo Montpellier Forum Presentation
akademiya2063
PRO
0
79
Primal Persuasion: How to Engage the Brain for Learning That Lasts
tmiket
0
300
Redefining SEO in the New Era of Traffic Generation
szymonslowik
1
250
The SEO Collaboration Effect
kristinabergwall1
0
400
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
10
1.1k
Agile Actions for Facilitating Distributed Teams - ADO2019
mkilby
0
160
How to Think Like a Performance Engineer
csswizardry
28
2.5k
More Than Pixels: Becoming A User Experience Designer
marktimemedia
3
360
Building a Scalable Design System with Sketch
lauravandoore
463
34k
Building Applications with DynamoDB
mza
96
7k
Side Projects
sachag
455
43k
Max Prin - Stacking Signals: How International SEO Comes Together (And Falls Apart)
techseoconnect
PRO
0
130
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