News of the Symfony2 World
Upcoming SlideShare
Loading in...5
×
 

News of the Symfony2 World

on

  • 11,187 views

 

Statistics

Views

Total Views
11,187
Views on SlideShare
8,343
Embed Views
2,844

Actions

Likes
7
Downloads
164
Comments
2

31 Embeds 2,844

http://www.symfony-project.org 813
http://www.symfony.es 629
http://romain.cambien.net 496
http://symfony.com 340
http://www.symfony.gr.jp 144
http://swik.net 119
http://www.symfonylab.com 103
http://coderwall.com 65
http://charles-guillemot.info 33
http://rcambien.tumblr.com 16
http://static.slidesharecdn.com 11
http://www.prestataire-symfony.com 11
http://www.pearltrees.com 10
http://www.phpframeworks.com 9
http://translate.googleusercontent.com 7
http://rimzy.net 6
http://symfony.lab216.com 6
http://webcache.googleusercontent.com 5
http://jerem.blogduwebdesign.com 5
http://www.slideshare.net 3
http://feeds.feedburner.com 3
https://si0.twimg.com 1
http://www.zipfelmaus.com 1
resource://brief-content 1
http://www.sfexception.com 1
http://www.symfony-project.com 1
http://127.0.0.1:8795 1
http://www.onlydoo.com 1
http://twiki.bestofmedia.com 1
http://www.iweb34.com 1
https://klti.de 1
More...

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
  • The components website hasn't been updated with the latest components mentioned in these presentations
    Are you sure you want to
    Your message goes here
    Processing…
  • The Dom crawler will be surely loved by all the jQuery users ;)
    As always, great and innovative work Fabien!
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

News of the Symfony2 World News of the Symfony2 World Presentation Transcript

  • News of the Symfony2 world Fabien Potencier
  • The Symfony2 Philosophy
  • Be as easy as possible for newcomers and as flexible as possible for advanced users
  • SymfonyComponents SymfonyFramework
  • CssSelector
  • use SymfonyComponentsCssSelectorParser; Parser::cssToXpath('h4 > a:contains("foo")');
  • 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')); }
  • DomCrawler
  • use SymfonyComponentsDomCrawlerCrawler; $crawler = new Crawler($html);
  • addContent() addHtmlContent() addXmlContent() addDocument() addNodeList() addNodes() addNode() add()
  • filter() filterXpath() eq() reduce() first() / last() siblings() nextAll() / previousAll() parents() / children()
  • $link = $crawler->filter("h1 > h2"); $link = $crawler->filter("h1")->eq(1);
  • isEmpty() each() attr() text() extract()
  • $crawler ->filter('a.smart') ->each(function ($node) { print $node->getAttribute('href')."n"; });
  • $crawler ->filter('a') ->extract(array('_text', 'href')) ;
  • selectLink() / selectButton()
  • $crawler->selectLink("Greet Lucas");
  • $crawler->selectButton('submit');
  • $crawler->filter('a:contains("Greet")')->eq(1);
  • $link = $crawler ->selectLink("Greet Lucas") ->link();
  • $form = $crawler->filter( 'button:contains("submit")')->form();
  • // 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');
  • $form->getValues() / $form->getFiles() array('article[title]' => 'Title', ...) $form->getPhpValues() / $form->getPhpFiles() array('article' => array('title' => 'Title', ...))
  • Browser
  • http://www.github.com/fabpot/Goutte
  • Finder
  • use SymfonyComponentsFinderFinder; $finder = new Finder(); $finder ->files() ->in(__DIR__) ->...() ->sortByName() ;
  • $finder ->name('*.php') ->depth('<= 1') ->date('>= yesterday') ->size('<= 1K') ->filter(function (SplFileInfo $file) { return strlen($file->getBasename()) < 9; }) ;
  • foreach ($finder as $file) { print $file->getRealpath()."n"; } $files = iterator_to_array($finder); $count = iterator_count($finder);
  • 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') ;
  • HttpKernel: The framework construction kit
  • 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(); }
  • Testing
  • Profiling
  • and …
  • What’s next?
  • Questions?
  • 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/