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
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Christopher Pitt
April 19, 2017
Programming
140
2
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Transforming Magento (NomadMage 2017)
Christopher Pitt
April 19, 2017
More Decks by Christopher Pitt
See All by Christopher Pitt
Making Robots (PHP Unicorn Conf)
chrispitt
1
240
Forget What You Know
chrispitt
1
180
Monads In PHP → php[tek]
chrispitt
3
580
Breaking The Enigma → php[tek]
chrispitt
0
270
Turn on the Generator!
chrispitt
0
190
Implementing Languages (FluentConf)
chrispitt
1
380
Async PHP (Sunshine)
chrispitt
0
530
Helpful Robot
chrispitt
0
170
Async PHP
chrispitt
14
7.5k
Other Decks in Programming
See All in Programming
自作OSでスライド発表する
uyuki234
1
3.6k
「なぜそう決めたのか」を残し続ける仕組み ― Notion AI カスタムエージェント × Slack連携による設計判断の自動記録 - NIKKEI Tech Talk #47
niftycorp
PRO
0
250
TAKTでAI駆動開発の品質を設計する
j5ik2o
7
1.6k
Observability in Practice:Grafana 與 Edge Device SRE 的那些事
blueswen
0
180
これからAgentCoreを触る方へトレンドはGatewayです
har1101
6
460
The NotImplementedError Problem in Ruby
koic
1
1.1k
はてなアカウント基盤 State of the Union
cockscomb
1
1.2k
Even G2とAWSで推しのエージェントを召喚しよう!
har1101
1
140
AI時代のUIはどこへ行く?その2!
yusukebe
22
7.7k
Snowflake Summitでの新機能 CoCo / CoWork / snowflake-summit-2026-overall-what-new-coco
tatsuhiro
1
210
SREは、MCPとSRE Agentをこう使え!
kazumax55
0
130
スマートグラスで並列バイブコーディング
hyshu
0
270
Featured
See All Featured
Taking LLMs out of the black box: A practical guide to human-in-the-loop distillation
inesmontani
PRO
3
2.3k
The Spectacular Lies of Maps
axbom
PRO
1
840
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
17k
Building Flexible Design Systems
yeseniaperezcruz
330
40k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
23k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
130k
The SEO Collaboration Effect
kristinabergwall1
1
500
Why Your Marketing Sucks and What You Can Do About It - Sophie Logan
marketingsoph
0
180
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
10k
Why Mistakes Are the Best Teachers: Turning Failure into a Pathway for Growth
auna
0
180
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.8k
StorybookのUI Testing Handbookを読んだ
zakiyama
31
6.8k
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