Slide 1

Slide 1 text

Laravelͷϔϧύʔ Laravelษڧձ InnoCAFE#21 2016/06/17

Slide 2

Slide 2 text

ࣗݾ঺հ • ͖ͨΌ͸͠Ͱ͢ɻ • ΞγΞϧͰPMͱ͔PGͱ͔ɻ • ͱ͕େ޷͖ɻ࠷ۙ͸ʹϋϚͬͯ·͢ɻ

Slide 3

Slide 3 text

Laravelͷϔϧύʔͱ͍͑͹ ։ൃͰָΛ͢ΔͨΊͷ άϩʔόϧͳؔ਺Ͱ͋Δɻ ଞͷFWͩͱҧ͏͔΋Ͱ͢ɻ

Slide 4

Slide 4 text

ϔϧύʔ࢖ͬͯ·͔͢ʁ

Slide 5

Slide 5 text

ࢲ͸Ϣχοτςετ΍σ όοάΛத৺ʹ࢖ͬͯ·͢ɻ

Slide 6

Slide 6 text

ϔϧύʔͷ֓ཁ • Laravelʹ͸ Foundation ͱ Support ͷ2छྨ ͕͋Δɻ • ͲͪΒ΋ helpers.php ͱ͍͏ϑΝΠϧ໊Ͱ͋ Δɻ

Slide 7

Slide 7 text

Support ͷ helpers.php

Slide 8

Slide 8 text

composer.json "autoload": { "classmap": [ "src/Illuminate/Queue/IlluminateQueueClosure.php" ], "files": [ "src/Illuminate/Foundation/helpers.php", "src/Illuminate/Support/helpers.php" ], "psr-4": { "Illuminate\\": "src/Illuminate/" } }, ...

Slide 9

Slide 9 text

ඪ४ؔ਺ͷΑ͏ʹΠϯϙʔτ ͠ͳͯ͘΋࢖༻Ͱ͖·͢

Slide 10

Slide 10 text

ϔϧύʔࣗ༝͗͢ʂʂʂ ͋ͱϑΝαʔυ΋

Slide 11

Slide 11 text

ϔϧύʔؔ਺͸FW಺෦Ͱ΋ό ϦόϦ࢖ΘΕ͍ͯ·͢ɻ

Slide 12

Slide 12 text

ϔϧύʔͷ࢖༻ྫ • app() • BladeCompiler.php • class_basename() • Model.php • data_get() • Application.php • Colleciton.php

Slide 13

Slide 13 text

ͭ·Γϔϧύʔ͸։ൃऀࢧԉ Λ໨తʹ࣮૷͞ΕͨػೳͰ͸ ͳ͘ฆΕ΋ແ͘΋FWͷҰ෦

Slide 14

Slide 14 text

ϔϧύʔ঺հ͍͖·͢

Slide 15

Slide 15 text

Foundation ͷϔϧύʔ • app($make = null, $parameters = []) • ίϯςφ͔ΒΠϯελϯεΛऔΓग़͠·͢ɻͳʹ΋ࢦఆ͠ͳ͍ ͱ Application Λฦ͠·͢ɻ • logger($message = null, array $context = []) • σόοά༻ͷϩάΛॻ͖ࠐΈ·͢ɻ • session($key = null, $default = null) • $keyʹ഑ྻΛ౉͢ͱอଘɺจࣈྻͳΒऔಘ͠·͢ɻ

Slide 16

Slide 16 text

Support ͷϔϧύʔ 1 • array_except($array, $keys) • $keysʹϚονͨ͠$arrayΛআڈͯ͠ฦ͠·͢ɻ • array_only($array, $keys) • $keysʹϚονͨ͠$array͚ͩΛฦ͠·͢ɻ • collect($value = null) • Illuminate\Support\Colleciton Λฦ͠·͢ɻ • $valueʹ഑ྻΛ౉ͤ͹itemsͷॳظ஋ͱͯ͠ηοτͯ͘͠Ε·͢ɻ

Slide 17

Slide 17 text

Support ͷϔϧύʔ 2 • dd() • σόοά༻ʹϑΥʔϚοτͯ͠ग़ྗ͠·͢ɻʢSAPIʹΑͬͯ੾ΓସΘΔʣ • ࣮ߦ͞ΕΔͱॲཧ͸தஅ͞Ε·͢ɻ • str_contains($haystack, $needles) • $needles͕$haystackʹؚ·Ε͍ͯΕ͹trueɺٯͳΒfalseΛฦ͠·͢ɻ • str_random($length = 16) • ϥϯμϜͳӳ਺ࣈจࣈྻΛऔಘ͠·͢ɻ • ಺෦Ͱ͸PHP7͔Β௥Ճ͞Εͨ random_bytes() ͕࢖༻͞Ε͍ͯ·͢ɻ

Slide 18

Slide 18 text

Laravelϔϧύʔ·ͱΊ • ϔϧύʔ͸։ൃΛָʹ͢ΔͨΊͷάϩʔόϧͳؔ਺ɻ • FoundationͱSupportͷ2छྨ͕͋Δɻ • ͲͪΒ΋FW಺෦Ͱ࢖ΘΕ͍ͯΔɻ • σόοά΍ςετʹ࢖͏෼ʹ͸ຊ౰ʹָͰ͍͍ɻ • ϔϧύʔ΍ϑΝαʔυΛ࢖ָͬͯΛ͢Δ΂͖͔Ͳ͏͔ ͸Α͘ߟ͑Δ΂͖ɻ

Slide 19

Slide 19 text

͝ਗ਼ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠ɻ

Slide 20

Slide 20 text

͝ਗ਼ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠ɻ

Slide 21

Slide 21 text

ϔϧύʔΛࣗ࡞͍ͨ͠ͱ͖͸ • app/Support/helpers.php ͱ͔࡞ͬͯ ϓϩ δΣΫτͷ composer.json Ͱ autoload.files ʹ௥Ճ͢Ε͹͍͍ͱࢥ͍·͢ɻ • ಛఆͷυϝΠϯʹؔ܎Λ࣋ͭΑ͏ͳ ॲཧ͸ઈରʹॻ͔ͳ͍Α͏ʹ͠·͠ΐ ͏ɻ

Slide 22

Slide 22 text

ຊ౰ʹ͝ਗ਼ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠ɻ