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
530
天高くそびえ立つ巨塔によって 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
310
TSX First な Zero-Runtime SSG potato4d/dodai とその仕組み / owned static site generator #kyotojs
potato4d
1
2k
Vue.js with TSX - From Vue 2.x to Vue 3 #v_tokyo11
potato4d
9
4.7k
終わりゆく Vue 2.x 時代の状態設計のアンサー - Vue 3 の Provider への期待 / The Last Architecture of the Vue 2.x
potato4d
25
6.8k
Web Worker を使ってブラウザ上でポケモンの画像を解析したい! / Pokemon recognition from screenshots in browser using web worker
potato4d
0
1.2k
Firebase & Google Cloud によるサーバーレス帳票管理 #FJUG / Serverless Architecture in Candy
potato4d
8
3.6k
NestJS meetup Tokyo Opening Talk / What is NestJS? #nestjs_meetup
potato4d
11
3.9k
私たちはなぜ SPA で開発するのか / Why you choose SPA
potato4d
39
26k
Amplify Console 誕生以来本番運用しつづけてわかったこと #awswakaran_tokyo
potato4d
6
3.4k
Other Decks in Programming
See All in Programming
聞き手から登壇者へ: RubyKaigi2024 LTでの初挑戦が 教えてくれた、可能性の星
mikik0
1
130
Less waste, more joy, and a lot more green: How Quarkus makes Java better
hollycummins
0
100
アジャイルを支えるテストアーキテクチャ設計/Test Architecting for Agile
goyoki
9
3.3k
Jakarta EE meets AI
ivargrimstad
0
590
Generative AI Use Cases JP (略称:GenU)奮闘記
hideg
1
290
Amazon Qを使ってIaCを触ろう!
maruto
0
400
What’s New in Compose Multiplatform - A Live Tour (droidcon London 2024)
zsmb
1
470
3rd party scriptでもReactを使いたい! Preact + Reactのハイブリッド開発
righttouch
PRO
1
600
TypeScriptでライブラリとの依存を限定的にする方法
tutinoko
2
660
初めてDefinitelyTypedにPRを出した話
syumai
0
400
CSC509 Lecture 12
javiergs
PRO
0
160
Pinia Colada が実現するスマートな非同期処理
naokihaba
4
220
Featured
See All Featured
What’s in a name? Adding method to the madness
productmarketing
PRO
22
3.1k
Unsuck your backbone
ammeep
668
57k
Put a Button on it: Removing Barriers to Going Fast.
kastner
59
3.5k
Making Projects Easy
brettharned
115
5.9k
Statistics for Hackers
jakevdp
796
220k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
356
29k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
169
50k
Bash Introduction
62gerente
608
210k
The Straight Up "How To Draw Better" Workshop
denniskardys
232
140k
Designing for Performance
lara
604
68k
Building Flexible Design Systems
yeseniaperezcruz
327
38k
Facilitating Awesome Meetings
lara
50
6.1k
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Λ Ϗϧυͯ͠ΈΔ