Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Symfony, the PHP framework for Open-Source, Sta...

Hugo Hamon
March 20, 2015

Symfony, the PHP framework for Open-Source, Start-Ups & Enterprise

This talk introduces the Symfony framework project and Open-Source ecosystem. It also showcases some Open-Source projects, start-ups and enterprises success stories.

Hugo Hamon

March 20, 2015
Tweet

More Decks by Hugo Hamon

Other Decks in Technology

Transcript

  1. Hugo HAMON Head of training at SensioLabs Book author Speaker

    at Conferences Symfony contributor @hhamon
  2. Symfony2 is a set of reusable, standalone, decoupled, and cohesive

    PHP components that solve common web development problems.
  3. Dependency Injection BrowserKit ClassLoader Config Console CssSelector Debug DomCrawler EventDispatcher

    ExpressionLanguage Filesystem Finder Form HttpFoundation HttpKernel Locale Intl Icu OptionsResolver Process PropertyAccess Routing Security Serializer Stopwatch Templating Translation Validator Yaml
  4. app/ is the application folder src/ is the libraries folder

    web/ is the general public folder contains the configuration, templates and generated files contains the PHP code of your application contains front controllers and web assets (images, Javascripts, stylesheets, ...) . ├─ app/ │ ├─ AppCache.php │ ├─ AppKernel.php │ ├─ cache/ │ ├─ config/ │ ├─ console │ ├─ logs/ │ ├─ autoload.php │ ├─ check.php │ ├─ phpunit.xml.dist │ └─ Resources/ │ └─ views/ │ └─ admin/ ├─ src/ │ └─ AppBundle/ ├─ vendor/ └─ web/ ├─ config.php ├─ app.php └─ app_dev.php vendor/ hosts third party code contains libraries and resources installed with Composer utility tool.
  5. A « Bundle » is a directory containing a set

    of files that implement a single feature and can be shared with the Community.
  6. src/AppBundle/ ├── AppBundle.php ├── Controller/ │ └── BlogController.php ├── DataFixtures/

    │ └── ORM/ │ └── LoadBlogPostData.php ├── Entity/ │ ├── BlogPost.php │ ├── Comment.php │ └── Repository/ │ └── BlogPostRepository.php └── Form/ └── BlogPostType.php
  7. # web/app.php use Symfony\Component\HttpFoundation\Request; $kernel = new AppKernel('prod', false); $kernel->loadClassCache();

    $request = Request::createFromGlobals(); $response = $kernel->handle($request); $response->send(); $kernel->terminate($request, $response);
  8. # web/app.php use Symfony\Component\HttpFoundation\Request; $kernel = new AppKernel('prod', false); $kernel->loadClassCache();

    $request = Request::createFromGlobals(); $response = $kernel->handle($request); $response->send(); $kernel->terminate($request, $response);
  9. Highly Configurable imports: - { resource: parameters.yml } - {

    resource: security.yml } - { resource: services.yml } framework: #esi: ~ #translator: { fallbacks: ["%locale%"] } secret: "%secret%" router: resource: "%kernel.root_dir%/config/routing.yml" strict_requirements: ~ form: ~ csrf_protection: ~ validation: { enable_annotations: true } # ...
  10. Symfony major versions are backward compatible to ensure smooth upgrades

    when new versions are published. http://symfony.com/bc