+ All Categories
Home > Documents > Symfony - Philipp Rieber · Symfony from a Bird’s Eye View by Philipp Rieber @bicpi Joint...

Symfony - Philipp Rieber · Symfony from a Bird’s Eye View by Philipp Rieber @bicpi Joint...

Date post: 26-Mar-2020
Category:
Upload: others
View: 20 times
Download: 0 times
Share this document with a friend
23
Symfony from a Bird’s Eye View by Philipp Rieber @bicpi Joint Drupal-Symfony User Group Munich, Feb 17th 2016
Transcript
Page 1: Symfony - Philipp Rieber · Symfony from a Bird’s Eye View by Philipp Rieber @bicpi Joint Drupal-Symfony User Group Munich, Feb 17th 2016 • My name is Philipp Rieber

Symfony

from a Bird’s Eye View by Philipp Rieber

@bicpi

Joint Drupal-Symfony User Group Munich, Feb 17th 2016

Page 2: Symfony - Philipp Rieber · Symfony from a Bird’s Eye View by Philipp Rieber @bicpi Joint Drupal-Symfony User Group Munich, Feb 17th 2016 • My name is Philipp Rieber

• My name is Philipp Rieber

• I am a PHP developer

• I work at

• I tweet @bicpi

• I have a homepage at http://philipp-rieber.net

ABOUT://ME

Page 3: Symfony - Philipp Rieber · Symfony from a Bird’s Eye View by Philipp Rieber @bicpi Joint Drupal-Symfony User Group Munich, Feb 17th 2016 • My name is Philipp Rieber

WHAT IS SYMFONY?

“First, Symfony2 is a reusable set of standalone, decoupled, and cohesive PHP components that solve common web development problems.”

[Fabien Potencier]

Page 4: Symfony - Philipp Rieber · Symfony from a Bird’s Eye View by Philipp Rieber @bicpi Joint Drupal-Symfony User Group Munich, Feb 17th 2016 • My name is Philipp Rieber

BrowserKit

ClassLoader

Config

Asset

Console

CssSelectorDebug

DependencyInjection

DomCrawler

EventDispatcher

ExpressionLanguage

Filesystem

Finder

Form

Guard

HttpFoundation

HttpKernel

Icu

Intl

Ldap

Locale

OptionsResolver

Process

PropertyAccessPropertyInfo

Routing

Security

Serializer

Stopwatch

Templating

Translation

Validator

VarDumper

Yaml

Page 5: Symfony - Philipp Rieber · Symfony from a Bird’s Eye View by Philipp Rieber @bicpi Joint Drupal-Symfony User Group Munich, Feb 17th 2016 • My name is Philipp Rieber

BrowserKit

ClassLoader

Config

Asset

Console

CssSelectorDebug

DependencyInjection

DomCrawler

EventDispatcher

ExpressionLanguage

Filesystem

Finder

Form

Guard

HttpFoundation

HttpKernel

Icu

Intl

Ldap

Locale

OptionsResolver

Process

PropertyAccessPropertyInfo

Routing

Security

Serializer

Stopwatch

Templating

Translation

Validator

VarDumper

Yaml

Page 6: Symfony - Philipp Rieber · Symfony from a Bird’s Eye View by Philipp Rieber @bicpi Joint Drupal-Symfony User Group Munich, Feb 17th 2016 • My name is Philipp Rieber

require 'vendor/autoload.php';

use Symfony\Component\Yaml\Yaml;

$yaml = <<<YAMLparameters: user: symfony pass: awesomeYAML;

$config = Yaml::parse($yaml);// ['parameters' => ['user' => 'symfony', 'pass' => 'awesome']]

$ composer require symfony/yaml

Yaml Component

Page 7: Symfony - Philipp Rieber · Symfony from a Bird’s Eye View by Philipp Rieber @bicpi Joint Drupal-Symfony User Group Munich, Feb 17th 2016 • My name is Philipp Rieber

BrowserKit

ClassLoader

Config

Asset

Console

CssSelectorDebug

DependencyInjection

DomCrawler

EventDispatcher

ExpressionLanguage

Filesystem

Finder

Form

Guard

HttpFoundation

HttpKernel

Icu

Intl

Ldap

Locale

OptionsResolver

Process

PropertyAccessPropertyInfo

Routing

Security

Serializer

Stopwatch

Templating

Translation

Validator

VarDumper

Yaml

Page 8: Symfony - Philipp Rieber · Symfony from a Bird’s Eye View by Philipp Rieber @bicpi Joint Drupal-Symfony User Group Munich, Feb 17th 2016 • My name is Philipp Rieber

$ composer require symfony/finder

Finder Component

require 'vendor/autoload.php';

use Symfony\Component\Finder\Finder;

$finder = new Finder();

$finder ->in('/Users/bicpi/photos') ->files() ->name('*.jpg') ->size('>= 1M');

foreach ($finder as $file) { echo $file->getFilename() . "\n";}

Page 9: Symfony - Philipp Rieber · Symfony from a Bird’s Eye View by Philipp Rieber @bicpi Joint Drupal-Symfony User Group Munich, Feb 17th 2016 • My name is Philipp Rieber

Separation of Concerns

“Do one thing. Make it excellent.

Stay out of the way.”

• … • Console Command Line Interfaces • Filesystem Basic utilities for the filesystem • Translation Tools for internationalisation • …

[Unix Philosophy]

Page 10: Symfony - Philipp Rieber · Symfony from a Bird’s Eye View by Philipp Rieber @bicpi Joint Drupal-Symfony User Group Munich, Feb 17th 2016 • My name is Philipp Rieber

WHAT ELSE IS SYMFONY?

