SlideShare a Scribd company logo
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/

More Related Content

PDF
Symfony 2.0 on PHP 5.3
PDF
Symfony2 - WebExpo 2010
PDF
Dependency Injection IPC 201
PDF
PhpBB meets Symfony2
PDF
Symfony2 - OSIDays 2010
PDF
Advanced symfony Techniques
PDF
The state of Symfony2 - SymfonyDay 2010
PDF
Doctrine MongoDB ODM (PDXPHP)
Symfony 2.0 on PHP 5.3
Symfony2 - WebExpo 2010
Dependency Injection IPC 201
PhpBB meets Symfony2
Symfony2 - OSIDays 2010
Advanced symfony Techniques
The state of Symfony2 - SymfonyDay 2010
Doctrine MongoDB ODM (PDXPHP)

What's hot (20)

PDF
Dependency injection - phpday 2010
PPTX
Speed up your developments with Symfony2
PDF
Unit and Functional Testing with Symfony2
PDF
Design Patterns avec PHP 5.3, Symfony et Pimple
PDF
The Zen of Lithium
PDF
Introducing Assetic (NYPHP)
PDF
The Origin of Lithium
PDF
Symfony components in the wild, PHPNW12
PDF
Symfony War Stories
PDF
PHP 5.3 and Lithium: the most rad php framework
PPTX
Electrify your code with PHP Generators
PPTX
Looping the Loop with SPL Iterators
PDF
Dependency injection in PHP 5.3/5.4
PDF
Dependency injection-zendcon-2010
PDF
Silex meets SOAP & REST
PDF
Building Lithium Apps
PDF
The History of PHPersistence
PDF
New in cakephp3
PDF
Nubilus Perl
PDF
Dependency Injection with PHP 5.3
Dependency injection - phpday 2010
Speed up your developments with Symfony2
Unit and Functional Testing with Symfony2
Design Patterns avec PHP 5.3, Symfony et Pimple
The Zen of Lithium
Introducing Assetic (NYPHP)
The Origin of Lithium
Symfony components in the wild, PHPNW12
Symfony War Stories
PHP 5.3 and Lithium: the most rad php framework
Electrify your code with PHP Generators
Looping the Loop with SPL Iterators
Dependency injection in PHP 5.3/5.4
Dependency injection-zendcon-2010
Silex meets SOAP & REST
Building Lithium Apps
The History of PHPersistence
New in cakephp3
Nubilus Perl
Dependency Injection with PHP 5.3
Ad

Viewers also liked (9)

PDF
Dependency Injection - ConFoo 2010
PDF
Caching on the Edge with Symfony2
PDF
PHP 5.3 in practice
PDF
Look beyond PHP
PDF
Symfony Components
PDF
You Shall Not Pass - Security in Symfony
PDF
Testing and symfony2
PDF
Design patterns revisited with PHP 5.3
PDF
Dependency Injection - ConFoo 2010
Caching on the Edge with Symfony2
PHP 5.3 in practice
Look beyond PHP
Symfony Components
You Shall Not Pass - Security in Symfony
Testing and symfony2
Design patterns revisited with PHP 5.3
Ad

Similar to News of the Symfony2 World (20)

PPTX
Filesystem abstractions and msg queue sergeev - symfony camp 2018
ODP
Symfony2, creare bundle e valore per il cliente
KEY
Phpne august-2012-symfony-components-friends
PDF
Symfony2 - WebExpo 2010
PDF
How Kris Writes Symfony Apps
PDF
Perforce Object and Record Model
PDF
Forget about Index.php and build you applications around HTTP - PHPers Cracow
PDF
Lithium: The Framework for People Who Hate Frameworks
KEY
Can't Miss Features of PHP 5.3 and 5.4
PDF
The state of your own hypertext preprocessor
DOC
PHP code examples
PDF
Legacy applications - 4Developes konferencja, Piotr Pasich
KEY
Designing Opeation Oriented Web Applications / YAPC::Asia Tokyo 2011
PDF
Symfony internals [english]
PDF
Meet Magento Sweden - Magento 2 Layout and Code Compilation for Performance
PDF
Forget about index.php and build you applications around HTTP!
PDF
Separation of concerns - DPC12
PDF
Doctrine For Beginners
PPTX
Ch3(working with file)
PDF
関西PHP勉強会 php5.4つまみぐい
Filesystem abstractions and msg queue sergeev - symfony camp 2018
Symfony2, creare bundle e valore per il cliente
Phpne august-2012-symfony-components-friends
Symfony2 - WebExpo 2010
How Kris Writes Symfony Apps
Perforce Object and Record Model
Forget about Index.php and build you applications around HTTP - PHPers Cracow
Lithium: The Framework for People Who Hate Frameworks
Can't Miss Features of PHP 5.3 and 5.4
The state of your own hypertext preprocessor
PHP code examples
Legacy applications - 4Developes konferencja, Piotr Pasich
Designing Opeation Oriented Web Applications / YAPC::Asia Tokyo 2011
Symfony internals [english]
Meet Magento Sweden - Magento 2 Layout and Code Compilation for Performance
Forget about index.php and build you applications around HTTP!
Separation of concerns - DPC12
Doctrine For Beginners
Ch3(working with file)
関西PHP勉強会 php5.4つまみぐい

