Slide 1

Slide 1 text

஌ΒΕ͟Δੈք ʙWEBҎ֎ͷPHPʙ 2017/08/05 builderson tokyo 2017

Slide 2

Slide 2 text

WHO AM I » uzulla » PHPer » Hachioji

Slide 3

Slide 3 text

» ॴ࣋͠Ό΋͡ » ίϐϖʢεϐʔΧʔ෼ʣ » ੬ऑੑʢݸਓεϙϯαʔ ෼ʣ

Slide 4

Slide 4 text

஌ΒΕ͟Δੈքͱ͸ Έͳ͞Μ͕ීஈݟͳ͍PHPͷੈքͰɺ͞Βʹ࿩୊ʹͳΒ ͳ͍PHPͷָ͠Έʹ͍ͭͯ࿩͠·͢ɻ ʢͨͱ͑͹ɺawesome-phpʹ͸ͷΒͳ͍Α͏ͳ΋ͷͷ ͜ͱͰ͢ʣ ͳ͓ɺࠓ೔͸೔༵೔Ͱ͸ͳ͘౔༵೔Ͱ͢(ωλ͕௨͡Δ ͔Θ͔Βͳ͍) جຊతʹ͸ࢲͷझຯͰ͢ɻPHP͕झຯͳͷͰɻ

Slide 5

Slide 5 text

» PHPΛ΍͍ͬͯΔํɺ͜͜ʹͲΕ͘Β͍͍Βͬ͠Ό ͍·͢ʁ » PHPҎ֎ͷํ΋ʮPHPʹͰ͖Δ͜ͱͳΜͰʯɺͨͿ ΜͦͪΒͷݴޠͰ΋Ͱ͖·͢Ͷɻ ͨͷ͠Έ·͠ΐ͏ɻ » ͳ͓ɺ͜ͷձ৔͜ͷ࣌ؒ͸ே৯ͱίʔώʔ͕͍ͨͩ ͚·͢ʂͦͪΒ΋ੋඇָ͠Έ·͠ΐ͏ɺݎۤ͘͠ͳ ͍ײ͡Ͱ૒ํ͍͚Ε͹޾͍Ͱ͢ɻ

Slide 6

Slide 6 text

DISCLAIMER » Don't take anything as truth. » Totally my personal point of view.

Slide 7

Slide 7 text

!"# WHY PHP?

Slide 8

Slide 8 text

!"# I'M PHPER, THAT IS WHY.

Slide 9

Slide 9 text

ୈ1ूɺPHP͸εϚϗͷເΛݟΔ͔ʁ ݱࡏͷϓϩάϥϛϯάͷՖܗͱ͍͑͹ɺεϚϗΞϓϦɻ ͸ͨͯ͠εϚϗΞϓϦ͸PHPͰ࡞Δࣄ͕Ͱ͖Δͷ͔ʁ

Slide 10

Slide 10 text

Ͱ͖Δʹ͖·͍ͬͯΔʂʂ (ओ؍)

Slide 11

Slide 11 text

PHAP

Slide 12

Slide 12 text

No content

Slide 13

Slide 13 text

No content

Slide 14

Slide 14 text

