Slide 1

Slide 1 text

%*$POUBJOFS.VTFVN !1)1 !TPUB :"1 BDIJNPO $"TJB)BDIJPKJ !඼઒

Slide 2

Slide 2 text

ࣗݾ঺հ w ਿӜᰜଠ 4PUB4VHJVSB w !TPUB w גࣜձࣾΞΠελΠϧ೥໨ w *1)1+BWB4DSJQU

Slide 3

Slide 3 text

ຊ೔ͷ࿩

Slide 4

Slide 4 text

%FQFOEFODZ*OKFDUJPO $POUBJOFS

Slide 5

Slide 5 text

ͦͷલʹʜ ͦ΋ͦ΋%FQFOEFODZ*OKFDUJPOͬͯͳΜͧ

Slide 6

Slide 6 text

%FQFOEFODZ *OKFDUJPO

Slide 7

Slide 7 text

ίϯϙʔωϯτؒͷґଘΛ ؇࿨͢Δ

Slide 8

Slide 8 text

6TFSQIQ db = new DB('mysql'); } public function getUsers() { return $this->db->table('users')->selectAll(); } }

Slide 9

Slide 9 text

΋͜͠ΜͳίʔυΛॻ͘ͱ w ͍ΖΜͳ͓͡͞Μʹࡴ͞ΕΔ w ૄ݁߹͓͡͞Μ w ςετ͓͡͞Μ w ΦϒδΣΫτࢦ޲͓͡͞Μ

Slide 10

Slide 10 text

No content

Slide 11

Slide 11 text

Կ͕μϝͳͷ͔

Slide 12

Slide 12 text

ϨϏϡʔλΠϜ w %#Ϋϥεͷ"1*͕มΘͬͨΒ6TFSQIQΛಡ· ͳ͖Ό͍͚ͳ͍ w σʔλϕʔε͕มߋ͞ΕͨΒ6TFSQIQΛมߋ͠ ͳ͖Ό͍͚ͳ͍ w ςετ࣌͸σʔλϕʔε઀ଓΛϞοΫ͍ͨ͠Μͩ ͚ͲͲ͏࣮ݱ͢Δͷʁ

Slide 13

Slide 13 text

db = new DB('mysql'); } public function getUsers() { return $this->db->table('users')->selectAll(); } } 6TFSQIQ %#Ϋϥεͷ"1*มߋͷӨڹΛड͚Δ

Slide 14

Slide 14 text

db = new DB('mysql'); } public function getUsers() { return $this->db->table('users')->selectAll(); } } 6TFSQIQ σʔλϕʔεมߋ࣌ʹ Ҿ਺Λॻ͖׵͑ͳ͚Ε͹͍͚ͳ͍

Slide 15

Slide 15 text

db = new DB('mysql'); } public function getUsers() { return $this->db->table('users')->selectAll(); } } 6TFSQIQ ͜ͷ஋ΛͲ͏΍ͬͯϞοΫ͢Δͷʁ

Slide 16

Slide 16 text

ґଘؔ܎ w ͭ·Γɺ6TFSΫϥε͸%#ΫϥεͷมߋͷӨڹ Λड͚΍͍͢ w 6TFSΫϥε͸%#Ϋϥε΁ͷґଘ౓͕ߴ͍

Slide 17

Slide 17 text

꒪⌓꒪

Slide 18

Slide 18 text

ղܾΛࢼΈΔ

Slide 19

Slide 19 text

6TFSQIQ db = new DB('mysql'); } public function getUsers() { return $this->db->table('users')->selectAll(); } }

Slide 20

Slide 20 text

6TFSQIQ db = new DB('mysql'); } public function getUsers() { return $this->db->table('users')->selectAll(); } } ͜ͷॲཧ͕ݪҼͬΆ͍

Slide 21

Slide 21 text

.BJOQIQ

Slide 22

Slide 22 text

6TFSQIQ db = $db; } public function getUsers() { return $this->db->table('users')->selectAll(); } }

Slide 23

Slide 23 text

6TFSQIQ db = $db; } public function getUsers() { return $this->db->table('users')->selectAll(); } } 5ZQF)JOU

Slide 24

Slide 24 text

.BJOQIQ

Slide 25

Slide 25 text

5FTUQIQ

Slide 26

Slide 26 text

ϨϏϡʔλΠϜ w σʔλϕʔε͕มߋ͞Εͯ΋6TFSΫϥε͸ॻ͖ ׵͑ͳͯ͘Α͍ w ςετ࣌ʹϞοΫΛίϯετϥΫλʹ౉͢͜ͱ ͕Ͱ͖ͦ͏ w %#ͷ"1*͕มΘΔͱ6TFSΫϥεΛॻ͖׵͑ͳ ͖Ό͍͚ͳ͍໰୊͸มΘΒͣ

