Slide 1

Slide 1 text

CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott - 9/27/14 - 1 / 34 Desenvolvendo Aplicações com ZF2 www.galvao.eti.br Desenvolvendo Aplicações com 2

Slide 2

Slide 2 text

Er Galvão Abbott é Presidente da ABRAPHP – Associação Brasileira de Profissionais PHP e Diretor da PHP Conference Brasil, o principal evento de PHP da América Latina. Trabalha há 20 anos desenvolvendo sistemas e aplicações com interface web, sendo 15 destes com PHP e 7 com Zend Framework. Trabalhou com diversas empresas de grande porte, tanto nacionais como internacionais. Palestra em eventos, ministra cursos presenciais e a distância e é o fundador e líder do GU PHPBR, Grupo de Usuários de abrangência nacional, que hoje conta com mais de 1.200 usuários cadastrados. Site: http://www.galvao.eti.br/ Twitter: @galvao Slides e Documentos: http://slideshare.net/ergalvao https://speakerdeck.com/galvao Github: http://github.com/galvao Quem?! CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott - 9/27/14 - 2 / 34 Desenvolvendo Aplicações com ZF2 www.galvao.eti.br

Slide 3

Slide 3 text

Objetivo Apresentar detalhes Básicos → Intermediários sobre o Zend Framework 2, detalhando conceitos envolvidos no desenvolvimento de uma aplicação. Serão apresentados os seguintes tópicos: → Porque escolher o ZF2? → Setup inicial, “Instalação” e Configuração → Ambientes → Rotas → Models, Controllers e Views → Validação → CRUD CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott - 9/27/14 - 3 / 34 Desenvolvendo Aplicações com ZF2 www.galvao.eti.br

Slide 4

Slide 4 text

Por quê ZF2? Open Source PHP >= 5.3 > 2 anos e meio namespaces > 2.000 changesets closures > 200 profissionais late static binding Microsoft, Google, et al. Composer Github PHAR PHPUnit 100% OO TravisCI S.O.L.I.D. CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott - 9/27/14 - 4 / 34 Desenvolvendo Aplicações com ZF2 www.galvao.eti.br

Slide 5

Slide 5 text

Por quê ZF2? CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott - 9/27/14 - 5 / 34 Desenvolvendo Aplicações com ZF2 www.galvao.eti.br Modular modules.zendframework.com Flexível Dependency Injection, application.config.php, Module.php, module.config.php Eventos Serviços

Slide 6

Slide 6 text

Skeleton Application – Instalação CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott - 9/27/14 - 6 / 34 github.com/zendframework/ZendSkeletonApplication Composer git clone git submodule download composer create-project -sdev --repository-url="https://packages.zendframework.com" zendframework/skeleton-application path/to/install Desenvolvendo Aplicações com ZF2 www.galvao.eti.br

Slide 7

Slide 7 text

CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott - 9/27/14 - 7 / 34 Skeleton Application – Estrutura Configuração a nível de aplicação Dados da aplicação Módulos da aplicação Raiz web Componentes/Módulos externos Desenvolvendo Aplicações com ZF2 www.galvao.eti.br

Slide 8

Slide 8 text

CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott - 9/27/14 - 8 / 34 Configuração a nível de aplicação Configuração do “ambiente” Configuração “global” da Aplicação Desenvolvendo Aplicações com ZF2 www.galvao.eti.br Skeleton Application – Estrutura

Slide 9

Slide 9 text

CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott - 9/27/14 - 9 / 34 Configuração do Módulo Raiz do Módulo i18n Fonte do Módulo Inicialização do Módulo Desenvolvendo Aplicações com ZF2 www.galvao.eti.br Skeleton Application – Estrutura

Slide 10

Slide 10 text

CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott - 9/27/14 - 10 / 34 Desenvolvendo Aplicações com ZF2 www.galvao.eti.br Skeleton Application – Estrutura

Slide 11

Slide 11 text

CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott - 9/27/14 - 11 / 34 Zend Framework 2 Desenvolvendo Aplicações com ZF2 www.galvao.eti.br Skeleton Application – Estrutura

Slide 12

Slide 12 text

MVC – ZF2 Style CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott - 9/27/14 - 12 / 34 Desenvolvendo Aplicações com ZF2 www.galvao.eti.br Requisição Inicialização do Módulo Bootstrap Resposta Execução da Aplicação Roteamento Dispatch

Slide 13

Slide 13 text

Setup inicial CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott - 9/27/14 - 13 / 34 Desenvolvendo Aplicações com ZF2 www.galvao.eti.br public/index.php

