Slide 1

Slide 1 text

Laravel Intro

Slide 2

Slide 2 text

Master in Science, web developer Hannes Van De Vreken ABOUT

Slide 3

Slide 3 text

Dependency Injection

Slide 4

Slide 4 text

GREAT STUFF • IoC container • ServiceProviders • Facades

Slide 5

Slide 5 text

IOC CONTAINER • Illuminate\Container\Container • Application container • Can create instances by class name

Slide 6

Slide 6 text

IOC CONTAINER

Slide 7

Slide 7 text

IOC CONTAINER • Illuminate\Container\Container • Application container • Can create instances by class name • Recursively

Slide 8

Slide 8 text

IOC CONTAINER

Slide 9

Slide 9 text

No configuration?

Slide 10

Slide 10 text

IOC CONTAINER

Slide 11

Slide 11 text

IOC CONTAINER • Illuminate\Container\Container • Application container • Can create instances by class name • Recursively • Interfaces

Slide 12

Slide 12 text

IOC CONTAINER

Slide 13

Slide 13 text

But… interfaces don’t have constructors?

Slide 14

Slide 14 text

IOC CONTAINER

Slide 15

Slide 15 text

SERVICE PROVIDER • Register • Boot

Slide 16

Slide 16 text

SERVICE PROVIDER

Slide 17

Slide 17 text

SERVICE PROVIDER

Slide 18

Slide 18 text

SERVICE PROVIDER - REGISTER • Bind closures • Define Interface aliases • Don’t use other stuff outside closures

Slide 19

Slide 19 text

SERVICE PROVIDER - BOOT • Register routes • Before/After • Global error handlers

Slide 20

Slide 20 text

FACADES • Allow static-like method calling • Resolve to instance on container

Slide 21

Slide 21 text

FACADES

Slide 22

Slide 22 text

FACADES

Slide 23

Slide 23 text

FACADES

Slide 24

Slide 24 text

FACADES - USAGE

Slide 25

Slide 25 text

FACADES • Inject dependencies • Real mockery mocks • More code if you don’t use facades

Slide 26

Slide 26 text

FACADES - MOCKING

Slide 27

Slide 27 text

Questions?

Slide 28

Slide 28 text

@hannesvdvreken Thank you.

Slide 29

Slide 29 text

• https:/ /github.com/laravel/laravel • http:/ /laravel.com/docs/ioc • https:/ /github.com/illuminate/container • http:/ /wikipedia.org/wiki/Dependency_injection • http:/ /laravel.com/docs/ioc#service-providers • http:/ /laravel.com/docs/packages#service-providers • http:/ /laravel.com/docs/facades • http:/ /laravel.com/docs/facades#mocking-facades REFERENCES