Zend Framework 2 per chi viene da Symfony2

Post on 08-May-2015

1.201 views 0 download

Transcript of Zend Framework 2 per chi viene da Symfony2

venerdì 1 febbraio 2013

venerdì 1 febbraio 2013

per chi viene da

venerdì 1 febbraio 2013

per chi viene da

venerdì 1 febbraio 2013

Michele Orselli

CTO@Ideato @_orso_mo@ideato.it

who Am I?venerdì 1 febbraio 2013

Michele Orselli

CTO@Ideato @_orso_mo@ideato.it

who Am I?venerdì 1 febbraio 2013

Symfony 1.x/2 developer

who Am I?venerdì 1 febbraio 2013

I’m biasedvenerdì 1 febbraio 2013

I’m biased

dependency injection

event MVCservice

component

app layout

request

responselistener

command

venerdì 1 febbraio 2013

Zend Framework 2

- legacy app/db- soap api- restish api

my 1st zf2 projectvenerdì 1 febbraio 2013

the journey beginsvenerdì 1 febbraio 2013

standards

sf2 & zf2 ♥ standards

venerdì 1 febbraio 2013

standards

PSR-*PSR-0: autoloading PSR-1/2: coding standardPSR-3: logging

https://github.com/php-fig/fig-standards

venerdì 1 febbraio 2013

don’t reinvent the wheel

3rd party libs

venerdì 1 febbraio 2013

ASSETIC: asset managementCOMPOSER: package managementDOCTRINE: ORMTWIG: templating engine

3rd party libs

don’t reinvent the wheelvenerdì 1 febbraio 2013

componentsvenerdì 1 febbraio 2013

Sf2 components

BrowserKit: simulates a browserCssSelector: converts CSS selector to XPath expressionDomCrawler: easy DOM navigationProcess: asset managementFinder: package managementHTTPFoundation: package managementDependencyInjection: dependency injection containerEventDispatcher: observer pattern

venerdì 1 febbraio 2013

Zf2 components

Soap: a soap server/client with wsdl generationInputFilter: user input filterDomQuery: easy DOM navigationValidator: user input valdatorServiceManager: a service locator implementationMVC: an mvc implementationDI: dependency injection containerEventManager: observer pattern

venerdì 1 febbraio 2013

well know (?) pattern

components implement well known patterns

venerdì 1 febbraio 2013

EventManager vs EventDispatchervenerdì 1 febbraio 2013

Integration via composer

composer.json

venerdì 1 febbraio 2013

toward bigger blocks

Bundles/Modules

venerdì 1 febbraio 2013

Sf2 Bundles

Bundle: group of PHP, javascript, css, config files implementing a feature.

Almost everything in sf2 is in a bundle

venerdì 1 febbraio 2013

Sf2 Bundle dir structure

Acme/DemoBundle/

Controller/Command/Entity/Resources/

config/services.ymlrouting.yml

public/views/

Test/AcmeDemoBundle.php

venerdì 1 febbraio 2013

Zf2 Modules

Module: group of PHP, javascript, css, config files implementing a feature.

venerdì 1 febbraio 2013

Zf2 Module dir structure

Application/config/

module.config.php src/

Application/Controller/Service/

view/test/

ApplicationTest/Module.php

venerdì 1 febbraio 2013

Sf2 Bundle app integration

AcmeDemoBundle.php

venerdì 1 febbraio 2013

Zf2 Module dir structure

Module.php

venerdì 1 febbraio 2013

Sf2 service definition

services.xml

venerdì 1 febbraio 2013

Sf2 service definition

services.xml

venerdì 1 febbraio 2013

wait a minute...

where’s the DIC???

venerdì 1 febbraio 2013

Zf2 service locator

Module.php

venerdì 1 febbraio 2013

Zf2 events

Module.php

venerdì 1 febbraio 2013

Sf2 MVC

routing.yml

CompanyController.php

venerdì 1 febbraio 2013

Sf2 Events

kernel.requestkernel.controllerkernel.viewkernel.responsekernel.exceptionkernel.terminate

venerdì 1 febbraio 2013

Zf2 MVC

modules.config.php

IndexController.php

venerdì 1 febbraio 2013

Zf2 Controller Plugin

Module.php

IndexController.php

venerdì 1 febbraio 2013

Zf2 Events

Zend\Mvc\Application: bootstrapZend\Mvc\Application: routeZend\Mvc\Application: dispatchZend\Mvc\Controller\ActionController: dispatchZend\Mvc\Application: dispatch.errorZend\Mvc\Application: renderZend\View\View: rendererZend\View\View: responseZend\Mvc\Application: finish

venerdì 1 febbraio 2013

sf2 console

php app/console

venerdì 1 febbraio 2013

sf2 console

MyCommand.php

venerdì 1 febbraio 2013

zf2 console

where’s the console???

venerdì 1 febbraio 2013

zf2 controllers as console command

modules.config.php

CrawlController.php

venerdì 1 febbraio 2013

Sf2 app structure

app/config/

config.ymlconfig_*.ymlrouting.ymlrouting_dev.yml

AppKernel.phpconsole

src/vendor/web/

app.phpapp_dev.php

venerdì 1 febbraio 2013

Zf2 app structure

app/config/

autoload/global.phplocal.php.dist

application.config.phpmodule/vendor/public/

index.php

venerdì 1 febbraio 2013

wrap up

what I take home?venerdì 1 febbraio 2013

bumpy ride initiallyvenerdì 1 febbraio 2013

what I’ve missed from Sf2venerdì 1 febbraio 2013

what I’ve missed from Sf2

Symfony standard edition

venerdì 1 febbraio 2013

what I’ve missed from Sf2

Symfony cheatsheet

venerdì 1 febbraio 2013

learning Zf2 if you know Sf2 is quite smooth...

what I take home?venerdì 1 febbraio 2013

if...

what I take home?venerdì 1 febbraio 2013

what I take home?

you read the docs

venerdì 1 febbraio 2013

what I take home?

http://framework.zend.com/manual/2.0/en/index.html

http://modules.zendframework.com/

http://www.mwop.net

http://akrabat.com/category/zend-framework-2/

http://ocramius.github.com/

http://www.maltblue.com/tag/zend-framework

http://juriansluiman.nl/en/

... you get it

venerdì 1 febbraio 2013

what I take home?

you read the code

venerdì 1 febbraio 2013

what I take home?

https://github.com/zendframework

https://github.com/weierophinney

https://github.com/Ocramius

https://packagist.org/

... you get it

venerdì 1 febbraio 2013

Thank YOU!

@_orso_

mo@ideato.it

that’s all folks!

Pics Credits:

Glass: http://www.flickr.com/photos/daveynin/6722545177/

Journey: http://www.flickr.com/photos/landrovermena/7086355379/

Components: http://www.flickr.com/photos/37996583811@N01/5955271663/

Not Found: http://www.flickr.com/photos/girliemac/6508022985/

venerdì 1 febbraio 2013