More from Fabien Potencier (11)

PDF
Caching on the Edge
PDF
Dependency Injection
PDF
Symfony2 revealed
PDF
Dependency Injection with PHP and PHP 5.3
PDF
Symfony Components 2.0 on PHP 5.3
PDF
Playing With PHP 5.3
PDF
Symfony2 San Francisco Meetup 2009
PDF
Symfony And Zend Framework Together 2009
PDF
Twig, the flexible, fast, and secure template language for PHP
PDF
symfony: Un Framework Open-Source pour les Entreprises (Solutions Linux 2008)
PDF
The symfony platform: Create your very own framework (PHP Quebec 2008)
Caching on the Edge
Dependency Injection
Symfony2 revealed
Dependency Injection with PHP and PHP 5.3
Symfony Components 2.0 on PHP 5.3
Playing With PHP 5.3
Symfony2 San Francisco Meetup 2009
Symfony And Zend Framework Together 2009
Twig, the flexible, fast, and secure template language for PHP
symfony: Un Framework Open-Source pour les Entreprises (Solutions Linux 2008)
The symfony platform: Create your very own framework (PHP Quebec 2008)

Recently uploaded (20)

PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Univ-Connecticut-ChatGPT-Presentaion.pdf
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
Spectral efficient network and resource selection model in 5G networks
PPTX
OMC Textile Division Presentation 2021.pptx
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Getting Started with Data Integration: FME Form 101
PDF
August Patch Tuesday
PDF
Empathic Computing: Creating Shared Understanding
PPTX
A Presentation on Artificial Intelligence
PPTX
1. Introduction to Computer Programming.pptx
PPTX
Group 1 Presentation -Planning and Decision Making .pptx
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PPTX
Machine Learning_overview_presentation.pptx
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PPTX
TLE Review Electricity (Electricity).pptx
PPTX
TechTalks-8-2019-Service-Management-ITIL-Refresh-ITIL-4-Framework-Supports-Ou...
PPTX
Spectroscopy.pptx food analysis technology
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
gpt5_lecture_notes_comprehensive_20250812015547.pdf
Per capita expenditure prediction using model stacking based on satellite ima...
Univ-Connecticut-ChatGPT-Presentaion.pdf
Programs and apps: productivity, graphics, security and other tools
Spectral efficient network and resource selection model in 5G networks
OMC Textile Division Presentation 2021.pptx
Reach Out and Touch Someone: Haptics and Empathic Computing
Getting Started with Data Integration: FME Form 101
August Patch Tuesday
Empathic Computing: Creating Shared Understanding
A Presentation on Artificial Intelligence
1. Introduction to Computer Programming.pptx
Group 1 Presentation -Planning and Decision Making .pptx
Building Integrated photovoltaic BIPV_UPV.pdf
Machine Learning_overview_presentation.pptx
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
TLE Review Electricity (Electricity).pptx
TechTalks-8-2019-Service-Management-ITIL-Refresh-ITIL-4-Framework-Supports-Ou...
Spectroscopy.pptx food analysis technology
Mobile App Security Testing_ A Comprehensive Guide.pdf
gpt5_lecture_notes_comprehensive_20250812015547.pdf

News of the Symfony2 World