Slide 14

Slide 14 text

CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott - 9/27/14 - 14 / 34 Setup inicial config/autoload/global.php Desenvolvendo Aplicações com ZF2 www.galvao.eti.br

Slide 15

Slide 15 text

CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott - 9/27/14 - 15 / 34 Setup inicial config/autoload/local.php Desenvolvendo Aplicações com ZF2 www.galvao.eti.br

Slide 16

Slide 16 text

CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott - 9/27/14 - 16 / 34 Setup inicial module/Application/Module.php Desenvolvendo Aplicações com ZF2 www.galvao.eti.br

Slide 17

Slide 17 text

Setup inicial CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott - 9/27/14 - 17 / 34 Desenvolvendo Aplicações com ZF2 www.galvao.eti.br config/application.config.php

Slide 18

Slide 18 text

module/Application/config/module.config.php … ?!?! CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott - 9/27/14 - 18 / 34 Desenvolvendo Aplicações com ZF2 www.galvao.eti.br

Slide 19

Slide 19 text

module/Application/config/module.config.php … ?!?! CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott - 9/27/14 - 19 / 34 Desenvolvendo Aplicações com ZF2 www.galvao.eti.br Muita calma nessa hora!

Slide 20

Slide 20 text

Ufa! CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott - 9/27/14 - 20 / 34 Desenvolvendo Aplicações com ZF2 www.galvao.eti.br module/Application/config/module.config.php Rotas Serviços Controllers “disponíveis” Questões sobre a camada de view

Slide 21

Slide 21 text

Rotas CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott - 9/27/14 - 21 / 34 Desenvolvendo Aplicações com ZF2 www.galvao.eti.br Literais

Slide 22

Slide 22 text

Rotas CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott - 9/27/14 - 22 / 34 Desenvolvendo Aplicações com ZF2 www.galvao.eti.br Com rotas filhas / com segmentos (≃ ZF1)

Slide 23

Slide 23 text

Controllers CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott - 9/27/14 - 23 / 34 Desenvolvendo Aplicações com ZF2 www.galvao.eti.br module/Application/src/Application/Controller/IndexController.php

Slide 24

Slide 24 text

Dados Externos: Forms CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott - 9/27/14 - 24 / 34 Desenvolvendo Aplicações com ZF2 www.galvao.eti.br module/Application/src/Application/Form/User/Register.php

Slide 25

Slide 25 text

Dados Externos: Filtros CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott - 9/27/14 - 25 / 34 Desenvolvendo Aplicações com ZF2 www.galvao.eti.br module/Application/src/Application/Filter/User/Register.php

Slide 26

Slide 26 text

Models CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott - 9/27/14 - 26 / 34 Desenvolvendo Aplicações com ZF2 www.galvao.eti.br module/Application/src/Application/Model/User.php

Slide 27

Slide 27 text

Models CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott - 9/27/14 - 27 / 34 Desenvolvendo Aplicações com ZF2 www.galvao.eti.br module/Application/src/Application/Model/UserTable.php

Slide 28

Slide 28 text

Models CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott - 9/27/14 - 28 / 34 Desenvolvendo Aplicações com ZF2 www.galvao.eti.br module/Application/src/Application/Module.php

Slide 29

Slide 29 text

Models - CRUD CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott - 9/27/14 - 29 / 34 Desenvolvendo Aplicações com ZF2 www.galvao.eti.br module/Application/src/Application/Model/UserTable.php

Slide 30

Slide 30 text

Models - CRUD CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott - 9/27/14 - 30 / 34 Desenvolvendo Aplicações com ZF2 www.galvao.eti.br module/Application/src/Application/Model/UserTable.php

Slide 31

Slide 31 text

Models - CRUD CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott - 9/27/14 - 31 / 34 Desenvolvendo Aplicações com ZF2 www.galvao.eti.br module/Application/src/Application/Model/UserTable.php

Slide 32

Slide 32 text

Unindo as partes na Controller CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott - 9/27/14 - 32 / 34 Desenvolvendo Aplicações com ZF2 www.galvao.eti.br module/Application/src/Application/Controller/UserController.php

Slide 33

Slide 33 text

CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott - 9/27/14 - 33 / 34 Concluindo... Desenvolvendo Aplicações com ZF2 www.galvao.eti.br

Slide 34

Slide 34 text

Obrigado! ? Dúvidas? ↓ Críticas? ↑ Elogios?! CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott - 9/27/14 - 34 / 34 Desenvolvendo Aplicações com ZF2 www.galvao.eti.br