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
72
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
130
Forget What You Know
chrispitt
1
120
Monads In PHP → php[tek]
chrispitt
3
410
Breaking The Enigma → php[tek]
chrispitt
0
120
Turn on the Generator!
chrispitt
0
140
Implementing Languages (FluentConf)
chrispitt
1
300
Async PHP (Sunshine)
chrispitt
0
380
Helpful Robot
chrispitt
0
87
Async PHP
chrispitt
14
7k
Other Decks in Programming
See All in Programming
Zero Waste, Radical Magic, and Italian Graft – Quarkus Efficiency Secrets
hollycummins
0
230
Milestoner
bkuhlmann
1
410
PHP8.3の機能を振り返る / Review of PHP 8.3 features
seike460
PRO
1
110
Snowflakeで眠ったデータを起こそう!
estie
0
110
コーンフレークから始める モデリング会話入門
ogurotakayuki
0
340
Prepare for Jakarta EE 11 - Performance and Developer Productivity
ivargrimstad
0
670
R言語の環境構築と基礎 Tokyo.R 112
bob3bob3
0
250
Netty Chicago Java User Group 2024-04-17
sullis
0
170
OpenAPIを中心に考えるAPI開発入門 / Introduction to API Development with a Focus on OpenAPI
seike460
PRO
2
160
if constexpr文はテンプレート世界のラムダ式である
faithandbrave
3
620
チーム力を高めるスクラム実践法:カンバン公開と課題攻略について - ニフティのスクラムトーク Vol. 2 - NIFTY Tech Talk #18
niftycorp
PRO
1
110
ONE WEDGE_company_guide
1wedge_one
0
430
Featured
See All Featured
Dealing with People You Can't Stand - Big Design 2015
cassininazir
356
22k
jQuery: Nuts, Bolts and Bling
dougneiner
59
7.1k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
1
3.4k
Build your cross-platform service in a week with App Engine
jlugia
225
17k
How GitHub (no longer) Works
holman
304
140k
Building Flexible Design Systems
yeseniaperezcruz
318
37k
Scaling GitHub
holman
457
140k
In The Pink: A Labor of Love
frogandcode
138
21k
Fireside Chat
paigeccino
20
2.6k
Large-scale JavaScript Application Architecture
addyosmani
504
110k
What's in a price? How to price your products and services
michaelherold
237
11k
It's Worth the Effort
3n
180
27k
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