Slide 1

Slide 1 text

CarbonͱMutableΦϒδΣΫτͷ࿩ 1)1ษڧձ

Slide 2

Slide 2 text

໊લ෋ॴ྄ 3ZP5PNJEPLPSP ৬ۀ8FC"QQMJDBUJPO&OHJOFFS ॴଐ*OOPWBUPS+BQBO*OD ࡶ༻୲౰ झຯόεέοτϘʔϧ؍ઓ

Slide 3

Slide 3 text

Carbonͱ͸ʁ

Slide 4

Slide 4 text

$BSCPOͱ͸ʁ Carbon - A simple PHP API extension for DateTime. DateTimeΫϥεͷAPI֦ு IUUQTDBSCPOOFTCPUDPN

Slide 5

Slide 5 text

$BSCPOͱ͸ʁ ศར ௚ײతͰ෼͔Γ΍͍͢ ๛෋ͳAPIͱυΩϡϝϯτ

Slide 6

Slide 6 text

MutableΦϒδΣΫτͱ͸ʁ

Slide 7

Slide 7 text

.VUBCMFΦϒδΣΫτͱ͸ʁ MutableΦϒδΣΫτ ͦͷঢ়ଶΛม͑Δ͜ͱ͕ग़དྷΔΦϒδΣΫτ ImmutableΦϒδΣΫτ ͦͷঢ়ଶΛม͑Δ͜ͱ͕ग़དྷͳ͍ΦϒδΣΫτ ࢀর) Πϛϡʔλϒϧ - Wikipedia | https://ja.wikipedia.org/wiki/Πϛϡʔλϒϧ

Slide 8

Slide 8 text

ຊ೔ͷେࣄͳςʔϚ

Slide 9

Slide 9 text

ຊ೔ͷॏཁࣄ߲ 1. CarbonΛ௨ͯ͡MutableɺImmutableΛ֮͑Α͏ ಛʹImmutableͷ֓೦͸ͱͯ΋େ੾ 2. CarbonͷίʔυϨϏϡʔྗUP Carbon͸࣌ʹةݥͳίʔυΛੜΈग़͢ ৯͍ࢭΊ·͠ΐ͏ʂ

Slide 10

Slide 10 text

ຊ೔ͷॏཁࣄ߲ ͔͠͠ɺී௨ʹίʔυྫΛಡΜͰ΋๞͖ΔͷͰ… ΫΠζܗࣜͰίʔυϨϏϡʔͯ͠Έ·͠ΐ͏ʂ

Slide 11

Slide 11 text

CarbonΫΠζ

Slide 12

Slide 12 text

$BSCPOΫΠζ A܅͸usersςʔϒϧʹొ࿥͞ΕͨϢʔβσʔλͷத ͔Βɺ࠷ۙ̏ϲ݄Ҏ಺ʹొ࿥͞ΕͨϢʔβσʔλΛ நग़͢ΔॲཧΛ࡞Δ͜ͱʹͳΓ·ͨ͠ɻ ͔͠͠ɺA܅͕࡞੒ͨ͠ϓϩάϥϜʹ͸໰୊͕͋ͬ ͯਖ਼͘͠ϢʔβσʔλΛநग़Ͱ͖·ͤΜͰͨ͠ɻ

Slide 13

Slide 13 text

$BSCPOΫΠζ ࣍ͷίʔυͷԿߦ໨ʹ໰୊͕͋ΔͰ͠ΐ͏͔ʁ ͦͯ͠ɺͦΕ͸ԿނͰ͠ΐ͏͔ʁ

Slide 14

Slide 14 text

$BSCPOΫΠζ ࣮ࡍͷϓϩάϥϜʢൈਮʣ 1. Կߦ໨͕໰୊ʁ 2. Կ͕໰୊ʁ

Slide 15

Slide 15 text

CarbonΫΠζ - ղ౴ฤ

Slide 16

Slide 16 text

$BSCPOΫΠζ 1. Կߦ໨͕໰୊ʁ -> 14ߦ໨ 2. Կ͕໰୊ʁ -> subMonthϝιουͰ$todayࣗମ΋มߋ͞Εͯ͠·͏

Slide 17

Slide 17 text

CarbonΫΠζ - ໛ൣղ౴1

Slide 18

Slide 18 text

$BSCPOΫΠζ copy()ϝιουΛ࢖͏ $todayͷෳ੡Λ࡞Δ͜ͱͰɺ$todayࣗମͷมߋΛආ͚Δ

Slide 19

Slide 19 text

CarbonΫΠζ - ໛ൣղ౴2

Slide 20

Slide 20 text

$BSCPOΫΠζ Carbon2 CarbonImmutableͳΒɺ$today͸ImmutableͳͷͰෆม

Slide 21

Slide 21 text

$BSCPOΫΠζ Carbon2 AliasΛ࢖͑͹ɺϓϩάϥϜͷมߋແ͠ɻ

Slide 22

Slide 22 text

·ͱΊ

Slide 23

Slide 23 text

·ͱΊ ɾCarbon͸ѱ͘ͳ͍ ɾAPI֦ுͷੑ࣭Λ͖ͪΜͱ೺Ѳ͢Δ͜ͱ ɾMutable, ImmutableΦϒδΣΫτΛ֮͑Α͏

Slide 24

Slide 24 text

͓·͚

Slide 25

Slide 25 text

$BSCPOͱ$BSCPO MutableΦϒδΣΫτ ImmutableΦϒδΣΫτ ɾCarbon1ܥ ɾDateTimeΫϥεͷ֦ுAPI ɾCarbon2ܥ ɾDateTimeImmutableΫϥεͷ֦ுAPI

Slide 26

Slide 26 text

%BUF5JNF*NNVUBCMFΫϥε ࢀর) PHPϚχϡΞϧ | http://php.net/manual/ja/class.datetimeimmutable.php