Slide 27

Slide 27 text

"1*ͷมߋʹڧ͍ΠέͯΔ࢓૊Έ͕ཉ͍͠ P ɻ 㵺㱿㵺

Slide 28

Slide 28 text

*OUFSGBDF

Slide 29

Slide 29 text

8JUIPVU*OUFSGBDF 6TFS %# *OKFDUJPO

Slide 30

Slide 30 text

8JUI*OUFSGBDF 6TFS %#*OUFSGBDF 5ZQF)JOU %# *NQMFNFOU *OKFDUJPO

Slide 31

Slide 31 text

%#*OUFSGBDFQIQ

Slide 32

Slide 32 text

6TFSQIQ db = $db; } public function getUsers() { return $this->db->table('users')->selectAll(); } } *OUFSGBDF

Slide 33

Slide 33 text

.BJOQIQ

Slide 34

Slide 34 text

ϨϏϡʔλΠϜ w σʔλϕʔε͕มߋ͞Εͯ΋6TFSΫϥε͸ॻ͖ ׵͑ͳͯ͘Α͍ w ςετ࣌ʹϞοΫΛίϯετϥΫλʹ౉͢͜ͱ ͕Ͱ͖ͦ͏ w Πϯελϯεͷ"1*͕มߋ͞Εͯ΋*OUFSGBDF͞ ͑कΒΕ͍ͯΕ͹ॻ͖׵͑ͳͯ͘Α͍

Slide 35

Slide 35 text

ґଘݮΒͤͨ٩ ˊᗜˋ و

Slide 36

Slide 36 text