͍͢͝ʂʂ (͍ΖΜͳҙຯͰʣ

Slide 15

Slide 15 text

» Reddit΍HackerNewsͰ΋࿩୊ʹɺϒΫϚ΋͍ͭͨ » https://news.ycombinator.com/item? id=10901307 » https://www.reddit.com/r/PHP/comments/ 40xcjt/phapmobileappsinphp/ » http://b.hatena.ne.jp/entry/ phap.landingpage.io/ (67ϒΫϚ)

Slide 16

Slide 16 text

ࢲʮࠓ͙͢ొ࿥΍ʂʂʯ

Slide 17

Slide 17 text

ବ՛ࢠ՛ࢠ

Slide 18

Slide 18 text

» http://phap.landingpage.io/ <= 404 » https://web.archive.org/web/20160728132616/ http://phap.landingpage.io:80/ <= ?

Slide 19

Slide 19 text

» Ұ౓΋ϦϦʔεͳͲ͸ͳ͘ɺফ͑·ͨ͠ » ·͋ɺδϣʔΫͩͬͨΜͰ͠ΐ͏ » (ϝϧΞυΛूΊΔ࠮ٗͩͬͨͷͰ͸ʁ) » (ͳ͓ɺফ͑ͨ͜ͱ͸࿩୊ʹͳΒͳ͔ͬͨɺ΢Υον ͯͨ͠ͷ͸ࢲ͘Β͍ͩΖ͏…)

Slide 20

Slide 20 text

ʮ҆Β͔ʹ຾Ε…ʯ

Slide 21

Slide 21 text

(Έͳ͞Μͷ৺ڥ) ʮ͑ͬɺ·͔͞ͷӕͩͬͨͷʂʁʯ (ࢲ) ʮ·͋଴ͬͯʯ

Slide 22

Slide 22 text

kikApp

Slide 23

Slide 23 text

No content

Slide 24

Slide 24 text

No content

Slide 25

Slide 25 text

No content

Slide 26

Slide 26 text

ࠓ͙͢μ΢ϯϩʔυͰ͖Δʂʂ » (Ϣʔβʔొ࿥͸ඞཁͰ͢)

Slide 27

Slide 27 text

σϞ » ࢼ͠ʹ࡞ͬͯΈͨ » Android apk » http://bit.ly/2tR5MaN

Slide 28

Slide 28 text

౰ͨΓલ͚ͩͲɺ » ࣮ػͰ΋͏͖͝·͢ » https:// photos.app.goo.gl/ ZrliqfsCTE65A9bt2 » ݟ͍ͨਓ͸ޙͰ੠͔͚ͯԼ ͍͞

Slide 29

Slide 29 text

ࢼ͠ํ » android൛ΛϏϧυ͢ΔྲྀΕ

Slide 30

Slide 30 text

ࣄલʹ » java8ΛDLͯ͠ೖΕΔ » ʢ7ͩͱɺॺ໊ͰίέΔʣ » Android studioΛೖΕΔ » Android SDK͚ͩͰ΋͍͍͔΋

Slide 31

Slide 31 text

» େମͷ৘ใ͸wikiʹ͋Δʢ͔΋͠Εͳ͍ʣ » https://wiki.kikapptools.com/ » αΠϯΞοϓͯ͠downloadϦϯΫΛͨͲΔ » CLIΛͱΓ͋͑ͣDLͯ͠ղౚ

Slide 32

Slide 32 text

ղౚͨ͠ϑΝΠϧͷதͷɺ AndroidConfiguration.propertiesΛฤू͢Δ ### jdkͱ͍͍ͭͭɺbin·ͰೖΕΔ jdk_directory=/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/bin/ ### android_sdkͷ৔ॴ͸ ~/Library/Android/sdk android_sdk=/Users/uzulla/Library/Android/sdk

Slide 33

Slide 33 text

ղౚͯ͠Ͱ͖ͯͨkikappΛىಈ͢Δͱɺॳճ͸Ϣʔβʔ IDͱPasswordΛฉ͔ΕΔͷͰೖྗ $ ./kikapp You need to login User > uzulla Password > ****** Hi, uzulla!! KikApp > kikAppͷγΣϧ্ཱ͕͕ͪΔ

Slide 34

Slide 34 text

ͦͷ··kikappͷshellͰ৽نϓϩδΣΫτΛ࡞Δ KikApp > new -testapp -/tmp/kikappsrc/ » testapp͕ΞϓϦ໊ ʢΞϓϦ໊͸ॏෳෆՄʣ » /tmp/kikappsrc/ ͕ϕʔεσΟϨΫτϦʹͳΓ ʢϑϧύεΛࢦఆ͠ͳ͍ͱɺޙʑॺ໊ͰίέΔʣ ʢύεʹϋΠϑϯ͕͋ΔͱΤϥʔʹͳΔʢʣʣ » /tmp/kikappsrc/testapp ʹϑΝΠϧ͕࡞ΒΕΔ ʢ͜͜Β΁Μ৭ʑΞϯυΩϡϝϯτͳ᠘ָ͕͔͋ͬͯͬͨ͠ʢʣʣ

Slide 35

Slide 35 text

Ұ౓ดͨ͡ʢkikAppΛऴྃͨ͠ʣ৔߹ɺ࠶౓։͘ʹ͸ γΣϧ͔ΒҎԼͷΑ͏ʹ KikApp > open -/tmp/kikappsrc/testapp

Slide 36

Slide 36 text

/tmp/kikappsrc/projectͷத ʹίʔυ͕͋Γɺ main.php͕ओͱͳΔϑΝΠϧ Ͱ͋ΔͷͰमਖ਼ɻ ͦͯ͠Ϗϧυ KikApp > build (Ϗϧυ͸ͳʹΛ΍͍ͬͯΔͷ ͔Α͘Θ͔Βͳ͍͕ɺ݁ߏͳ ͕͔͔࣌ؒΔ)

Slide 37

Slide 37 text

» ʮ΍ͬͨͥɺ͍ͭʹPHPerʹ΋ಌΕͷʰίϯύΠϧத Ͱ͔͢Βʱͱ͍͏ݴ͍༁ʢʁʣ͕Ͱ͖Δʂʯ » ͜ͷ࣌ɺAndroid/main/build/outputs/apk/ҎԼʹ apk͕Ͱ͖͍ͯΔ

Slide 38

Slide 38 text

KikApp > run ͢ΔͱɺAndroidΤϛϡϨʔλ্ཱ͕͕ͪΔ …ϋζΒ͍͠ͷ͕ͩɺ্ཱ͕ͪͬͨࢼ͠͸ͳ͍ खಈͰAndroid Studio͔ΒԾ૝ϚγϯΛͭ͘ΓɺͦΕ Λىಈͨ͠··run͢Δͱಈ͘ɻ

Slide 39

Slide 39 text

ͱ͍ͬͨͳΜ΍͔Μ΍Ͱ

Slide 40

Slide 40 text

No content

Slide 41

Slide 41 text

setCaption("Hello world!"); $mainTable = new Table(); $button = new Button(); $button -> setCaption("Click me!"); $button -> onTap(clickme()); $mainTable -> addControl($button,1,1); $win -> addControl($mainTable); function clickme(){ echo "hello smartphone!"; } ?>

Slide 42

Slide 42 text

ରԠػछ » iOS ʢͨΊͯ͠ͳ͍͕ʣ » Android ʢ̓Ͱࢼͨ͠ʣ

Slide 43

Slide 43 text

΍ͬͨͥʂ͜ΕͰPHP΋͖͔ͨʂʁ

Slide 44

Slide 44 text

·ͣམͪண͍ͯཉ͍͠ɻ ͱ͜ΖͰ͜ͷίʔυΛݟͯ͘Εͳ͍͔ɻ

Slide 45

Slide 45 text

Slide 46

Slide 46 text

ݏͳ༧ײ͕͖ͯͨ͠

Slide 47

Slide 47 text

onTap(clickme()); function clickme(){ /*ʙ*/ } » ίʔϧόοΫؔ਺Λొ࿥͢ΔίʔυͰ͋Δ » ʢ౰વͳ͕Βʣ͜Ε͸ؔ਺Ͱͳ͘ɺධՁʮޙʯΛ౉ ͢ίʔυͳͷͰ͸ʁʁʁ

Slide 48

Slide 48 text

// Ϗϧυ࣌Τϥʔϝοηʔδ Generating to main.php line 17:0 missing '?>' at '' » ࠷ޙͷ?>ΛলུͰ͖ͳ͍ » ʢ࠷ۙ͸লུ͢Δͷ͕౰વʣ

Slide 49

Slide 49 text

$city = new InputText(); $city -> setReadOnly(true); function refresh(){ // ུ $city = $struct['nombreCiudad']; } » ʮಥવม਺͕άϩʔόϧʹʂʁʯ » ʢPHPerͰͳ͍ํʹઆ໌͢Δͱɺ͜ΕͰ͸άϩʔό ϧม਺ʹͳΒͳ͍ʣ

Slide 50

Slide 50 text

༧ײ͕࣮ײ

Slide 51

Slide 51 text

͜Ε͸ຊ෺ͷPHPͰ͸ͳ͍ʂ ʢόόʔϯʣ

Slide 52

Slide 52 text

ūɹūƃŦƄŕũŖ!! Ω ΩΩ

Slide 53

Slide 53 text

» ͭ·Γ͜Ε͸PHP෩ͷߏจΛ΋ͬͨผͷφχΧͰ ͢ʂ » ͍΍ɺ͜Ε͸PHPͱ͍ͬͯ΋͍͍ͷͰ͸ͳ͍͔…ଟ ෼…ͦ͏͍͏͜ͱʹ͠Α͏ʂʂ » PHPͱ׬શޓ׵Ͱͳ͍PHP͸ී௨Ͱ͢ɺPHPʹ͸ॲ ཧܥ͕ͦΕͳΓʹ͋ΔͷͰ͢ » (Pythonͱ͔Javaͱ͔.netͱ͔Erlang(?!)ͱ͔ʣ » ʢͱ͸͍͑ɺkikAppͷPHP͸จ๏΋ҧ͍͗͢ΔͷͰ ͸ͳ͍͔…ʣ

Slide 54

Slide 54 text

» PHPͰΞϓϦͱ͸ҰମͳΜͩͬͨͷ͔ » ؔ਺΍Ϋϥε΋શ໓Ͱ͢ɺ͋Γ͕ͱ͏͍͟͝·ͨ͠ » (͜͜·ͰͨͲΓண͍ͨ࣌ͷࢲͷ৺ڥΛ૝૾͠ɺ140 จࣈҎԼͰTwitterʹड़΂Α)

Slide 55

Slide 55 text

ଞʹ΋… » ৘ใ͕ͱʹ͔͘ແ͍ » αϯϓϧίʔυ͸݁ߏ͋Δ͕… » StackOverflow΁ͷϦϯΫ͕͋Δ͕ɺ0݅ʢসʣ » ϦϞʔτ΁ͷ௨৴͕ϔϯςί » file_get_contents΍curl͸͔ͭ͑ͳ͍ɺ ṖͷHTTP ClientΫϥεϥΠϒϥϦΛ͔ͭ͏ » ௨৴͸ɺඞͣαʔόʔʹઃஔͨ͠ʢੜ੒ͨ͠ʣ PHPͷProxyΛҰ౓ܦ༝͢Δʢඞવੑ͕Ṗʣ

Slide 56

Slide 56 text

» json ͷύʔε͕ʮߏ଄ମΛͭͬͯ͘ɺϙΠϯλ͔ͭ ͬͯύʔε͢ΔʯΈ͍ͨͳײ͡Ͱ΢έΔʢʁʁʣ $result = $httpClient -> Execute('GET',$url); $struct = array( array( "id" => DataType::Numeric(6), "name" => DataType::Character(150), ) ); Data::FromJson($struct,$result); foreach ($struct as $product){ $id = $product['id']; $title = $product['name']; }

Slide 57

Slide 57 text

·ͱΊ » ϋολϦɺҰൃωλͱͯ͠͸ڧ͍(͔ͭΈʹ࠷ߴ) » ίʔυ͸࣮ࡍʮ௒؆୯ʯɺίʔυ௒୹͍ » ·ͬͨ͘PHPerͷࢥ͍௨Γʹ͸Ͱ͖ͳ͍(স » ʢͳ͔ͥʣ௨৴ʹ͸αʔόʔ͕ඞཁ » Πϯετʔϧগʑ໘౗ɺυΩϡϝϯτ͕ແ͍ » কདྷతʹϥΠηϯε΍Ձ͕֨Ͳ͏ͳΔͷ͔Ṗ » फڭͰPHPҎ֎͔ͭ͑ͳ͍ਓʹ͸Αͦ͞͏(ʁ)

Slide 58

Slide 58 text

ײ૝ » ʮͰ΋ɺຊ౰ʹͰ͖ͨΑʂVaperware͡Όͳ͍ʂ͢ ͍͝ʂʂʯ » PHPͷߏจΛDSLʹ͢Δͱ͔୭͕خ͍͠ͷ͔(ࢲͩʂ » ͜ͷ౒ྗ͸ೝΊΔɺͱ͍͏͔৆ࢍ͍ͨ͠ » কདྷʹظ଴ʢʁʣʢ·ͩ͡Θ͡Θίϛοτ͸͋Γ· ͢ʣ

Slide 59

Slide 59 text

ࢀߟࢿྉ » https://www.kikapptools.com/ » https://www.kikapptools.com/show-case/ » https://wiki.kikapptools.com/ » https://github.com/KikAppTools/ KikAppExamples » https://github.com/KikAppTools/KikAppDemos

Slide 60

Slide 60 text

ୈҰू׬

Slide 61

Slide 61 text

͸͍ ຊ೔͜Μͳײ͡Ͱ͍͖·͢ΜͰ

Slide 62

Slide 62 text

ୈЋू PHPͰΞϓϦ NGϫʔυɿʮ΢Σϒ͡ΌͶʔ͔ʂʯ

Slide 63

Slide 63 text

PHPΛϩʔΧϧͷPCͰΞϓϦͱͯ͠࢖͏ʹ͸Ͳ͏͢Ε͹ Α͍͔ʁ ʮPHP͸Webαʔόʔʹஔ͘΋ͷɺͦΜͳ෩ʹ͓΋ͬͯ ͍ͨ࣌୅͕Զʹ΋͋Γ·ͨ͠ʯ ʮ͍΍ɺΦνͱͯ͠͸Web͔ͩΒͳʁʯ

Slide 64

Slide 64 text

Ұ൪ΏΔ͍ճ౴ » ʮXAMPPͱҰॹʹzipʯʮ10೥લ͔ʯ » PHP͸૊ΈࠐΈͷελϯυΞϩϯαʔόʔ͕͋Δ » Macͱ͔ͳΒ࠷ॳ͔Β͸͍ͬͯΔ » ίʔυίϐʔͯ͠php -S 127.0.0.1:8080 » ىಈͯ͠ϒϥ΢βͰ։͘ » ʢυοΧʔʁ͠Βͳ͍ࢠͰ͢Ͷ…ʁʣ

Slide 65

Slide 65 text

׬

Slide 66

Slide 66 text

׬Ͱ͸ͳ͍ » ʢ͍΍ɺ͘͢͝ແ೉Ͱ࣮༻తͰ͚͢ͲͶʁτʔΫʹ͸ ͳΒͳ͍ʣ » ͱ͍͏͜ͱͰ…

Slide 67

Slide 67 text

nightrain » PHP WebΞϓϦΛ app,exeʹύοΫͰ͖Δ » PHP(όΠφϦ) +Python(ύοΫࡁ) » http:// uzulla.hateblo.jp/ entry/ 2014/12/12/235020 » ੲࣗ෼ͷϒϩάʹॻ͍ͨ

Slide 68

Slide 68 text

» ͚ͩͲɺࢮΜͰ·͢ » αΠτফ͑ͯόΠφϦ഑෍͕ͳ͘ͳͬͨ » Ϗϧυ͕௨Βͳ͍ » օ༷ʮ·͔ͨΑʂʯ

Slide 69

Slide 69 text

ωλ͕ফ͑ͯ͠·͏ͷͰ » ʮ͔ͨ͠ͳ͍ɺ௚͔͢ʯ

Slide 70

Slide 70 text

$ git clone $ pip install pyinstaller $ brew install wxpython $ vi Classes/Compiler.py 179ߦ໨ call(["pyinstaller.py", "--clean", "-w", "-y", "-F", spec_path, application_icon, "-n", "nightrain", "Application.py"]) ↓ call(["pyinstaller", "--clean", "-w", "-y", "-F", spec_path, application_icon, "-n", "nightrain", "Application.py"]) $ python build.py …Έ͍ͨͳ͜ͱΛ΍ͬͯΈ͚ͨͲ

Slide 71

Slide 71 text

» Ϗϧυ͸Ͱ͖͚ͨͲ࣮ߦ͢ ΔͱηάͬͯམͪΔ » pyinstaller ͱ wx ͷ৯߹ ͤʁ » otool΍ install_name_toolΉ͍ͣ » ʮ͏͔ͬΓpythonͱdylib ʹৄ͘͠ͳͬͨʂ͜Ε͔ͩ ΒPHP࠷ߴʂʯ » (sierra͋ͨΓ͔Β৭ʑͳ෺ ͷϏϧυ೉қ౓্͕ͬͯͳ ͍ʁ)

Slide 72

Slide 72 text

μϝͩ͊ PHPerʮϠό͍ɺ͜ͷ··ͩͱϓϩϙʔβϧ࠮ٗʹͳΔ ͧ…ʯ

Slide 73

Slide 73 text

PHPerʮ͔ͨ͠ͳ͍ɺͳ͚Ε͹࡞Ζ͏ϗττΪεʯ

Slide 74

Slide 74 text

phpack

Slide 75

Slide 75 text

phpack » https://github.com/uzulla/phpack » Electron + PHPͰPack » NightrainΛJSͰͭ͘Γͳ͓ͨ͠Α͏ͳ΋ͷ » PHP͸ͱΓ͋͑ͣSystem PHPΛ͔͍ͭͬͯΔ͕ɺ fatpack΋΍Ζ͏ͱ͓΋͑͹Ͱ͖Δ » OSX༻ʢͱΓ͋͑ͣʣ

Slide 76

Slide 76 text

࢓૊Έ » Electron͔Βɺhttpdͱͯ͠php -SΛىಈ͢Δ » app಺ͷϑΝΠϧΛphp͕࣮ߦͯ͠αʔϒ » ElectronͰͦΕΛ։͘ » ʢϙʔτࢦఆͰϒϥ΢βͰ΋։͚Δʣ

Slide 77

Slide 77 text

phpackʢΈ͍ͨͳ෺ͷʣ௕ॴ » ʮHTML͸ద౰ͳ੩తUIΛॻ͘ͷʹ࠷ߴʯ » JSΑΓී௨ͷॲཧ͸ॻ͖΍͍͢ » Electronͷத͔ΒPHPϑΝΠϧ܈ΛऔΓग़ͯ͠ී௨ ʹ։ൃɾσόοάͰ͖Δ

Slide 78

Slide 78 text

ܽ఺ » Ͱ͔͍ » ਺ेKbyteͷPHP͕ » ਺ඦMbyteʹ… » (PHPόΠφϦൈ͖ͰίϨ)

Slide 79

Slide 79 text

TODO » (΍Δؾ͕ͰͨΒ) » ࢖ΘΕ͍ͯͳ͍ϙʔτΛ࢖͏Α͏ʹ͢Δ » ӈΫϦοΫϝχϡʔΛͭ͘Δ » ໭Δͱ͔Ϧϩʔυͱ͔Λ࡞Δ » ແͯ͘΋Ͳ͏ʹ͔ͳΔ͕ɺ໘౗ͳͷͰ » READMEΛͪΌΜͱॻ͘

Slide 80

Slide 80 text

» ʮ…શ෦JSͰ͍͍ͷͰ͸ʁʯ ʮͦΕPHPerͷલͰ͍͑Μͷʁʯ

Slide 81

Slide 81 text

ͯ͞ » ͦΕΛ࢖ͬͯ… » ͳʹ͢Δͷʁ

Slide 82

Slide 82 text

άϦονը૾ੜ੒πʔϧ » ·͋ɺԿ౓΋࡞ͬͯΔͷͰ » (ੲPerlͰॻ͍ͨ΍ͭΛద౰ʹҠ২) (https://gist.github.com/uzulla/5589791)

Slide 83

Slide 83 text

No content

Slide 84

Slide 84 text

No content

Slide 85

Slide 85 text

ίʔυ͸ಛʹݟΔ΂͖ͱ͜Ζ͸ͳ͍͚ΕͲ Glitch img:

Slide 86

Slide 86 text

$total_len){ $offset = $total_len ; } $head = substr($raw, 0, $offset); $tail = substr($raw, $offset, $total_len-$offset); $padding = get_random_str( (int)rand(0, $random_param) ); $raw = $head . $padding . $tail; if($total_len <= $offset){ break; } } header("Content-Type: ".$_FILES['userfile']['type']); echo $raw; function get_random_str($num){ $char_tmp = []; $char_tmp = array_merge($char_tmp, range('A','Z')); $char_tmp = array_merge($char_tmp, range('a','z')); $char_tmp = array_merge($char_tmp, range('0','9')); $char_tmp_len = count($char_tmp); $str = ''; for($i=1; $i<=$num; $i++){ shuffle($char_tmp); $str .= $char_tmp[0]; } return $str; }

Slide 87

Slide 87 text

ݟΔ΂͖ͱ͜Ζ͸ಛʹͳ͍͚ΕͲ » ૈࡶૉ๿ͳίʔυͰ΋ɺͪΌΜͱπʔϧʹͰ͖Δɻ » ʮϩʔΧϧͷΞϓϦͩ͠ɺηΩϡϦςΟ͸ద౰Ͱ͑͑ ΍Ζʯ

Slide 88

Slide 88 text

΋͏ͻͱͭ

Slide 89

Slide 89 text

ʮൿ఻ͷόϧΫϝʔϥʔʯ » hidden-no-bulk-mailer.app » ΧϯϑΝϨϯεӡӦͬͯϝʔϧΛͨ͘͞ΜૹΔ » աෆ଍ͳ͘ϑϦʔͳόϧΫϝʔϥ͸গͳ͍ » PHPͰॻ͚͹͍͍͕ɺαʔόʔ༻ҙͨ͘͠ͳ͍ » ׳ΕͨਓʹཔΓ੾ΓʹͳΓ͕ͪɺ೚ͤΒΕͳ͍ » ͱ͍͏͜ͱͰɺࣗ෼Ͱ࡞Δ͔͠ͳ͍ʢཁग़యʣ

Slide 90

Slide 90 text

No content

Slide 91

Slide 91 text

No content

Slide 92

Slide 92 text

No content

Slide 93

Slide 93 text

ίʔυ… ൿ఻ͷόϧΫϝʔϥʔ

ൿ఻ͷόϧΫϝʔϥʔ

gmail id

gmail ΞϓϦύεϫʔυ(GMAILͷΞΧ΢ϯτͷύεϫʔυͰ͸ͳ͍ʂʣ

※ https://myaccount.google.com/security ͔Βઃఆ͢Δ͜ͱ

FROM ද໊ࣔ

FROM ϝΞυ

໊݅

ຊจ

ѼઌʢϝΞυվߦ۠੾Γ

ຊ౰ʹ࣮ߦ͢ΔͳΒɺ͜͜Λonʹ


Slide 94

Slide 94 text

ൿ఻ͷόϧΫϝʔϥʔ "; require_once("vendor/autoload.php"); $gmail_id = $_POST['gmail_id']; $gmail_pass = $_POST['gmail_pass']; $transport = (new Swift_SmtpTransport('smtp.gmail.com', 465, 'ssl')) ->setUsername($gmail_id) ->setPassword($gmail_pass); $mailer = new Swift_Mailer($transport); $subject = $_POST['subject']; echo htmlspecialchars("\n໊݅:\n{$subject}", ENT_QUOTES); $body = $_POST['body']; echo htmlspecialchars("\nຊจ:\n{$body}", ENT_QUOTES); $from_name = $_POST['from_name']; echo htmlspecialchars("\nFROM ໊લ:\n{$from_name}", ENT_QUOTES); $from_email = $_POST['from_email']; echo htmlspecialchars("\nFROM email:\n{$from_email}", ENT_QUOTES); $is_no_dry_run = (isset($_POST['no_dry_run']) && $_POST['no_dry_run']==1) ? true : false ; $mail_list_raw = explode("\n", $_POST['mail_list']); $mail_list = []; foreach($mail_list_raw as $email){ if(!preg_match("/@/", $email)) continue; $mail_list[] = trim($email); } echo htmlspecialchars("\n to addresses :\n", ENT_QUOTES); echo htmlspecialchars(var_dump($mail_list), ENT_QUOTES); echo "
"; $message = new Swift_Message($subject); $message ->setFrom([$from_email => $from_name]) ->setBody($body); foreach($mail_list as $to){ echo htmlspecialchars("{$to}\n", ENT_QUOTES); $message->setTo($to); // Send the message if($is_no_dry_run){ $result = $mailer->send($message); var_dump($result); } } echo "
ऴྃ͠·ͨ͠";

Slide 95

Slide 95 text

͏͖͝Ό͍͍ΜͩΑʂ ʢ͍ͩͿͻͲ͍ίʔυͳͷͰখ͍͞ʣ

Slide 96

Slide 96 text

πʔϧ͸πʔϧ » γΣϧεΫϦϓτʹໟΛੜ΍͢ » ͜͏͍͏πʔϧ͸ʮࠓʯಈ͚͹ྑ͍ɺ όά΍Τϥʔ͸౎౓௚͢ » ʮอकੑΑΓ୯७ੑͩʂʯ ʢ̍೔Ͱ࡞Γ௚ͤͳ͍Α͏ͳΞϓϦͳΒߟ͑Δʣ » ͱʹָ͔͘͢Δࣄ͕ॏཁ » ʮॴḨPHPͩ͠ʯ » ʮ͞ΕͲPHPʯ

Slide 97

Slide 97 text

͜͏ͯ͠… » ࣗ෼͸͍͢͝ศརͩͱ͓΋͏Μ͚ͩͲɺ୭ʹ΋࢖ΘΕ ͳ͍ϓϩμΫτ͕·ͨੜ·ΕͨͷͰ͋ͬͨ… » ʢಉ༷ͷݸਓϓϩμΫτʹapachehereͱ͔ʣ

Slide 98

Slide 98 text

ಥવͷએ఻ » builderscon͸ڠྗऀΛ͍ͭ΋ืू͍ͯ͠·͢ʂ » αΠτɺΞϓϦɺ౳ɺࣗ෼ͷझຯΛൃشͰ͖Δʂ » ओʹαΠτ͸pythonͱ͔goͱ͔ͰͰ͖ͯ·͢ » ʮ͑ͬPHP͸ʁʯʮͦͷ࣌๩͔ͬͨ͠Μ΍…ʯ » ʢϏϧίϯSlackͷࣗಈট଴ͱ͔͸PHPͰ࡞ͬͨʣ » ஥ؒืूதͰ͢ʂ͋ͳͨ΋JOINʂʂ » ʢ࿩Λ໭͠·͢ʣ

Slide 99

Slide 99 text

ʮ݁ہWebҎ֎͸ͳ͍ͷʁʯʮ͋Γ ·͢ʯ » https://github.com/php/php-gtk-src » php-gtk » GTK2Λར༻ͨ͠GUIϓϩάϥϛϯά » ʢҎ߱php5.6Ͱࢼ͍ͯ͠·͢ʣ

Slide 100

Slide 100 text

gtk+ install $ brew install gtk+

Slide 101

Slide 101 text

cairo install $ wget https://pecl.php.net/get/Cairo-0.3.2.tgz $ cd Cairo $ phpize $ make $ make install $ vi path/to/php.ini // add extension=cairo.so

Slide 102

Slide 102 text

php-gtk install $ git clone https://github.com/php/php-gtk-src $ cd php-gtk-src $./buildconf $ ./configure $ make $ make install $ vi path/to/php.ini // add extension=php_gtk2.so

Slide 103

Slide 103 text

run demo » demosҎԼʹ৭ʑ͋Γ·͢ $ cd demos $ php phpgtk2-demo.php 2017-08-05 00:47:12.529 php[43302:71455160] *** WARNING: Method userSpaceScaleFactor in class NSView is deprecated on 10.7 and later. It should not be used in new applications. Use convertRectToBacking: instead. » (·͋ͳΜ͔WarnͰ·͚͢Ͳɺݟͳ͔ͬͨ͜ͱʹ͠ ·͠ΐ͏

Slide 104

Slide 104 text

όόʔϯʂ

Slide 105

Slide 105 text

No content

Slide 106

Slide 106 text

No content

Slide 107

Slide 107 text

No content

Slide 108

Slide 108 text

ʮLinuxͱ͔ͰΑ͘ΈΔ΍ͭͩʂʯ

Slide 109

Slide 109 text

class ButtonBox extends GtkWindow { function __construct($parent = null) { parent::__construct(); if ($parent) $this->set_screen($parent->get_screen()); else $this->connect_simple('destroy', array('gtk', 'main_quit')); $this->set_title(__CLASS__); $this->set_position(Gtk::WIN_POS_CENTER); $this->set_default_size(-1, 500); $this->set_border_width(8); $this->add($this->__create_box()); $this->show_all(); } /* .... */ if (!@$GLOBALS['framework']) { new ButtonBox(); Gtk::main(); }

Slide 110

Slide 110 text

function create_framedbox($horizontal, $title, $spacing, $layout) { $frame = new GtkFrame($title); if ($horizontal) { $box = new GtkHButtonBox(); } else { $box = new GtkVButtonBox(); } $box->set_border_width(5); $box->set_layout($layout); $box->set_spacing($spacing); $frame->add($box); $button = GtkButton::new_from_stock(Gtk::STOCK_OK); $box->add($button);

Slide 111

Slide 111 text

ࡉ͔͍આ໌͸লུ͠·͕͢ » GtkWindowΛܧঝͨ͠ΫϥεΛͭ͘Γ » GtkVBoxΫϥεͳͲϨΠΞ΢τΛܾΊΔBOXΛͭ͘ Γ » GtkButtonΫϥε౳ͰϘλϯ౳Λͭͬͯ͘௥Ճ͢Δ » Έ͍ͨͳײ͡Ͱ͢ɺGUIΞϓϦ੡࡞ͰΑ͋͘Δ

Slide 112

Slide 112 text

௕ॴ » gtk͸ׂΓͱϝϯς͞Ε͓ͯΓɺେମͷ؀ڥʹ͋Δ » υΩϡϝϯτ͸ʢgtk+ͷ΋ͷ͕ʣ݁ߏ͋Δ » macOSͰ΋͜ͷΑ͏ʹͪΌΜͱಈ͘ » ΢Οδοτͷछྨ΋ଟ͍ͷͰɺ؆୯ͳGUIͳΒϖλϖ λ͸Δ͜ͱͰ࡞ΕΔ

Slide 113

Slide 113 text

୹ॴ » gtkͰ͋Δ… » (GTK͕ѱ͍ͱ͸͍͍ͬͯͳ͍͕ʣ » ؀ڥΛ༻ҙ͢Δͷ͕গʑΊΜͲ͏ » (FatpackͳόΠφϦΛ࡞Δʁ) » গʑσβΠϯ͕ݹष͍ » CLIͰىಈ͢Δ͜ͱʹͳΓ͕ͪͰʮΞϓϦʯͬΆ͘ͳ ͍

Slide 114

Slide 114 text

» ࠷ॳ͸؆୯͕ͩɺࢥ͍௨Γʹ͢Δͷ͸೉͍͠… » HTMLΈ͍ͨʹɺίϐϖͰͲ͏ʹ͔ͮ͠Β͍ » PHP7ʹ͸·ͩඇରԠʢϏϧυ͕௨Βͳ͍ʣ

Slide 115

Slide 115 text

·͋ɺָ͍͠ͷͰ » PHP͸web͔͠Ͱ͖ͳ͍ͱࢥ͍ͬͯΔ֤Ґ͸ ੋඇҰ౓ͨΊͯ͠Έ͍ͯͩ͘͞ » (͙͢ʹʮHTMLͰॻ͔ͤͯ͘Εʂʯͱ͍͏ײ૝ʹͨ ͲΓண͘ؾ͸͠·͕͢ʣ

Slide 116

Slide 116 text

·ͱΊ » PHPͰΞϓϦ͸࡞ΕΔ(ʁ)Ҋ֎؆୯ʂʂ » PHPΛ͞ΘͬͯΔͱPython΋Node.JS΋Electron΋ ৮Δػձ͕͋ͬͯ࠷ߴ(ʁʁʁ) » ͜ͷΑ͏ʹͯ͠PHPΛॻ͖ͭͭϤιͷੈքΛ஌ΕΔ

Slide 117

Slide 117 text

͍ͭͰͳͷͰɺ΋͏গ͠ଞͷ෺΋঺հ͠·͢

Slide 118

Slide 118 text

༨ஊ » phpdesktop » https://github.com/cztomczak/phpdesktop » nightrainʹ͍͚ۙ͠ͲɺC++౳੡ » (Chrome|IE(!))ʴPHP » ͪΌΜͱੜ͖͍ͯ·͢ » (ࠓͷॴ)WindowsͷΈ

Slide 119

Slide 119 text

Delphi for PHP » https://www.componentsource.co.jp/product/ delphi-for-php-j/about » ʮRADϏδϡΞϧPHP։ൃ؀ڥɻίϯϙʔωϯτʹ ΑΔυϥοάˍυϩοϓ։ൃΛ࣮ݱͨ͠ϏδϡΞϧ౷ ߹։ൃ؀ڥͰ͢ʯ » ͕ɺHTML5 Builder ͱ͍͏੡඼ʹϦωʔϜ͞Ε… » ʮHTML5 Builder ੡඼ͷ୯ମൢച͸ऴྃ͞Εɺݱࡏ ͸ RAD Studio ʹ෇ଐ͓ͯ͠Γ·͢ɻʯ » ऴྃ

Slide 120

Slide 120 text

No content

Slide 121

Slide 121 text

» ʮWebͰ͸ʁʯʮͦ͏ͳΜͩΑͶʯ » ʢ·͋ɺVBͷWebͷΑ͏ͳ΋ͷʣ » ݸਓతʹDelphi޷͖ͩͬͨͷͰ » ʢʮҰମͲ͕͜DelphiͳΜͩ…ʁʯʣ » ·͋ɺͦ͏͍͏΋ͷ͕͋ͬͨɺͱ͍͏࿩Ͱ͢ɻ

Slide 122

Slide 122 text

wxphp » wxPHP (wxWidgets for PHP) » https://wxphp.org/ » ࿝ฮͷwxWidgetͷόΠϯυ » https://wxphp.org/applications ࣮ྫ΋৭ʑ͋Δͧ

Slide 123

Slide 123 text

No content

Slide 124

Slide 124 text

wxphpͷҰྫͱͯ͠ » https://github.com/AndrewRose/Grease » PHP editor written in PHP with remote debugger and plugin API. » ͳΜͱPHPͰͰ͖ͨ౷߹։ൃ؀ڥͰ͋Δ

Slide 125

Slide 125 text

No content

Slide 126

Slide 126 text

ʮ݁ߏ͢͝ͳ͍ʁʯ

Slide 127

Slide 127 text

» ʮٱʑʹ͞ΘͬͯΈΔ͔ʙʯ » ΦϑΟγϟϧϏϧυͨΊͨ͠Βηά͓ͬͯͪͨˠ » ʮ͔ͨ͠ͳ͍wxphpͼΔͲ͠ΐ…ʯˠ » ͔͠͠BrewͷwxmacͰ͸μϝˠ » ʮ͔ͨ͠ͳ͍ɺwxwidgetϏϧυ͠Α…ʯˠ » ʮهԱͲ͓ΓΊͪΌͪ͘Ό͔͔࣌ؒΔͳ…ʯˠ » Ϗϧυίέͨ… →

Slide 128

Slide 128 text

׬ (௅ઓऀٻΉ)

Slide 129

Slide 129 text

PHP/Tk » http://php-tk.sourceforge.net/ » ΈΜͳ͝ଘ஌ςΟΫϧςΟέʔͷςΟʔέʔ » ʮTk͞ΘΔͷPerl/TkҎདྷͩͳʙʯ » 2004೥…12೥લ͔… » …Ϗϧυ͕௨Δؾ͕͠ͳ͍…

Slide 130

Slide 130 text

» php5.6Ͱ͸Ϗϧυ͕ίέͨ… » php5.3Ͱ͸Ϗϧυ͕௨ͬͨʂ » ͍͚Δ͔ʂʁ

Slide 131

Slide 131 text

No content

Slide 132

Slide 132 text

Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 18446744073709551396 bytes ) in /tmp/phptk/tk-0.1.1/test.php on line 4 Segmentation fault: 11

Slide 133

Slide 133 text

− 18446744073709551396 bytes − ʮ໰୊Ͱ͢ɺ͜Ε͸ԿόΠτ͔ʁʯ

Slide 134

Slide 134 text

׬ » 18ΤΫαόΠτͷϝϞϦ͸༻ҙͰ͖ͳ͔ͬͨΑ…

Slide 135

Slide 135 text

SDL2 » https://github.com/Ponup/phpsdl » PHP5.6 ϏϧυͰίέʢry » ͱ͓΋ͬͨΒɺPHP7Ͱ௨Δ » ͱ͓΋ͬͨΒɺ PHP Startup: SDL: Unable to initialize module » ׬ʢ͋ͬɺ΋͏͍͍Ͱ͔͢ʁʣ

Slide 136

Slide 136 text

Ͳ͏Ͱ͔͢ » օ͞Μ͍͖͍͍ͭͯͯͨͩͯ·͢Ͱ͠ΐ͏͔ʁ » ͋Μ·Γਓؾͷͳ͍PHPͷC֦ு͸macOS(OSX)ͩ ͱಛʹյΕ͍͖ͯ·͢ʢೆແʣ » ʢLinux΍Windowsͩͱಈ͘ࣄ΋ʮଟ͍ʯͰ͢Αʣ » ·͋ɺࢲ΋झຯ͔ͩΒ͍͍ΜͰ͚͢ͲͶʙʙ… » ΋͏਺೥͢Ε͹ϝϯς͞ΕΔͷͰ͸ʢئ๬ʣ » ʢҰ෦ͷํ΁ɿࠓճͷʮҋʯͰͨ͠ʣ

Slide 137

Slide 137 text

͜͜·ͰͰ࣭໰͋Γ·͢ʁ

Slide 138

Slide 138 text

ୈnू ύέοτΩϟϓνϟ ͜͜·Ͱ೉͍͠ࣄ͕͍ͭͮͨͷͰɺΈΜͳຖ೔΍͍ͬͯ ΔύέοτΩϟϓνϟʹ͠·͠ΐ͏ɻ օ͞ΜύέοτΩϟϓνϟͯ͠·͢ʁύέοτݟͯ· ͢ʁ

Slide 139

Slide 139 text

pcapϥΠϒϥϦ͕৭ʑ͋Γ·͢ » packetΛѻ͏ͳΒ΍ͬͺΓlibpcap » ࠓճ͸ͪ͜ΒͷϥΠϒϥϦΛར༻ » https://github.com/metashock/php-pcap » C֦ுͰ͢ » ʮPHPͷC֦ுͬͯΠϯετʔϧ໘౗͡Όͳ͍ʁʯ ʮͦΜͳͨ͜ʔͳ͍ʯ

Slide 140

Slide 140 text

Πϯετʔϧ͸ʮΧɾϯɾλɾϯʯ $ git clone [email protected]:metashock/php-pcap.git $ cd php-pcap $ phpize $ configure $ make $ make install

Slide 141

Slide 141 text

$ make install Installing shared extensions: /Users/uzulla/.phpenv/versions/5.6.30/ lib/php/extensions/no-debug-non-zts-20131226/ // ੜ੒͞Εͨpcap.soͷ৔ॴΛ͔֬ΊΔ $ ls /Users/uzulla/.phpenv/versions/5.6.30/ lib/php/extensions/no-debug-non-zts-20131226/ pcap.so

Slide 142

Slide 142 text

vi /path/to/php.ini ઌఔͷPathΛ௥ه extension=/Users/uzulla/.phpenv/versions/ 5.6.30/lib/php/extensions/no-debug-non- zts-20131226/pcap.so

Slide 143

Slide 143 text

$ php -i |grep pcap pcap pcap support => enabled

Slide 144

Slide 144 text

Slide 145

Slide 145 text

ϩʔΧϧhttpd΁ͷΞΫηεͰ͜ͷΑ͏ͳग़ྗΛಘΒΕͨ E���@@�!���7^y���1��v l�ll�lGET / HTTP/1.1 Host: 127.0.0.1:8080 User-Agent: curl/7.51.0 Accept: */*

Slide 146

Slide 146 text

ͳΜ͔ΰϛ͕͋Γ·͢Ͷɺ HEXDUMPͯ͠Έ·͠ΐ͏ while(($data = pcap_next($pcap, $header)) && $i++ < 50) { hexdump ( $data, 0 ); } » ʢhexdumpؔ਺͸ͪ͜ΒΑΓ http:// www.aidanlister.com/2004/04/viewing-binary- data-as-a-hexdump-in-php/ʣ

Slide 147

Slide 147 text

-------------------------------------------------------------------------------- 0000 02 00 00 00 45 00 00 82 79 b5 40 00 40 06 00 00 ....E..� y�@.@... 0010 7f 00 00 01 7f 00 00 01 f5 19 1f 90 51 8d 0a 80 ...... �..�Q�.� 0020 f7 f0 63 c5 80 18 31 d7 fe 76 00 00 01 01 08 0a ��cŀ.1� �v...... 0030 12 6f 3f 63 12 6f 3f 63 47 45 54 20 2f 20 48 54 .o?c.o?c GET / HT 0040 54 50 2f 31 2e 31 0d 0a 48 6f 73 74 3a 20 31 32 TP/1.1.. Host: 12 0050 37 2e 30 2e 30 2e 31 3a 38 30 38 30 0d 0a 55 73 7.0.0.1: 8080..Us 0060 65 72 2d 41 67 65 6e 74 3a 20 63 75 72 6c 2f 37 er-Agent : curl/7 0070 2e 35 31 2e 30 0d 0a 41 63 63 65 70 74 3a 20 2a .51.0..A ccept: * 0080 2f 2a 0d 0a 0d 0a /*....

Slide 148

Slide 148 text

ύοͱݟ্ͯҐ56byte͕ϔομʔͬΆ͍Ͱ͢Ͷʂ ʢ·͋͜ͷ৔ʹ͍Δօ͞Μ͸ৗࣝͰ͢ΑͶʂʣ substrͰ ࡟ͬͯΈ·͠ΐ͏ʂ (PHPͷsubstr͸όΠτૢ࡞ʹ࢖͑·͢)

Slide 149

Slide 149 text

while(($data = pcap_next($pcap, $header)) && $i++ < 50) { echo substr(56, $data); } » (substr͸όΠτྻૢ࡞ʹ΋͔ͭ͑·͢ʣ

Slide 150

Slide 150 text

GET / HTTP/1.1 Host: 127.0.0.1:8080 User-Agent: curl/7.51.0 Accept: */* HTTP/1.1 404 Not Found Host: 127.0.0.1:8080 Date: Fri, 28 Jul 2017 10:49:57 +0000 Connection: close Content-Type: text/html; charset=UTF-8 Content-Length: 533 404 Not Found <SNIP>

Not Found

The requested resource / was not found on this server.

Slide 151

Slide 151 text

΍Γ·ͨ͠Ͷʂ͍͍ײ͡Ͱ͢ʂ » ΈΜͳ͍͖ͩ͢ͳPHPͰ΋Ͱָ͖͍ͯ͠ » ͋ͱ͸packͱ͔unpackͱ͔͔ͭͬͯઌ಄56όΠτ Λ͍ͬͯ͡ΈͨΓ » (࢒೦ͳ͕ΒɺPHPͰߏ଄ମΛѻ͏ͷ͸໘౗) » ΈΜͳ͕஌ͬͯΔύέοτΛ৭ʑ͍͡Δͱͨͷͦ͠͏ Ͱ͢Ͷʂ » PHPͰ΋ύέοτΛ৮ΕΔʂ

Slide 152

Slide 152 text

PHPͰύέοτΛ৮ΔϝϦοτ » ಛʹແ͍ʂ » จࣈྻૢ࡞͸ಘҙ͕ͩɺόΠφϦૢ࡞͸͞΄ͲͰ΋ ͳ͍ʢͰ͖ͳ͘͸ͳ͍ʣ » ͱ͸͍͑CΑΓෑډ͸௿͍ʢʁʣ͠ɺ΍ͬͨ͜ͱ͕ͳ ͍ਓ͸΍Ζ͏ʂ

Slide 153

Slide 153 text

༨ஊɺC֦ுʹ͍ͭͯ » peclҎ֎ʹ΋C֦ு͸͋Δ » phpͷC֦ுΛೖΕΔͷ͸݁ߏ؆୯ » php5ҎԼͰ͔͠ಈ͔ͳ͍֦ு΋ଟ͍ » ϒϥϯν΍ISSUEΛΈͯΈΑ͏ » ͳ͚Ε͹phpenvͰ͖Γ͔͑ͯ࢖͍·͠ΐ͏(લ޲ ͖

Slide 154

Slide 154 text

ͦͷଞ » https://github.com/marcelog/SimplePcap » https://github.com/zobo/php-pcap » https://github.com/Grisou13/pcap-php

Slide 155

Slide 155 text

͸͍

Slide 156

Slide 156 text

ୈπू IoT ిࢠ޻࡞ ͍ΘΏΔϥζύΠͰ͕͢…PHPͰ΋໪࿦ϥζύΠ͸࢖͑ ·͢ɺ͍ͬͯ͏͔݁ߏ͍͍ײ͡Ͱ͢ɻ PHPͷҙຯʁ͍΍PHPͰ͋Δ͔Βҙຯ͕͋ΔΜͰ͢Α͜ Ε͸ɻ(ࢲʹͱͬͯ͸ɺͰ͕͢)

Slide 157

Slide 157 text

ͳʹΛ΍Δ΂͖͔ » LνΧͱ͔໘ന͘ͳ͍ » ࣸਅ޷͖ͩ͠ɺPHPͰσδΧϝΛͭ͘Ζ͏ʂ » ΩϟϓνϟˍTweet

Slide 158

Slide 158 text

No content

Slide 159

Slide 159 text

No content

Slide 160

Slide 160 text

No content

Slide 161

Slide 161 text

ʮͪΐͬͱͨ͠ෆ৹෺ͩͳ…ʯ

Slide 162

Slide 162 text

σϞ

Slide 163

Slide 163 text

rasberry pi zero w » ௒খܗͰ҆ͯ͘(ˇ1400)Wifi༗ » PHP(7.1)΋ͪΌΜͱಈ͖·͢ » MacͱʮUSBέʔϒϧҰຊͰʯిݯͱsshͰ͖ͯϚδ खܰ » ʢUSB NICΈ͍ͨͳʣ » ʢWifiઃఆίέΔͱ྆ํࢮ͵ͷͲ͏ʹ͔ͳΒΜͷ ͔ʣ

Slide 164

Slide 164 text

No content

Slide 165

Slide 165 text

RaspiͷΧϝϥ » ΧϝϥϞδϡʔϧ 4000ԁ ͘Β͍ » ؆୯઀ଓɺ΅ͪ΅ͪը࣭΋ ྑ͍ » zero༻ϑϨΩέʔϒϧ͸ 1000ԁ͘Β͍

Slide 166

Slide 166 text

γϟολʔϘλϯ » ΧϝϥͳΒγϟολʔϘλ ϯ͕͍Δͳ » ϒϨουϘʔυͰͭͳ͗· ͘Δͷָ͍͚͠Ͳ໘౗ » Ϙλϯͻͱͭͷҝʹ Joy bonnetΛങͬͨ (ˇ2000) » https:// www.adafruit.com/ product/3464

Slide 167

Slide 167 text

૊Έཱͯ » Raspi͸Ұੲ·͑ͷࣗ࡞PCͬΆ͍ » ૊ΈཱͯΔ͚ͩͰOK » GPIOͷpin͚ͩҰखؒ

Slide 168

Slide 168 text

GPIOͷpin » ͸Μͩ෇͚ or ѹೖ » ී௨ʹ͸Μͩ෇͚͕ྑ͍ » ѹೖʢϋϯϚʔʣऔΓ෇͚͓͢͢Ί͠ͳ͍ » ج൫ΛΨϯΨϯϋϯϚʔͰୟ͘ͷ͸ͦΕͳΓʹ୾ ྗ͕͍Δ » Ψλ͍ͭͨͷͰ݁ہ͸Μͩ෇͚ͨ͠ʢʣ

Slide 169

Slide 169 text

ͦͷଞઃఆ » OSΛSDΧʔυʹ͍Εͯ » sshΛ༗ޮʹͯ͠ » Wifiͱ͔ͷઃఆͯ͠ » Χϝϥͱ͔༗ޮʹͯ͠ » PHP7.1Λ໺ྑrepo͔Β͍Εͯ » joy bonnetͷઃఆͯ͠ » ४උ׬ྃ

Slide 170

Slide 170 text

ࠓճͷར༻ϥΠϒϥϦ » Ωϟϓνϟ » https://github.com/cvuorinen/raspicam- php » GPIOಡΈग़͠ » https://github.com/PiPHP/GPIO » ʢґଘ͕̑̏΋͋ͬͯҟৗʣ » Tweet » https://github.com/abraham/twitteroauth

Slide 171

Slide 171 text

getInputPin(12); $pin->setEdge(InputPinInterface::EDGE_BOTH); $interruptWatcher = $gpio->createWatcher(); $interruptWatcher->register($pin, function (InputPinInterface $pin, $value) { if($value == 0){ echo "PUSHED!" } return true; }); while ($interruptWatcher->watch(5000))

Slide 172

Slide 172 text

takePicture('pic.jpg');

Slide 173

Slide 173 text

upload('media/upload', ['media' => 'img.png']); $parameters = [ 'status' => 'πΠʔτςΩετ #builderscon', 'media_ids' => implode(',', [$media1->media_id_string]) ]; $result = $connection->post('statuses/update', $parameters);

Slide 174

Slide 174 text

getInputPin(12); // a button $pin->setEdge(InputPinInterface::EDGE_BOTH); $interruptWatcher = $gpio->createWatcher(); $interruptWatcher->register($pin, function (InputPinInterface $pin, $value) { if($value != 0){ return true; } $camera = new Raspistill(); $camera->width(1024)->height(768)->takePicture('pic.jpg'); $connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, ACCESS_TOKEN, ACCESS_TOKEN_SECRET); $media1 = $connection->upload('media/upload', ['media' => 'pic.jpg']); $parameters = [ 'status' => '#builderscon', 'media_ids' => implode(',', [$media1->media_id_string]) ]; $result = $connection->post('statuses/update', $parameters); }); while ($interruptWatcher->watch(5000)){}

Slide 175

Slide 175 text

͋ͱ͸ɺىಈ࣌ʹىಈ͢ΔΑ͏ʹ͢Δ͚ͩ ### systemd [Unit] Description=TweetCamera After=syslog.target [Service] Type=simple WorkingDirectory=/home/pi/phpapp ExecStart=/usr/bin/php /home/pi/phpapp/gpioandshootandpost.php TimeoutStopSec=5 StandardOutput=null [Install] WantedBy = multi-user.target

Slide 176

Slide 176 text

$ sudo systemctl start tweetcamera $ sudo systemctl enable tweetcamera » ͜ΕͰిݯܨ͍ͩΒϓϩάϥϜ͕૸Δ

Slide 177

Slide 177 text

Ͱ͖ͨʂ » ͚͋ͬͳ͍΄Ͳ؆୯ʂʂʂ » ·͋ɺϥζύΠͩ͠Ͷ » ͕͢͞PHPʂʂ

Slide 178

Slide 178 text

ͳͥɺPHPͳͷ͔ʁ » ʮPHP͔ͩΒɺଞʹཧ༝͕͍Δͷ͔ʁʯ » Raspi͸ߴੑೳͳͷͰɺͦΕͳΓʹPHPಈ͘ » PCͰେମॻ͍͍͚ͯ࣋ͬͯΔ » PHP͸େମͷ͜ͱ͕Ͱ͖ΔɺϥΠϒϥϦ͕๛෋ » ʮ؅ཧը໘ʯΛੜ΍͠΍͍͢

Slide 179

Slide 179 text

·ͱΊ » PHPʴRaspi͸ָͰָ͍͠ɺे෼࢖͑Δ » rasberrypi zero w͸ಛʹ͍҆͠ɺͨͷ͍͠ » PHPerͰ΋ຊ౰ʹ؆୯ʹ৭ʑͰ͖ͯ࠷ߴ » ʮຊ෺ͷʯPHPͳͷͰɺը૾ม׵ͱ͔΋Ͱ͖·͢ » ʢॳ৺ऀͷLinux+PHP؀ڥͱͯ͠΋खܰͰ͍͍ͷ͔ ΋͠Εͳ͍ʣ

Slide 180

Slide 180 text

͸͍ » ͜͜·ͰͰ࣭໰͋Γ·͢ʁ

Slide 181

Slide 181 text

ୈ!ू σʔϞϯ PHPer͕͓ͳ͡ΈͷσʔϞϯͱ͍͑͹ʁ FTPͰ͢ΑͶʂ

Slide 182

Slide 182 text

ftpd » PHPͰ͔͔Εͨftp server » https://github.com/lukas2511/PHP-FTP-Server » ͏Μɺ͏͔͝ͳ͔̓(ry » օ༷ʮ·͔ͨΑʂʯ » (௚ͤ͹ಈͬ͘Ά͍͚Ͳɺ͕࣌ؒͳ͔ͬͨͷͰεΩο ϓ)

Slide 183

Slide 183 text

(ؾΛऔΓ௚ͯ͠) sshd » ଞʹ΋SSH͘Β͍͸͓ͳ͡ΈͰ͢ΑͶ » https://github.com/fpoirotte/pssht » sshͰ઀ଓͯ͠ɺςΩετσʔλ΍ΓऔΓ͕Ͱ͖Δ

Slide 184

Slide 184 text

» git cloneͯ͠ » composer installͯ͠ » php bin/pssht » ssh -T -p 22222 your_id@localhost » 伴ೝূ͋Δ͍͸ύεϫʔυpssht

Slide 185

Slide 185 text

» σϑΥϧτͰ͸Τίʔαʔόʔ » (͕࣌ؒ͋·ͬͯΕ͹σϞ)

Slide 186

Slide 186 text

No content

Slide 187

Slide 187 text

मਖ਼ͯ͠Έ·͠ΐ͏

Slide 188

Slide 188 text

// src/Application/EchoService.php public function handle( ) { $message = \fpoirotte\Pssht\Messages\CHANNEL\DATA::unserialize($decoder); $channel = $message->getChannel(); $ೖྗ͞Εͨจࣈྻ = $message->getData(); $ૹ৴͍ͨ͠จࣈྻ = "޷͖ʹͨ͠ΒΑ͍"; $response = new \fpoirotte\Pssht\Messages\CHANNEL\DATA($channel, $ૹ৴͍ͨ͠จࣈྻ); $transport->writeMessage($response); return true; }

Slide 189

Slide 189 text

No content

Slide 190

Slide 190 text

» ʮҙຯ͋Δͷ͔ʁʯʮίϚϯυૹͬͨΓͱ͔৭ʑ͋ Δ΍Ζʯ » ʮΑ͘Θ͔Βͳ͍ʯʮ͜Ε͔ͩΒ΢Σϒ࣌୅ͷਓؒ ͸…(Զ΋ͦ͏ࢥ͍·͢ʯ » Webͱ͕ͪͬͯ伴ೝূͰ͖Δͷ͸ศརͩͱࢥ͏…(ଟ ෼) » ͱʹ͔͘ເ͕͋ΔͩΖʂ

Slide 191

Slide 191 text

ͦͷଞͷσʔϞϯ » (WebҎ֎Ͱ…ʁ)

Slide 192

Slide 192 text

smtpd΍imap » smtpd΋͋Γ·͢ʢ͓࣌ؒͳ͍ͷͰলུʣ » https://github.com/TwixtedChaox/Guerrilla- SMTPd » https://github.com/TheFox/smtpd » ໪࿦ʢʁʣIMAP΋ » https://github.com/TheFox/imapd

Slide 193

Slide 193 text

PocketMine-MP » MineCraft PocketEditionͷαʔόʔ » https://github.com/pmmp/PocketMine-MP » A highly customisable, open source server software for Minecraft: Pocket Edition written in PHP » (ଞʹ΋ɺiTXTech/Genisysͱ͔͋Δʣ

Slide 194

Slide 194 text

UltimaPHP » Ultima Online ͷOpensourceαʔόʔ » https://github.com/joaoescribano/UltimaPHP » UltimaPHP is a modern Ultima Online server written in PHP 7.0 » ʢ͔ͭͬͨ͜ͱ͸ͳ͍ʣ

Slide 195

Slide 195 text

ॴͰɺͲ͏΍ͬͯσʔϞϯʹʁ » PHPͷCLIΞϓϦΛͲ͏΍ͬͯৗ࣌ىಈ͢Δ͔ʁ » ࠓ͸systemdΛ࢖͏ͱྑ͍Ͱ͠ΐ͏ » (αϯϓϧ͸લड़͠·ͨ͠Ͷ) » ʮrc.localͱnohup͕ջ͔͍͠Ͱ͟͝Δʯ » daemontools΍supervisord͸΋͏ෆཁ(ʁ) » ָͳͷ͸screenͰσλονͰ͚͢ͲͶ͆

Slide 196

Slide 196 text

͸͍

Slide 197

Slide 197 text

ୈ൪֎ฤ ͓΋͠ΖPHPΛ஌Δʹ͸ʁ » GithubΛDigΔ » ṖͷBotΛϑΥϩʔͯ͠શ෦ݟΔʢແཧͰ͢ʣ https://twitter.com/call_user_func » redditɺHackerNewsɺϝϧϚΨͳͲ » ւ֎͸݁ߏ͋Δ » ڞ࢈ݍ͸݁ߏ໘ന͍(ಡΊͳ͍͚Ͳ) » ͳʹΑΓ΋৘೤ͱ࣌ؒʢʣ

Slide 198

Slide 198 text

͓΋͠ΖPHPΛ஌Δͷʹඞཁͳಓ۩ » PHPStorm(ίʔυδϟϯϓ͍ͨ͠) » ag(ίʔυݕࡧ͍ͨ͠),tig(blame͍ͨ͠) » GithubͰಡΉͷ͸େม » phpenvʢ͋ΒΏΔόʔδϣϯ͕ඞཁʣ » VM(macOSͰಈ͔ͳ͍෺༻) » ߴ଎ͳPCʢϏϧυͷࢼߦࡨޡʢʣʣ » InternetArchiveʢফ͑ΔͷͰ…ʣ

Slide 199

Slide 199 text

࠷ऴճ ·ͱΊ » PHP͸΢ΣϒҎ֎΋ָ͠ΊΔ » ָ͠Έ·͠ΐ͏! » ʮͳΜͰPHPʁʯͱ͍͏എಙײ΋ָ͍͠ » େମʮૉ๿ʯͳͷͰɺಡΊͯษڧʹͳΔʢʁʣ » PHPͷؾ͕ܰ͞࠶ൃش͞ΕΔؾ͕͢Δ » ʢࡢࠓͷWeb͸গʑଉ͍ۤ͠ͷͰʣ

Slide 200

Slide 200 text

» PHP͸ੲͱมΘΒͣ༡΂Δ » PHPͷؾ͕ܰ͞׆͔ͤΔ৔͸·ͩ͋Δ » ͦΕ͕ࠓճ͓఻͍͑ͨ͠ࣄͰͨ͠

Slide 201

Slide 201 text

ఏڙ Ώ͔ͨͳ໌೔Λங͘ PHP Ͱ͓ૹΓ͠·ͨ͠ (Կ͔࣭໰͸͍͟͝·͔͢ʁ)

Slide 202

Slide 202 text

ੋඇ౤ථΛ͓ئ͍க͠·͢ʂ » ͳ͓ɺ౤ථγεςϜ͸PHP੡Ͱ͢ʢ͔ͩΒʁ͆ʣ

Slide 203

Slide 203 text

ୈϘπू औΓ্͛ΒΕͳ͔ͬͨ෺ͨͪ » ݸਓతʹ໘ന͍Μ͚ͩͲ͕࣌ؒͨΓͳ͔ͬͨ΋ͷͨ ͪͰ͢

Slide 204

Slide 204 text

babel-preset-php » https://gitlab.com/kornelski/babel-preset-php » PHP > JSτϥϯεύΠϧ » ࠷ۙͷ࿩ͳΜͰɺ͋Μ·Γҋ౓͕ͳ͍(?) (ײ֮ͷຑᙺ) » ݁ߏΑ͘Ͱ͖ͯͯϏϏΔ » ʮTSͱ͔Ͱ͍͍͡Όͳ͍ʁʯʮpreg_*ͱ͔΋͋ΔΜ ͩΑʯ

Slide 205

Slide 205 text

gameboy Τϛϡ » https://github.com/gabrielrcouto/php- terminal-gameboy-emulator » CLIͰήʔϜϘʔΠ » աڈ@tomzoh͞Μ͕࿩ͨ͠ͷͰলུ » https://speakerdeck.com/tomzoh/zhu-jun-si- hagemuboigada-hao-kida-php-and-gemuboi

Slide 206

Slide 206 text

c64php » ίϞυʔϧ64Τϛϡ » https://github.com/jaytaph/c64php » GUI͸PHPͰ͸ͳ͘ɺPythonʢGTKʣ

Slide 207

Slide 207 text

PHP-ML » https://github.com/php-ai/php-ml » ʮػցֶशͳʹͦΕ͏·͍ͷʁʯ

Slide 208

Slide 208 text

phpopengl » https://github.com/Ponup/phpopengl » openGL

Slide 209

Slide 209 text

νϡʔϦϯάϚγϯͱ͔ϥΠϑήʔϜͱ͔ » https://github.com/igorw/turing-php » https://github.com/igorw/conway-php

Slide 210

Slide 210 text

೉ಡԽʢεΫϥϯϒϧʣ » phpίʔυ͸ฏจͰ͕͢ɺಡΊͳ͍ͨ͘͠ͱ͍͏ध ཁ͸͠͹͠͹͋Γ·͢ » ionCube Encoder » http://www.ioncube.com/ » zend Guard » http://www.zend.com/en/products/zend-guard » php beast » https://github.com/liexusong/php-beast

Slide 211

Slide 211 text

DraftCode » εϚϗͱ͔Ͱ΋PHP͸ಈ͘ » iOS(iPhone,iPad) » PHP5.6 » sqliteαϙʔτ

Slide 212

Slide 212 text

๛෋ͳ͓·͚ » Wordpress » (Sqliteಈ࡞༻ʹௐ੔) » phpLiteAdmin » phpMyAdmin

Slide 213

Slide 213 text

» ͳʹ͕Α͍ͬͯɺεϚϗͰ΋HTMLͰ؆୯ʹը໘͕࡞ ΕΔ » ʮWebͰ͸ʁʯʮγʔοʂʯ » PHP͸࣌ͱ৔߹ʹΑͬͯ͸ͼͬ͘Γ͢Δ΄Ͳศར » ؔ਺͕΄ͱΜͲ૊ΈࠐΈͳͷͰ؆୯ͳࣄͳΒϥΠϒ ϥϦ͕͍Βͳ͍ » ؆୯ͳ࡞ۀͳΒଞͷݴޠͷXഒͷੜ࢈ੑ

Slide 214

Slide 214 text

» ʮ͍·͙͋͢Δจࣈྻͷsha1͕ཉ͍͠ʯ » ग़ઌ͕ͩɺࠓJSON APIΛίʔϧ͍ͨ͠ » ࠓ͙͢ෳࡶͳจࣈྻஔ׵Λ͍ͨ͠ » εϚϗ؀ڥͳΒผʹηΩϡϦςΟ͍ΒΜ΍Ζ(ʁ) » ແ࿦file_get_contentsͱ͔΋࢖͑·͢

Slide 215

Slide 215 text

௕ॴ » ඈߦػ΍ిंͷதɺͲ͏Ͱ΋͍͍࣌ʹٔΕΔͷʹͽ ͬͨΓ » PHPerಉ࢜Ͱʮ͋ͷؔ਺ͷڍಈͳΜ͚ͩͬʁʯͱ͍ ͏࿩୊ΛҰൃղܾ » (5.6͚ͩͲ…ʣ » icloudɺDropboxɺGoogle Drive౳͔ΒσʔλΛͻ ͬͺΕ·͢(ྑ͍ » zipʹ͔ͨΊͯ·ͱΊͯ΍ΓऔΓ

Slide 216

Slide 216 text

ܽ఺ » ݁ߏߴ͍(1300ԁ) » ͍·ͩPHP5.6 » ಠࣗͷ֦ு͕ߦΘΕ͍ͯΔ » ಺෦తʹʮγΣϧʯ͕ͳ͍ » Composer͕؆୯ʹ͸͏͔͝ͳ͍ » iOS͔ͩΒ͔ͨ͠ͳ͍Ͷ

Slide 217

Slide 217 text

» ΤσΟλ͕͠ΐ΅͍ » ίʔυॻ͘ΞϓϦͳͷʹɺ ͍·Ͳ͖ΩʔϘʔυ͕OS ඪ४ͷ΍ͭͱ͔…

Slide 218

Slide 218 text

Ͱ͸ࢲ͸Կʹ͔͍ͭͬͯΔͷ͔ʁ » ߴػೳͳి୎Ͱ͢ʢʣ

Slide 219

Slide 219 text

͓·͚ͱ͍͏໊ͷऄ଍ PHP7.2ͷ࿩ » RFCΛΈΔͱ͍͍ͩͨΘ͔Δ » https://wiki.php.net/rfc#phpnext72

Slide 220

Slide 220 text

Trailing commas in list syntax $a = [ 1, 2, 3, // લ͔ΒOK ]; myFunc( 1, 2, 3, // ͨͱ͑͹͜͏͍͏ͷΛOKʹ ) » Ұ෦͸௨Γͦ͏

Slide 221

Slide 221 text

Deprecate and Remove Bareword (Unquoted) Strings $a = bare_word; echo $a; // -> bare_word // notice͸ͰΔ͚Ͳɺ͏͍ͯ͝͠·͏ » "falsu"Έ͍ͨͳͷΛආ͚Δҝ » ॱ౰Ͱ͸

Slide 222

Slide 222 text

Debugging PDO Prepared Statement Emulation $stmt = $db->prepare('SELECT :string'); $stmt->bindValue(':string', 'foo'); // returns unparsed query before execution var_dump($stmt->activeQueryString()); // => string(14) "SELECT :string" // returns parsed query after execution $stmt->execute(); var_dump($stmt->activeQueryString()); // => string(11) "SELECT 'foo'" » ੜ੒͞ΕΔSQL͕ݟΕΔ » ॿ͔Δ

Slide 223

Slide 223 text

Debugging PDO Prepared Statement Emulation v2 $sth = $dbh->prepare('SELECT name, colour, calories FROM fruit WHERE calories < ? AND colour = ?'); $sth->bindParam(1, $calories, PDO::PARAM_INT); $sth->bindValue(2, $colour, PDO::PARAM_STR); $sth->execute(); $sth->debugDumpParams(); Output: SQL: [82] SELECT name, colour, calories FROM fruit WHERE calories < ? AND colour = ? Sent SQL: [88] SELECT name, colour, calories FROM fruit WHERE calories < 150 AND colour = 'red' Params: 2 Key: Position #0: paramno=0 name=[0] "" is_param=1 param_type=1 Key: Position #1: paramno=1 name=[0] "" is_param=1 param_type=2 ΋ͬͱ͔ͨ͢Δ

Slide 224

Slide 224 text

Object typehint function myFunc(array $a, object $b){ } » arrayͱ͔͕͋ͬͯobject͕ͳ͔ͬͨͷͰ͔ͨ͢Δ (ʁ) » (ී௨ʹͪΌΜͱΫϥε໊ॻ͚͹ྑ͍ͷͰ͸…)

Slide 225

Slide 225 text

» ͱ͍͏ͷ͕ɺ(ݸਓతʹӨڹ͕͋Γͦ͏ͳ)৽ػೳͰ͢ » ଞ͸ඍົͳॻ͖ํΛඇਪ঑ʹͱ͔ͦ͏͍͏ͷ͕ଟ͍ » ͑ͬɺ଎౓Ͱ͔͢ʁ

Slide 226

Slide 226 text

more faster » http://www.phoronix.com/scan.php? page=news_item&px=PHP-7.2-Beta-1

Slide 227

Slide 227 text

» betaͷ࣌఺Ͱ5ʙ10%͘Β͍଎͘ͳ͍ͬͯΔ » 7.0->7.1ΑΓ΋ੑೳ޲্෯͸େ͖͍ » ଟ͘ͷLLΑΓ͸͢Ͱʹ଎͍(ཁग़య)

Slide 228

Slide 228 text

» (ະདྷͷ࿩͕ͩ) PHP8Ͱ͸JIT͕࣮૷͞ΕΔ༧ఆ » https://www.phpclasses.org/blog/post/493- php-performance-evolution.html (2017-04-10) » ·ɺݴޠͷॲཧ଎౓ͳΜͯͦΜͳҙຯͳ͍͚ͲͶʂ()

Slide 229

Slide 229 text

» PHP 7.2͸7.1ಉ༷ʹਖ਼ৗਐԽ » 2017೥຤ʙࠒʹϦϦʔε༧ఆ » PHP͸2όʔδϣϯલ͘Β͍·Ͱαϙʔτ » ʢ5.6͸2018຤·ͰEOL͕৳ͼ͚ͨͲʣ » Ճ଎͍ͯ͠·͢ͷͰؤுΓ·͠ΐ͏ » ʢͱ͸͍͑ɺ࠷ۙͦ͜·Ͱ͠ΜͲ͘͸ͳ͍ʣ

Slide 230

Slide 230 text

PHPདྷͯΔͰ…ʢPHPerஊʣ » ܕʢܕͰ͸ͳ͍ʣ΋ීٴ࢝·ͬͯΔ͠ » 7.1,7.2Ͱߋʹ଎͘ͳͬͨ͠ » ʢ·͋ɺҟ࿦͸͓࣋ͪؼΓ͍ͩ͆͘͞ʣ » WindowsͷPHP͕΋͏ͪΐͬͱͲ͏ʹ͔… » Windowsʹ΋ඪ४ͰೖͬͨΓ͠ͳ͍͔ͳ(BoWͰ) » ֤OSͷඪ४PHP΋ͬͱόʔδϣϯ্͕ͬͯ΄͍͠

Slide 231

Slide 231 text

EOL see you next conference!!