Your SlideShare is downloading. ×
0
News of the Symfony2 World
News of the Symfony2 World
News of the Symfony2 World
News of the Symfony2 World
News of the Symfony2 World
News of the Symfony2 World
News of the Symfony2 World
News of the Symfony2 World
News of the Symfony2 World
News of the Symfony2 World
News of the Symfony2 World
News of the Symfony2 World
News of the Symfony2 World
News of the Symfony2 World
News of the Symfony2 World
News of the Symfony2 World
News of the Symfony2 World
News of the Symfony2 World
News of the Symfony2 World
News of the Symfony2 World
News of the Symfony2 World
News of the Symfony2 World
News of the Symfony2 World
News of the Symfony2 World
News of the Symfony2 World
News of the Symfony2 World
News of the Symfony2 World
News of the Symfony2 World
News of the Symfony2 World
News of the Symfony2 World
News of the Symfony2 World
News of the Symfony2 World
News of the Symfony2 World
News of the Symfony2 World
News of the Symfony2 World
News of the Symfony2 World
News of the Symfony2 World
News of the Symfony2 World
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

News of the Symfony2 World

9,950

Published on

Published in: Technology
2 Comments
7 Likes
Statistics
Notes
No Downloads
Views
Total Views
9,950
On Slideshare
0
From Embeds
0
Number of Embeds
10
Actions
Shares
0
Downloads
165
Comments
2
Likes
7
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. News of the Symfony2 world Fabien Potencier
  • 2. The Symfony2 Philosophy
  • 3. Be as easy as possible for newcomers and as flexible as possible for advanced users
  • 4. SymfonyComponents SymfonyFramework
  • 5. CssSelector
  • 6. use SymfonyComponentsCssSelectorParser; Parser::cssToXpath('h4 > a:contains("foo")');
  • 7. use SymfonyComponentsCssSelectorParser; $document = new DOMDocument(); $document->loadHTMLFile('...'); $xpath = new DOMXPath($document); $expr = Parser::cssToXpath('a.smart'); $nodes = $xpath->query($expr); foreach ($nodes as $node) { printf("%s (%s)n", $node->nodeValue, $node- >getAttribute('href')); }
  • 8. DomCrawler
  • 9. use SymfonyComponentsDomCrawlerCrawler; $crawler = new Crawler($html);
  • 10. addContent() addHtmlContent() addXmlContent() addDocument() addNodeList() addNodes() addNode() add()
  • 11. filter() filterXpath() eq() reduce() first() / last() siblings() nextAll() / previousAll() parents() / children()
  • 12. $link = $crawler->filter("h1 > h2"); $link = $crawler->filter("h1")->eq(1);
  • 13. isEmpty() each() attr() text() extract()
  • 14. $crawler ->filter('a.smart') ->each(function ($node) { print $node->getAttribute('href')."n"; });
  • 15. $crawler ->filter('a') ->extract(array('_text', 'href')) ;
  • 16. selectLink() / selectButton()
  • 17. $crawler->selectLink("Greet Lucas");
  • 18. $crawler->selectButton('submit');
  • 19. $crawler->filter('a:contains("Greet")')->eq(1);
  • 20. $link = $crawler ->selectLink("Greet Lucas") ->link();
  • 21. $form = $crawler->filter( 'button:contains("submit")')->form();
  • 22. // fill an input field $form['name'] = 'Lucas'; // select an option or a radio $form['country']->select('France'); // tick a checkbox $form['like_symfony']->tick(); // upload a file $form['photo']->upload('/path/to/lucas.jpg');
  • 23. $form->getValues() / $form->getFiles() array('article[title]' => 'Title', ...) $form->getPhpValues() / $form->getPhpFiles() array('article' => array('title' => 'Title', ...))
  • 24. Browser
  • 25. http://www.github.com/fabpot/Goutte
  • 26. Finder
  • 27. use SymfonyComponentsFinderFinder; $finder = new Finder(); $finder ->files() ->in(__DIR__) ->...() ->sortByName() ;
  • 28. $finder ->name('*.php') ->depth('<= 1') ->date('>= yesterday') ->size('<= 1K') ->filter(function (SplFileInfo $file) { return strlen($file->getBasename()) < 9; }) ;
  • 29. foreach ($finder as $file) { print $file->getRealpath()."n"; } $files = iterator_to_array($finder); $count = iterator_count($finder);
  • 30. use SymfonyComponentsFinderFinder; $s3 = new Zend_Service_Amazon_S3($key, $sct); $s3->registerStreamWrapper("s3"); $finder = new Finder(); $finder ->name('photos*') ->size('< 100K') ->date('since 1 hour ago') ->in('s3://bucket-name') ;
  • 31. HttpKernel: The framework construction kit
  • 32. namespace SymfonyComponentsHttpKernel; interface HttpKernelInterface { const MASTER_REQUEST = 1; const FORWARDED_REQUEST = 2; const EMBEDDED_REQUEST = 3; public function handle( Request $request = null, $type = self::MASTER_REQUEST, $raw = false); public function getRequest(); }
  • 33. Testing
  • 34. Profiling
  • 35. and …
  • 36. What’s next?
  • 37. Questions?
  • 38. Sensio S.A. 92-98, boulevard Victor Hugo 92 115 Clichy Cedex FRANCE Tél. : +33 1 40 99 80 80 Contact Fabien Potencier fabien.potencier at sensio.com http://www.sensiolabs.com/ http://www.symfony-project.org/ http://fabien.potencier.org/

×