“Then, based on these components, Symfony2 is also a full-stack web framework.”

[Fabien Potencier]

Page 11: Symfony - Philipp Rieber · Symfony from a Bird’s Eye View by Philipp Rieber @bicpi Joint Drupal-Symfony User Group Munich, Feb 17th 2016 • My name is Philipp Rieber

BrowserKit

ClassLoader

Config

Asset

Console

CssSelector

Debug

DependencyInjection

DomCrawler

EventDispatcher

ExpressionLanguage

Filesystem

Finder

Form

Guard

HttpFoundation

HttpKernel

Icu

IntlLdap

Locale

OptionsResolver

Process

PropertyAccessPropertyInfo

Routing

Security

Serializer

Stopwatch

Templating

Translation

Validator

VarDumperYaml

Your Application

Page 12: Symfony - Philipp Rieber · Symfony from a Bird’s Eye View by Philipp Rieber @bicpi Joint Drupal-Symfony User Group Munich, Feb 17th 2016 • My name is Philipp Rieber

Request Response

It is all about transforming a Request into a Response

Symfony full-stack

Page 13: Symfony - Philipp Rieber · Symfony from a Bird’s Eye View by Philipp Rieber @bicpi Joint Drupal-Symfony User Group Munich, Feb 17th 2016 • My name is Philipp Rieber

HttpFoundation\Request HTTP Header, $_GET, $_POST, $_COOKIE, $_SESSION, $_SERVER

HttpFoundation\Response HTTP Status Code, HTTP Header, Content (HTML, JSON …)

HttpKernelWeb framework core, “Glues” the components,

Loads configuration and “Bundles”, Controls flow

Page 14: Symfony - Philipp Rieber · Symfony from a Bird’s Eye View by Philipp Rieber @bicpi Joint Drupal-Symfony User Group Munich, Feb 17th 2016 • My name is Philipp Rieber

Request

Response

/blog/article?id=34

class BlogController extends Controller{ /** * @Route("/blog/article") */ public function articleAction(Request $request) { $id = $request->query->get('id'); $article = $database->findArticle($id); if (!$article) { return new Response('Article not found.', 404); }

$html = $view->renderArticle($article);

return new Response($html, 200); }}

Page 15: Symfony - Philipp Rieber · Symfony from a Bird’s Eye View by Philipp Rieber @bicpi Joint Drupal-Symfony User Group Munich, Feb 17th 2016 • My name is Philipp Rieber

• Routing Match URL to controller action

• Templating Render templates

• Security Decide about access

• Config Load configuration

• Forms Create HTML forms

• DependencyInjection Decouple your services

• …

During the Request ➾ Response flow, many more components will assist

Page 16: Symfony - Philipp Rieber · Symfony from a Bird’s Eye View by Philipp Rieber @bicpi Joint Drupal-Symfony User Group Munich, Feb 17th 2016 • My name is Philipp Rieber

BUNDLES• ~ PlugIns, but even better

• Everything in Symfony Full-Stack is a Bundle

• Yes, Symfony Full-Stack itself is a Bundle

• Core and custom code is in Bundles

• Registered in HttpKernel

Page 17: Symfony - Philipp Rieber · Symfony from a Bird’s Eye View by Philipp Rieber @bicpi Joint Drupal-Symfony User Group Munich, Feb 17th 2016 • My name is Philipp Rieber

• PSR – PHP Standards Recommendations

• HTTP Specification

SYMFONY ♥ STANDARDS

Page 18: Symfony - Philipp Rieber · Symfony from a Bird’s Eye View by Philipp Rieber @bicpi Joint Drupal-Symfony User Group Munich, Feb 17th 2016 • My name is Philipp Rieber

• Git & GitHub • Semantic Versioning – Breaking.Feature.Fix • Dependency Injection • Event Driven • Popularize ORMs • New level of code quality and architecture • Command Line Tools

INNOVATIONS

… just to name a few

(in the PHP world, at least …)

Page 19: Symfony - Philipp Rieber · Symfony from a Bird’s Eye View by Philipp Rieber @bicpi Joint Drupal-Symfony User Group Munich, Feb 17th 2016 • My name is Philipp Rieber

• Twig

• Composer

• Monolog

• Swiftmailer

• Silex

• PHP CS Fixer…

SYMFONY “BY-PRODUCTS”

Page 20: Symfony - Philipp Rieber · Symfony from a Bird’s Eye View by Philipp Rieber @bicpi Joint Drupal-Symfony User Group Munich, Feb 17th 2016 • My name is Philipp Rieber

• Outstanding Documentation

• Huge ecosystem of 3rd-party bundles

• Creates many “celebrities”

• Conferences

• Certification

SYMFONY’S COMMUNITY(and SensioLabs)

Page 21: Symfony - Philipp Rieber · Symfony from a Bird’s Eye View by Philipp Rieber @bicpi Joint Drupal-Symfony User Group Munich, Feb 17th 2016 • My name is Philipp Rieber

Evolution, not Revolution

SYMFONY 3

Page 22: Symfony - Philipp Rieber · Symfony from a Bird’s Eye View by Philipp Rieber @bicpi Joint Drupal-Symfony User Group Munich, Feb 17th 2016 • My name is Philipp Rieber

?@bicpi – http://philipp-rieber.net

Page 23: Symfony - Philipp Rieber · Symfony from a Bird’s Eye View by Philipp Rieber @bicpi Joint Drupal-Symfony User Group Munich, Feb 17th 2016 • My name is Philipp Rieber

• http://symfony.com/ • https://github.com/symfony • http://fabien.potencier.org/what-is-symfony2.html • http://symfony.com/doc/current/create_framework


Recommended