Your SlideShare is downloading. ×
0
Palestra codephant
Palestra codephant
Palestra codephant
Palestra codephant
Palestra codephant
Palestra codephant
Palestra codephant
Palestra codephant
Palestra codephant
Palestra codephant
Palestra codephant
Palestra codephant
Palestra codephant
Palestra codephant
Palestra codephant
Palestra codephant
Palestra codephant
Palestra codephant
Palestra codephant
Palestra codephant
Palestra codephant
Palestra codephant
Palestra codephant
Palestra codephant
Palestra codephant
Palestra codephant
Palestra codephant
Palestra codephant
Palestra codephant
Palestra codephant
Palestra codephant
Palestra codephant
Palestra codephant
Palestra codephant
Palestra codephant
Palestra codephant
Palestra codephant
Palestra codephant
Palestra codephant
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Palestra codephant

136

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
136
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
1
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Bibliotecas PHP Por Jefersson Nathan
  • 2. Jefersson Nathan malukenho is a leader and representative of the PHP User Group of the State of Sergipe, Brazil. Where works to keep the local community strong and united. Currently, he works in a company focusing on web solutions and devotes his free time to help with community projects OpenSources contributions. - Web and PHP Magazine, May 2013 2
  • 3. O que é uma biblioteca?
  • 4. Dicio 1. ... 2. Coleção de obras de um autor. 3. Coleção de obras sobre assuntos determinados. 4. Coleção de obras de um povo 4
  • 5. Porque usar uma biblioteca?
  • 6. Porque? 1. Fácilidade para resolver um problema 2. Reusabilidade 3. Confiança 4. Produtividade 5. $$ Dinaro $$ 7
  • 7. Tipos de biblioteca
  • 8. Existem 2 principais tipos de bibliotecas no php 1. Extensões escritas em C (Ex: SPL) 2. Bibliotecas em PHP (Composer, PHPunit, etc) 9
  • 9. bla bla bla bla bla 10
  • 10. COMPOSER
  • 11. Composer 12
  • 12. Instalação $ curl -sS https://getcomposer.org/installer | php --install-dir=bin 01. 02. 13
  • 13. composer.json { require: { "respect/validation": "dev-develop", "phpunit/phpunit": "3.7.*" } } 01. 02. 03. 04. 05. 06. 14
  • 14. Gerar composer.json $ composer init 15
  • 15. Autoloading { "autoload": { "psr-0": { "PHPSergipe" : "src/"} } } 01. 02. 03. 04. 05. 16
  • 16. Baixando dependências $ composer install $ php composer.phar install 01. 02. 17
  • 17. Usando as bibliotecas require "vendor/autoload.php"; $loader = require "vendor/autoload.php"; $loader->add('PHPSergipecodePhant', __DIR__); 01. 02. 03. 04. 18
  • 18. composer.lock Arquivo gerado depois que suas dependências são instaladas. É altamente recomendável sua distribuição. “ 19
  • 19. Packagist Packagist é o repositório principal do composer. Ele agrega todos os tipos de pacotes do PHP que são instaláveis com Composer. Aqui você pode procurar pacotes ou enviar o seu próprio. packagist.org “ 20
  • 20. Distribuindo sua biblioteca Sigam as PSRs 22
  • 21. Bibliotecas 23
  • 22. 24
  • 23. RespectValidation { "require": { "respect/validation": "dev-develop" } } 01. 02. 03. 04. 05. 25
  • 24. RespectValidation <?php use RespectValidationValidator as v; $number = 123; v::numeric()->validate($number); //true https://github.com/Respect/Validation 01. 02. 03. 04. 05. 26
  • 25. RespectValidation $user = new stdClass; $user->name = 'PHP Sergipe'; $user->birthdate = '1987-07-01'; $v = v::attribute('name', v::string()->length(1,32)) ->attribute('birthdate', v::date()->minimumAge(18)); $v->validate($user); //true 01. 02. 03. 04. 05. 06. 07. 08. 27
  • 26. RespectTemplate use RespectTemplateHtml; use RespectTemplateHtmlElement as H; require __DIR__.'/../tests/bootstrap.php'; $template = new Html('./cssZenGarden.html', '#lselect'); https://github.com/Respect/Template 01. 02. 03. 04. 05. 06. 28
  • 27. RespectTemplate $template['#pageHeader h1'] = 'codePhantPHPSergipe'; $template['#preamble .p1'] = H::div( H::p('Qual o nome do primeiro evento PHP em Sergipe H::dl( H::dt('codePhant?'), H::dd('Yeah!') ) )->class('p1'); 01. 02. 03. 04. 05. 06. 07. 08. 29
  • 28. RespectTemplate echo $template->render(); 01. 02. 03. 30
  • 29. filpwhoops { "require": { "filp/whoops": "1.*" } } 01. 02. 03. 04. 05. 32
  • 30. filpwhoops $app->register( new WhoopsProviderSilexWhoopsServiceProvider ); 01. 02. 03. 33
  • 31. filpwhoops if ($app['debug']) { $app->register( new WhoopsProviderSilexWhoopsServiceProvider ); } 01. 02. 03. 04. 05. 34
  • 32. MENTORING
  • 33. Augusto Pascutti 38
  • 34. // Thanks @malukenho malukenho@phpse.net www.jefersson.com.br 39

×