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
天高くそびえ立つ巨塔によって PHPをJavaScriptに変換する
Search
potato4d(Takuma HANATANI)
July 15, 2017
Programming
0
600
天高くそびえ立つ巨塔によって PHPをJavaScriptに変換する
2017.07.15 Potato4d #phpkansai Lightning Talk
potato4d(Takuma HANATANI)
July 15, 2017
Tweet
Share
More Decks by potato4d(Takuma HANATANI)
See All by potato4d(Takuma HANATANI)
どうせキレイに書けない処理は逆にAIに書いてもらうほうが良い説 / #kyotojs 22
potato4d
3
410
TSX First な Zero-Runtime SSG potato4d/dodai とその仕組み / owned static site generator #kyotojs
potato4d
1
2.3k
Vue.js with TSX - From Vue 2.x to Vue 3 #v_tokyo11
potato4d
9
4.9k
終わりゆく Vue 2.x 時代の状態設計のアンサー - Vue 3 の Provider への期待 / The Last Architecture of the Vue 2.x
potato4d
25
7k
Web Worker を使ってブラウザ上でポケモンの画像を解析したい! / Pokemon recognition from screenshots in browser using web worker
potato4d
0
1.3k
Firebase & Google Cloud によるサーバーレス帳票管理 #FJUG / Serverless Architecture in Candy
potato4d
8
3.7k
NestJS meetup Tokyo Opening Talk / What is NestJS? #nestjs_meetup
potato4d
11
4.2k
私たちはなぜ SPA で開発するのか / Why you choose SPA
potato4d
39
27k
Amplify Console 誕生以来本番運用しつづけてわかったこと #awswakaran_tokyo
potato4d
6
3.6k
Other Decks in Programming
See All in Programming
XP, Testing and ninja testing ZOZ5
m_seki
3
620
Flutterで分数(Fraction)を表示する方法
koukimiura
0
130
バッチ処理を「状態の記録」から「事実の記録」へ
panda728
PRO
0
150
アメ車でサンノゼを走ってきたよ!
s_shimotori
0
220
高度なUI/UXこそHotwireで作ろう Kaigi on Rails 2025
naofumi
4
3.9k
CSC305 Lecture 06
javiergs
PRO
0
220
チームの境界をブチ抜いていけ
tokai235
0
160
iOSエンジニア向けの英語学習アプリを作る!
yukawashouhei
0
190
CSC509 Lecture 03
javiergs
PRO
0
330
TFLintカスタムプラグインで始める Terraformコード品質管理
bells17
2
160
iOSエンジニア向けの英語学習アプリを作る!
yukawashouhei
0
190
なぜGoのジェネリクスはこの形なのか? Featherweight Goが明かす設計の核心
ryotaros
7
1.1k
Featured
See All Featured
How STYLIGHT went responsive
nonsquared
100
5.8k
How to Ace a Technical Interview
jacobian
280
24k
YesSQL, Process and Tooling at Scale
rocio
173
14k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
15
1.7k
Building an army of robots
kneath
306
46k
GraphQLの誤解/rethinking-graphql
sonatard
73
11k
Being A Developer After 40
akosma
91
590k
Testing 201, or: Great Expectations
jmmastey
45
7.7k
The Power of CSS Pseudo Elements
geoffreycrofte
79
6k
Designing for Performance
lara
610
69k
Visualization
eitanlees
149
16k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
189
55k
Transcript
ఱߴͦ͘ͼཱ͑ͭڊౝʹΑͬͯ PHPΛJavaScriptʹม͢Δ 2017.07.15 Potato4d #phpkansai Lightning Talk
ࣗݾհ
@potato4d
None
None
ͯͨ͠
νϟϥ͍όϯυϚϯΈ͍͔ͨͩ ΒΊΖͱݴΘΕΔΞΠίϯͷ ਓ
None
օ͞Μbabel͝ଘͰ͔͢ʁ
None
ES2015+ͱ͍͏2015Ҏ߱ͷ JavaScriptΛݹ͍ES5ʹม͢Δ
ESͱ͍͏ͷ͕JavaScriptͷ ϕʔε༷Έ͍ͨͳͷ
ͦͷޙͷྐྵ͕ͦͷ࣌ͷ࣌Ͱ ͷ༷ʹͳΔ
৽͍͠JavaScriptͷػೳΛઌʹ ࢼ͢πʔϧ
ݱߦͷJavaScriptͷػೳΛݹ͍ ϒϥβͰಈ͔͢πʔϧ
html5shiv͋Δ͍Auto Prefixer
ಥવͰ͕͢͜͜Ͱ
ΫΠζͰ͢ʂ
ES20152015ͷJavaScript
ES20162016ͷJavaScript
͡Ό͋ES5Կͷ JavaScriptʁ
ͦ͏Ͱ͢Ͷ
A.D. 5Ͱ͢Ͷ
͜ͷྐྵ5ͷJavaScriptʹม ͢Δπʔϧ
͍ͬͯΔ͜ͱ ҙͷςΩετ to JS
͍ͬͯΔ͜ͱ ҙͷPHP to JS
babel-preset-php
Δ
͓ΉΖʹλʔϛφϧΛ։͘
mkdir _test
cd $_
npm init -
yarn add babel-cli babel- preset-php
> main.php
<?php $hoge=1; var_dump($hoge);
./node_modules/.bin/babel ./ main.php -o main.js
ͬͨ
ͭΒ͍ͱ͜Ζ
͍͍ͩͨಈ ͔ͳ͍
file_get_contentsಈ͔ͳ͍
xhrʹͳͬͨΓfetchʹͳͬͨΓ͠ͳ ͍
PHP to JSͷເͷπʔϧ
None
ͳ͔ͬͨ
͓·͚
ࡶʹEC-CUBEΛ Ϗϧυͯ͠ΈΔ