Share
Embed
APIs com PHP: da Criação ao Consumo
O objetivo desta palestra é falar sobre APIs, particularmente APIs Web e demonstrar a criação e consumo de uma API simples utilizando a linguagem
PHP.
Er Galvão Abbott
May 20, 2022
Transcript
58 slides
-
www.galvao.eti.br CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott
- 5/20/22 - 1 / 58 APIs com PHP Todas as imagens usadas neste material são de propriedade de suas entidades v. 0.1.0 APIs com da Criação ao Consumo -
Programador Sênior na Vox Tecnologia Primeiro Postman Supernova do Brasil
Presidente da ABRAPHP – Associação Brasileira de Profissionais PHP Diretor da ConFLOSS e da PHP Conference Brasil Evangelista e Contribuidor para a Linguagem Evangelista Laminas Project Embaixador Fedora LATAM Professor Convidado (Especialista) de Pós-Graduação (PR e SC) 25+ anos desenvolvendo sistemas com interface web 20+ destes com PHP ≃ 15 com Zend Framework / Laminas Project Palestrante em eventos nacionais e internacionais Professor de cursos presenciais e a distância Quem?! CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott - 5/20/22 - 2 / 58 www.galvao.eti.br www.galvao.eti.br -
Objetivo CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott
- 5/20/22 - 3 / 58 www.galvao.eti.br Falar sobre APIs, particularmente APIs Web e demonstrar a criação e consumo de uma API simples utilizando a linguagem PHP. APIs com PHP -
Por quê? CC Attribution-ShareAlike 3.0 Unported License by Er Galvão
Abbott - 5/20/22 - 4 / 58 www.galvao.eti.br APIs fazem sentido APIs com PHP -
Por quê? CC Attribution-ShareAlike 3.0 Unported License by Er Galvão
Abbott - 5/20/22 - 5 / 58 www.galvao.eti.br APIs fazem sentido APIs com PHP strlen( $str ) int -
Por quê? CC Attribution-ShareAlike 3.0 Unported License by Er Galvão
Abbott - 5/20/22 - 6 / 58 www.galvao.eti.br APIs fazem sentido APIs com PHP strlen( $str ) int ponto de acesso -
Por quê? CC Attribution-ShareAlike 3.0 Unported License by Er Galvão
Abbott - 5/20/22 - 7 / 58 www.galvao.eti.br APIs fazem sentido APIs com PHP strlen( $str ) int ponto de acesso informação -
Por quê? CC Attribution-ShareAlike 3.0 Unported License by Er Galvão
Abbott - 5/20/22 - 8 / 58 www.galvao.eti.br APIs fazem sentido APIs com PHP strlen( $str ) int ponto de acesso informação resultado -
Por quê? CC Attribution-ShareAlike 3.0 Unported License by Er Galvão
Abbott - 5/20/22 - 9 / 58 www.galvao.eti.br APIs fazem sentido APIs com PHP strlen( $str ) https://foo/ produto / 253 int string (JSON, etc...) ponto de acesso informação resultado -
Por quê? CC Attribution-ShareAlike 3.0 Unported License by Er Galvão
Abbott - 5/20/22 - 10 / 58 www.galvao.eti.br APIs fazem sentido APIs com PHP strlen( $str ) https://foo/ produto / 253 int string (JSON, etc...) ponto de acesso informação resultado -
Por quê? CC Attribution-ShareAlike 3.0 Unported License by Er Galvão
Abbott - 5/20/22 - 11 / 58 www.galvao.eti.br APIs fazem sentido APIs com PHP strlen( $str ) https://foo/ produto / 253 int string (JSON, etc...) ponto de acesso informação resultado -
Por quê? CC Attribution-ShareAlike 3.0 Unported License by Er Galvão
Abbott - 5/20/22 - 12 / 58 www.galvao.eti.br APIs fazem sentido APIs com PHP strlen( $str ) https://foo/ produto / 253 int string (JSON, etc...) ponto de acesso informação resultado -
Por quê? CC Attribution-ShareAlike 3.0 Unported License by Er Galvão
Abbott - 5/20/22 - 13 / 58 www.galvao.eti.br Web faz sentido APIs com PHP -
Por quê? CC Attribution-ShareAlike 3.0 Unported License by Er Galvão
Abbott - 5/20/22 - 14 / 58 www.galvao.eti.br Web faz sentido APIs com PHP simples -
Por quê? CC Attribution-ShareAlike 3.0 Unported License by Er Galvão
Abbott - 5/20/22 - 15 / 58 www.galvao.eti.br Web faz sentido APIs com PHP simples implementada -
Por quê? CC Attribution-ShareAlike 3.0 Unported License by Er Galvão
Abbott - 5/20/22 - 16 / 58 www.galvao.eti.br Web faz sentido APIs com PHP simples implementada suportada -
Por quê? CC Attribution-ShareAlike 3.0 Unported License by Er Galvão
Abbott - 5/20/22 - 17 / 58 www.galvao.eti.br php faz sentido APIs com PHP -
Por quê? CC Attribution-ShareAlike 3.0 Unported License by Er Galvão
Abbott - 5/20/22 - 18 / 58 www.galvao.eti.br php faz sentido APIs com PHP simples -
Por quê? CC Attribution-ShareAlike 3.0 Unported License by Er Galvão
Abbott - 5/20/22 - 19 / 58 www.galvao.eti.br php faz sentido APIs com PHP simples livre -
Por quê? CC Attribution-ShareAlike 3.0 Unported License by Er Galvão
Abbott - 5/20/22 - 20 / 58 www.galvao.eti.br php faz sentido APIs com PHP simples livre robusta -
Conceito CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott
- 5/20/22 - 22 / 58 www.galvao.eti.br APIs com PHP -
Conceito CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott
- 5/20/22 - 23 / 58 www.galvao.eti.br APIs com PHP PSRs 7 (HTTP Messages) 15 (HTTP Server Request Handlers) www.php-fig.org -
Conceito CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott
- 5/20/22 - 24 / 58 www.galvao.eti.br APIs com PHP PSRs 7 (HTTP Messages) 15 (HTTP Server Request Handlers) 13, 17, 18… HAL Factories Client www.php-fig.org -
Prática CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott
- 5/20/22 - 25 / 58 www.galvao.eti.br APIs com PHP -
Prática CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott
- 5/20/22 - 26 / 58 www.galvao.eti.br APIs com PHP -
Prática CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott
- 5/20/22 - 27 / 58 www.galvao.eti.br APIs com PHP -
Prática CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott
- 5/20/22 - 28 / 58 www.galvao.eti.br APIs com PHP -
Prática CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott
- 5/20/22 - 29 / 58 www.galvao.eti.br APIs com PHP -
CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott -
5/20/22 - 30 / 58 www.galvao.eti.br Use código-fonte que você não entende completamente e prepare-se para ser julgado DISCLAIMER APIs com PHP -
CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott -
5/20/22 - 31 / 58 www.galvao.eti.br Use código-fonte que você não entende completamente e prepare-se para ser julgado pelo Rei Koala do Inferno. DISCLAIMER APIs com PHP -
Prática CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott
- 5/20/22 - 32 / 58 www.galvao.eti.br APIs com PHP composer create-project \ mezzio/mezzio-skeleton \ /var/www/html/APIs_e_PHP github.com/galvao/APIs_e_PHP -
Roteamento CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott
- 5/20/22 - 33 / 58 www.galvao.eti.br APIs com PHP config/routes.php -
Configuração CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott
- 5/20/22 - 34 / 58 www.galvao.eti.br APIs com PHP config/pipeline.php -
Configuração CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott
- 5/20/22 - 35 / 58 www.galvao.eti.br APIs com PHP config/autoload/database.global.php -
Configuração CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott
- 5/20/22 - 36 / 58 www.galvao.eti.br APIs com PHP config/autoload/dependencies.global.php -
Configuração CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott
- 5/20/22 - 37 / 58 www.galvao.eti.br APIs com PHP src/App/ConfigProvider.php -
Factory CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott
- 5/20/22 - 38 / 58 www.galvao.eti.br APIs com PHP src/App/Handler/ProdutoHandlerFactory.php -
Handler (Pre) CC Attribution-ShareAlike 3.0 Unported License by Er Galvão
Abbott - 5/20/22 - 39 / 58 www.galvao.eti.br APIs com PHP src/App/Handler/ProdutoHandler.php -
Handle GET CC Attribution-ShareAlike 3.0 Unported License by Er Galvão
Abbott - 5/20/22 - 40 / 58 www.galvao.eti.br APIs com PHP src/App/Handler/ProdutoHandler.php -
Handle POST CC Attribution-ShareAlike 3.0 Unported License by Er Galvão
Abbott - 5/20/22 - 41 / 58 www.galvao.eti.br APIs com PHP src/App/Handler/ProdutoHandler.php -
Handle PATCH CC Attribution-ShareAlike 3.0 Unported License by Er Galvão
Abbott - 5/20/22 - 42 / 58 www.galvao.eti.br APIs com PHP src/App/Handler/ProdutoHandler.php -
Handle DELETE CC Attribution-ShareAlike 3.0 Unported License by Er Galvão
Abbott - 5/20/22 - 43 / 58 www.galvao.eti.br APIs com PHP src/App/Handler/ProdutoHandler.php -
Prática CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott
- 5/20/22 - 45 / 58 www.galvao.eti.br APIs com PHP -
Prática CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott
- 5/20/22 - 46 / 58 www.galvao.eti.br APIs com PHP Guzzle -
Prática CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott
- 5/20/22 - 47 / 58 www.galvao.eti.br APIs com PHP Guzzle composer require guzzlehttp/guzzle github.com/galvao/APIs_e_PHP-consumidor -
Setup CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott
- 5/20/22 - 48 / 58 www.galvao.eti.br APIs com PHP consumir.php Guzzle -
GET CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott
- 5/20/22 - 49 / 58 www.galvao.eti.br APIs com PHP consumir.php GET Guzzle -
POST CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott
- 5/20/22 - 50 / 58 www.galvao.eti.br APIs com PHP consumir.php POST Guzzle -
PATCH CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott
- 5/20/22 - 51 / 58 www.galvao.eti.br APIs com PHP consumir.php PATCH Guzzle -
DELETE CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott
- 5/20/22 - 52 / 58 www.galvao.eti.br APIs com PHP consumir.php DELETE Guzzle -
Conclusão CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott
- 5/20/22 - 53 / 58 www.galvao.eti.br APIs com PHP -
Conclusão CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott
- 5/20/22 - 54 / 58 www.galvao.eti.br APIs com PHP APIs Web -
Conclusão CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott
- 5/20/22 - 55 / 58 www.galvao.eti.br APIs com PHP APIs Web com PHP -
Conclusão CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott
- 5/20/22 - 56 / 58 www.galvao.eti.br APIs com PHP APIs Web com PHP com PSRs -
Conclusão CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott
- 5/20/22 - 57 / 58 www.galvao.eti.br APIs com PHP APIs Web com PHP com PSRs com Framework* -
Muito obrigado! CC Attribution-ShareAlike 3.0 Unported License by Er Galvão
Abbott - 5/20/22 - 58 / 58 www.galvao.eti.br Dúvidas? Críticas? Elogios?! ? APIs com PHP