*U`T%FQFOEFODZ*OKFDUJPO w ͜Ε͕%*ύλʔϯͷجຊܕ w ΫϥεͷதͰͳ͘ɺ֎Ͱґଘ͢ΔΦϒδΣΫτ Λ࡞Γ֎͔Β஫ೖ͢Δ w ͜Ε͸ҰྫͰɺଞʹ΋༷ʑͳΞϓϩʔν͕͋Δ

Slide 37

Slide 37 text

,JOEPG%* w ίϯετϥΫλΠϯδΣΫγϣϯ w ηολʔΠϯδΣΫγϣϯ w ϝιουΠϯδΣΫγϣϯ w ϑΟʔϧυΠϯδΣΫγϣϯ

Slide 38

Slide 38 text

๻ʮͬͦ͘͞ΞϓϦॻ͜͏ʯ

Slide 39

Slide 39 text

$POUSPMMFSQIQ getIndexPage(); } }

Slide 40

Slide 40 text

$POUSPMMFSQIQ getIndexPage(); } } ᶃෳࡶ͗͢Δ

Slide 41

Slide 41 text

$POUSPMMFSQIQ getIndexPage(); } } ᶃෳࡶ͗͢Δ ᶄ݁ہOFXͯ͠Δ

Slide 42

Slide 42 text

δϨϯϚ w %*ύλʔϯʹΑΓۃݶ·Ͱґଘ౓ΛݮΒ͢͜ͱ ͸Մೳ w ͕ͩ݁ہͲ͔͜ͰΠϯελϯε͸࡞Βͳ͖Ό͍ ͚ͳ͍ w ΞϓϦέʔγϣϯ͕ڊେʹͳΕ͹ͳΔ΄ͲΠϯ ελϯεੜ੒͕ෳࡶʹͳ͍ͬͯ͘

Slide 43

Slide 43 text

δϨϯϚ w *OUFSGBDFΛ࢖༻ͯ͠ૄ݁߹Խͯ͠Δ৔߹͸ந৅ Ϋϥεʹର͢Δ۩৅ΫϥεͷϚοϐϯά͕ඞཁ w ڊେʹͳΕ͹ͳΔ΄Ͳ؅ཧ͕൥ࡶʹ

Slide 44

Slide 44 text

No content

Slide 45

Slide 45 text

ઃఆΛར༻͔Β෼཭͠Α͏

Slide 46

Slide 46 text

ઃఆͱ͸ΦϒδΣΫτΛ࡞Δํ๏ ར༻ͱ͸ΞϓϦέʔγϣϯຊମ

Slide 47

Slide 47 text

ղܾ͍ͨ͜͠ͱ w ΞϓϦͰ͸ٻΊΔ΋ͷ͕༩͑ΒΕΕ͹ಈ͘ίʔ υΛॻ͖͍ͨ w ͲͷΦϒδΣΫτʹԿ͕஫ೖ͞ΕΔ͔ͷ؅ཧ͸ ͳΔ΂ͨ͘͘͠ͳ͍

Slide 48

Slide 48 text

͓ɹ·ɹͨɹͤ ͔ͬ͜Βຊฤ

Slide 49

Slide 49 text

%FQFOEFODZ*OKFDUJPO $POUBJOFS

Slide 50

Slide 50 text

%*$POUBJOFS w ΦϒδΣΫτ΍ΦϒδΣΫτͷੜ੒ํ๏Λอ࣋ ͢Δശ w %*ίϯςφ͕Πϯελϯεͷੜ੒ํ๏Λ஌ͬͯ ͍Δ w ΞϓϦέʔγϣϯ͕%*ίϯςφ͔Βඞཁͳ΋ͷ ΛऔΓग़͚ͩ͢

Slide 51

Slide 51 text

%*$POUBJOFS͸πʔϧ w %*͸σβΠϯύλʔϯ͕ͩ%*ίϯςφ͸σβΠ ϯύλʔϯͰ͸ͳ͍ w %*ύλʔϯΛ࠾༻࣮ͨ͠૷Λڧྗʹޙԡ͢͠Δ ͨΊͷπʔϧͱࢥͬͯྑ͍ w ͳͷͰ༷ʑͳΞϓϩʔν͕͋Δ

Slide 52

Slide 52 text

ཁ͢Δʹ %*$POUBJOFS (FU6TFS4FSWJDF "QQMJDBUJPO

Slide 53

Slide 53 text

ཁ͢Δʹ %*$POUBJOFS "QQMJDBUJPO ΰχϣͬͱ ΠϯελϯεΛ࡞Δ

Slide 54

Slide 54 text

ཁ͢Δʹ %*$POUBJOFS "QQMJDBUJPO 6TFS4FSWJDF ׬੒͞Εͨ6TFS4FSWJDF Πϯελϯε͕ฦͬͯ͘Δ Πϯελϯεͷੜ੒ํ๏Λ ஌ΒͣʹखʹೖΕΔ

Slide 55

Slide 55 text

γϯϓϧʹߟ͑Α͏ w %*ίϯςφͷ௒جຊػೳ͸ొ࿥ͱऔಘ w ޷͖ͳΦϒδΣΫτΛొ࿥͢Δ w ొ࿥ͨ͠ΦϒδΣΫτΛऔಘ͢Δ

Slide 56

Slide 56 text

ͬͦ͘͞࢖͍͍ͨʂ ͲΜͳ΋ͷ͕͋ΔΜͰ͔͢ʁ Φεεϝ͸ʁ

Slide 57

Slide 57 text

1)1%*$POUBJOFST w QJNQMF w BVSBEJ w 1)1%* w %JDF w UIFQIQMFBHVF w TZNGPOZ w "VSZO w [FOETFSWJDFNBOBHFS w BOEFUD

Slide 58

Slide 58 text

1)1%*$POUBJOFST w QJNQMF w BVSBEJ w 1)1%* w %JDF w UIFQIQMFBHVF w TZNGPOZ w "VSZO w [FOETFSWJDFNBOBHFS w BOEFUD ଟ͍

Slide 59

Slide 59 text

ϥΠϒϥϦ࣠Ͱͳ͘ ख๏࣠Ͱ͝Ҋ಺

Slide 60

Slide 60 text

ϥΠϒϥϦ࣠Ͱͳ͘ ख๏࣠Ͱ͝Ҋ಺ 1JNQMF "VSB 4ZNGPOZ 1)1%* ̃⶿䘞☏匝Օ׋ֆָ׋׌ս֡֒Ւ媈䭚ՂթՄ

Slide 61

Slide 61 text

ίϯςφ΁ͷొ࿥

Slide 62

Slide 62 text

LFZWBMVFܗࣜͰͷొ࿥ w ೚ҙͷ஋ͰΦϒδΣΫτΛొ࿥ w αʔϏεϩέʔλͱͯ͠΋࢖͑Δ w ࣗ༝౓͕ߴ͍ w %*ίϯςφͷجຊͱݴͬͯ΋աݴͰͳ͍ 1JNQMF "VSB 4ZNGPOZ 1)1%* "VSZBO QIQMFBHVF ;FOE %JDF

Slide 63

Slide 63 text

LFZWBMVF QJNQMF

Slide 64

Slide 64 text

Ϋϥε໊Ͱͷొ࿥ w Ϋϥε໊ͰΦϒδΣΫτΛొ࿥ w LFZWBMVFΑΓগ੍͠໿͕ڧ͍ w %*ύλʔϯΛ࣮ݱ͠΍͍͢ 1JNQMF "VSB 4ZNGPOZ 1)1%* "VSZBO QIQMFBHVF ;FOE %JDF

Slide 65

Slide 65 text

$MBTTOBNF QIQMFBHVF add('SessionInterface', 'Session');

Slide 66

Slide 66 text

-B[ZMPBE ஗Ԇొ࿥ w ొ࿥͢Δࡍʹ͸ΦϒδΣΫτΛ࡞Βͳ͍ w औಘ͞ΕΔλΠϛϯάͰΦϒδΣΫτΛੜ੒ w %*ίϯςφͷىಈ࣌ؒͷઅ໿ʹͳΔ "VSB 4ZNGPOZ 1)1%* QIQMFBHVF ;FOE

Slide 67

Slide 67 text

γϯάϧτϯ w ΦϒδΣΫτΛγϯάϧτϯͱͯ͠ొ࿥ w औಘ͞ΕΔΦϒδΣΫτ͸ৗʹಉ͡ w ࢖͍ա͗Δͱςετ͕ࠔ೉ʹɻΑ͘ߟ͑Α͏ʂ 1JNQMF "VSB 4ZNGPOZ 1)1%* "VSZBO QIQMFBHVF ;FOE %JDF

Slide 68

Slide 68 text

*OKFDU"SHVNFOUT

Slide 69

Slide 69 text

Ҿ਺ࢦఆొ࿥ w ొ࿥͢ΔࡍʹҾ਺ʹԿΛೖΕΔ͔ࢦఆ͢Δ w ίϯετϥΫλ΍ηολʔɺ5SBJUͳͲʹࢦఆ w ந৅ʹରͯ͠ͷ۩৅Ϛοϐϯά͕Մೳ "VSB 4ZNGPOZ 1)1%* "VSZBO QIQMFBHVF ;FOE %JDF

Slide 70

Slide 70 text

$POTUSVDUPS*OKFDUJPO BVSBEJ newInstance(); // Register $di->params['Example']['foo'] = new Foo();

Slide 71

Slide 71 text

4FUUFS*OKFDUJPO BVSBEJ newInstance(); // Register $di->setters['Example']['setFoo'] = new Foo;

Slide 72

Slide 72 text

ϑΟʔϧυΠϯδΣΫγϣϯ w ϓϩύςΟΛηοτ͢Δ w Ξϊςʔγϣϯ΍ίϝϯτΛ%*ίϯςφ͕ղऍ ͠ɺඞཁͳ෺Λ൑ผ͢Δ w ϞϊʹΑͬͯ͸ίϯςφʹґଘ͢ΔͷͰ஫ҙ 4ZNGPOZ 1)1%*

Slide 73

Slide 73 text

"OOPUBUJPO 1)1%*

Slide 74

Slide 74 text

1SPQFSUZ 4ZNGPOZ setDefinition('talk', ...); $container->setDefinition('yapc', new Definition( 'Yapc' ))->setProperty('talk', new Reference('talk'));

Slide 75

Slide 75 text

'BDUPSZ w $MPVTFSΛొ࿥͢Δ w ෳࡶͳΠϯελϯεੜ੒ΛࢦఆͰ͖Δ w Πϯελϯεੜ੒ΛϑΝΫτϦʔʹ෼཭͢Δͷ ͕༰қʹ 1JNQMF "VSB 4ZNGPOZ 1)1%* "VSZBO QIQMFBHVF ;FOE %JDF

Slide 76

Slide 76 text

4BNQMF ;FOE [ stdClass::class => InvokableFactory::class, MyObject::class => function (ContainerInterface $c, $name) { return new MyObject($c->get('obj')); }, ] ]);

Slide 77

Slide 77 text

BVUPXJSJOH w %*͕ղऍͰ͖Δ৔߹ɺશͯࣗಈͰొ࿥͞ΕΔ w ٻΊΔΠϯελϯε͕ඞཁͳґଘΛղܾ͢Δ "VSB 4ZNGPOZ 1)1%* "VSZBO QIQMFBHVF ;FOE %JDF

Slide 78

Slide 78 text

4BNQMF BVSBEJ newInstance($builder::AUTO_RESOLVE); // Get instance $userService = $di->newInstance('UserService');

Slide 79

Slide 79 text

ίϯςφ͔Βͷऔಘ

Slide 80

Slide 80 text

LFZWBMVFܗࣜͰͷऔಘ w ೚ҙͷ஋ͰΦϒδΣΫτΛऔಘ w ΞϓϦέʔγϣϯ಺Ͱ࢖͏ͱαʔϏεϩέʔλ ʹͳΔ 1JNQMF "VSB 4ZNGPOZ 1)1%* "VSZBO QIQMFBHVF ;FOE %JDF

Slide 81

Slide 81 text

(FUCZLFZOBNF QJNQMF

Slide 82

Slide 82 text

Ϋϥε໊Ͱͷऔಘ w Ϋϥε໊ͰΦϒδΣΫτΛऔಘ w BVUPXJSJOH͕͋Δ΋ͷ͸ొ࿥͞Εͯͳ͍΋ͷ ΋औಘͰ͖Δ 1JNQMF "VSB 4ZNGPOZ 1)1%* "VSZBO QIQMFBHVF ;FOE %JDF

Slide 83

Slide 83 text

(FUCZDMBTTOBNF BVSBEJ newInstance(); // Register $di->params['Example']['foo'] = new Foo(); // Get instance $example = $di->newInstance('Example');

Slide 84

Slide 84 text

(FUCZDMBTTOBNF "VSZBO make('UserService');

Slide 85

Slide 85 text

جຊ͸ొ࿥ͱऔಘ w ొ࿥ͱऔಘͷ֓೦͚ͩΘ͔Ε͹͍͍ͩͨҰॹ w ΞϓϦέʔγϣϯͷن໛΍࣮૷Ξϓϩʔνɺ޷ ΈͰ%*ίϯςφΛબͿ΂͠ w ύϑΥʔϚϯε΍"1*ͷॆ࣮౓΋ݟΔͱָ͍͠

Slide 86

Slide 86 text

143

Slide 87

Slide 87 text

143 w 143Ͱ%*$POUBJOFSͷΠϯλʔϑΣʔεΛܾΊ Α͏ͱ͍͏࿩͕͋Δ w ݱࡏͷϑΣʔζ͸%SBGU w 3FWJFXʹ͕͋Δؾ഑͸ແ͍ؾ͕͢Δɻɻɻ

Slide 88

Slide 88 text

Կ͕ܾΊΒΕ͍ͯΔͷ͔

Slide 89

Slide 89 text

ίϯςφ͔Βͷ औಘΠϯλʔϑΣʔε

Slide 90

Slide 90 text

HFU IBT

Slide 91

Slide 91 text

HFU ΦϒδΣΫτΛऔಘ IBT ΦϒδΣΫτͷ༗ແΛௐ΂Δ

Slide 92

Slide 92 text

DPOUBJOFSJOUFSPQ w ݱ࣌఺ͷ143Λ࣮૷ͨ͠ΠϯλʔϑΣʔε w ΦϒδΣΫτͷऔಘํ๏ͷΈఆٛ͞Ε͍ͯΔ w ޙ͸ྫ֎͕ͭ w ඇৗʹγϯϓϧ IUUQTHJUIVCDPNDPOUBJOFSJOUFSPQDPOUBJOFSJOUFSPQ

Slide 93

Slide 93 text

BDDMJNBUFDPOUBJOFS w DPOUBJOFSJOUFSPQʹै͍ͬͯΔίϯςφΛ݁ ߹Ͱ͖Δ w ίϯςφͷࠩ͠ସ͑ͷϋʔυϧ͕௿͘ͳΔ IUUQTHJUIVCDPNKFSFNFBNJBBDDMJNBUFDPOUBJOFS

Slide 94

Slide 94 text

143͸͍ܾͭ·Δʁ w ਖ਼௚Θ͔ΒΜ ɾТɾʆ w ͦ΋ͦ΋ඞཁ͋Δͷ͔ w ࠓ͸DPOUBJOFSJOUFSPQΛಡΊ͹ॆ෼ w ෼ͰಡΊ·͢

Slide 95

Slide 95 text

·ͱΊ

Slide 96

Slide 96 text

%*$POUBJOFSͷັྗ

Slide 97

Slide 97 text

ઃఆΛར༻͔Β׬શʹ ෼཭Ͱ͖Δ

Slide 98

Slide 98 text

ొ࿥ͱऔಘͷ֓೦Λ ֮͑ͯ

Slide 99

Slide 99 text

܅͚ͩͷ࠷ڧͷ ΞϓϦέʔγϣϯΛखʹೖΕΖ ٩ ˊᗜˋ و

Slide 100

Slide 100 text

͝੩ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