Symfony 2 : Performances et Optimisations

Les-Tilleuls.coop
Les-Tilleuls.coopCEO at Les-Tilleuls.coop, freelance software architect
Symfony2:
Sérialisation
SfPot 12/06

Samuel ROZE
Serializer
Abstraction du format de sortie et
d’entrée
Composant Serializer
Sérialisation et désérialisation
Fonctionnalités limitées
JMS Serializer
JMSSerializerBundle
(Dé)sérialisation
JSON
XML
YAML
JMS Serializer
Les groupes de sérialisation
Comment
retourner des
attributs
différents en
fonction du
context ?
JMS Serializer
Les groupes de sérialisation
Sérialisation
d’un User
Intérêt de
Media:user ?
Sérialisation
d’un Media
Intérêt de
User:medias ?
JMS Serializer
Les groupes de sérialisation
1. Configuration des groupes
via annotations
2. Sérialisation avec un des
groupes définis
3. Sérialisation voulue
JMS Serializer
Le versioning
Faire co-habiter
différentes
versions d’une
même entité ?
JMS Serializer
Le versioning
Configuration “simple” Configuration avec le “accessType”
JMS Serializer
Le versioning
NB: Utilise “version_compare”
Sérialisation avec context de version
JMS Serializer
Custom handlers
Comment sérialiser
“à la main” un type
“privé” ?
JMS Serializer
Custom handlers
FileEntry gère le stockage de nos
fichiers, sur différents providers
(local, ftp, cdn, …)
JMS Serializer
Custom handlers
Ajout de l’handler via services
de Symfony
JMS Serializer
Custom handlers
Un objet FileEntry devient une chaine de caractères à la sérialisation
JMS Serializer
(De)serialize events
Accès aux données
Avant désérialisation

pre_serialize
Après désérialisation

post_serialize
Avant sérialisation

pre_deserialize
Après sérialisation

post_deserialize
JMS Serializer
(De)serialize events
Problématique: retourner une
thumbnail optimisée pour le
client
Avoir accès à la requête client
Avoir notre thumbnailManager
Pouvoir modifier l’entité avant
la sérialization
JMS Serializer
(De)serialize events
Création du subscriber JMS, grâce au
tag jms_serializer.event_subscriber
Ajout du subscriber via le builder
JMS Serializer
(De)serialize events
Si le paramètre
deviceWidth est
dans la requête,
on récupère le
thumbnail le
plus optimisé
pour le client,
qui sera
sérialisé
JMS Serializer
(De)serialize events
De nombreuses applications possibles :
Transformation de données sensibles
Cartes bleues
Adresses email
Modifications diverses
Génération d’URLs
….
JMS Serializer
Intégration avec FOSRestBundle
Groupes de sérialisation Versioning
Configuration générale
fos_rest.serializer.version
Format version listener
fos_rest.format_listener.media_
type.version_regex
‘/(v|version)=(?
P<version>[0-9.]+)/'
Merci à tous !
1 of 20

Recommended

03 presentation-builder-normal by
03 presentation-builder-normal03 presentation-builder-normal
03 presentation-builder-normalMichael Bertocchi
155 views21 slides
Javlo2 by
Javlo2Javlo2
Javlo2Patrick Vandermaesen
304 views9 slides
CQRS and Event Sourcing in a Symfony application by
CQRS and Event Sourcing in a Symfony applicationCQRS and Event Sourcing in a Symfony application
CQRS and Event Sourcing in a Symfony applicationSamuel ROZE
12.7K views59 slides
Behat c'est plus que ça | Behat is more than that by
Behat c'est plus que ça | Behat is more than thatBehat c'est plus que ça | Behat is more than that
Behat c'est plus que ça | Behat is more than thatSamuel ROZE
4.7K views47 slides
Introduction to CQRS and Event Sourcing by
Introduction to CQRS and Event SourcingIntroduction to CQRS and Event Sourcing
Introduction to CQRS and Event SourcingSamuel ROZE
1.8K views74 slides
When cqrs meets event sourcing by
When cqrs meets event sourcingWhen cqrs meets event sourcing
When cqrs meets event sourcingManel Sellés
4.3K views45 slides

More Related Content

Viewers also liked

Symfony et serialization avec JMS serializer by
Symfony et serialization avec JMS serializer Symfony et serialization avec JMS serializer
Symfony et serialization avec JMS serializer Samuel ROZE
3.3K views20 slides
Paris Job Talk by
Paris Job TalkParis Job Talk
Paris Job TalkmeeticTech
504 views12 slides
Meetup scala paris user group - conflation like @ meetic by
Meetup scala paris user group - conflation like @ meeticMeetup scala paris user group - conflation like @ meetic
Meetup scala paris user group - conflation like @ meeticmeeticTech
1.1K views30 slides
Decoupling the Ulabox.com monolith. From CRUD to DDD by
Decoupling the Ulabox.com monolith. From CRUD to DDDDecoupling the Ulabox.com monolith. From CRUD to DDD
Decoupling the Ulabox.com monolith. From CRUD to DDDAleix Vergés
1.8K views83 slides
Event sourcing w PHP (by Piotr Kacała) by
Event sourcing w PHP (by Piotr Kacała)Event sourcing w PHP (by Piotr Kacała)
Event sourcing w PHP (by Piotr Kacała)GOG.com dev team
5K views41 slides
Meetic Backend Mutation With Symfony by
Meetic Backend Mutation With SymfonyMeetic Backend Mutation With Symfony
Meetic Backend Mutation With SymfonymeeticTech
15.1K views60 slides

Viewers also liked(20)

Symfony et serialization avec JMS serializer by Samuel ROZE
Symfony et serialization avec JMS serializer Symfony et serialization avec JMS serializer
Symfony et serialization avec JMS serializer
Samuel ROZE3.3K views
Paris Job Talk by meeticTech
Paris Job TalkParis Job Talk
Paris Job Talk
meeticTech504 views
Meetup scala paris user group - conflation like @ meetic by meeticTech
Meetup scala paris user group - conflation like @ meeticMeetup scala paris user group - conflation like @ meetic
Meetup scala paris user group - conflation like @ meetic
meeticTech1.1K views
Decoupling the Ulabox.com monolith. From CRUD to DDD by Aleix Vergés
Decoupling the Ulabox.com monolith. From CRUD to DDDDecoupling the Ulabox.com monolith. From CRUD to DDD
Decoupling the Ulabox.com monolith. From CRUD to DDD
Aleix Vergés1.8K views
Event sourcing w PHP (by Piotr Kacała) by GOG.com dev team
Event sourcing w PHP (by Piotr Kacała)Event sourcing w PHP (by Piotr Kacała)
Event sourcing w PHP (by Piotr Kacała)
GOG.com dev team5K views
Meetic Backend Mutation With Symfony by meeticTech
Meetic Backend Mutation With SymfonyMeetic Backend Mutation With Symfony
Meetic Backend Mutation With Symfony
meeticTech15.1K views
Very lastroom symfony1 vers symfony2 en douceur by Sébastien Houzé
Very lastroom   symfony1 vers symfony2 en douceurVery lastroom   symfony1 vers symfony2 en douceur
Very lastroom symfony1 vers symfony2 en douceur
Sébastien Houzé2.5K views
Presentation Symfony2 by Ahmed ABATAL
Presentation Symfony2Presentation Symfony2
Presentation Symfony2
Ahmed ABATAL2.1K views
symfony : Un Framework Open-Source pour les Professionnels by Fabien Potencier
symfony : Un Framework Open-Source pour les Professionnelssymfony : Un Framework Open-Source pour les Professionnels
symfony : Un Framework Open-Source pour les Professionnels
Fabien Potencier2K views
Drupal 8 + Symfony 2 = une équipe gagnante by Vanessa David
Drupal 8 + Symfony 2 = une équipe gagnanteDrupal 8 + Symfony 2 = une équipe gagnante
Drupal 8 + Symfony 2 = une équipe gagnante
Vanessa David1.9K views
Symfony2: 30 astuces et bonnes pratiques by Noel GUILBERT
Symfony2: 30 astuces et bonnes pratiquesSymfony2: 30 astuces et bonnes pratiques
Symfony2: 30 astuces et bonnes pratiques
Noel GUILBERT55.8K views
Presentation du framework symfony by Jeremy Gachet
Presentation du framework symfonyPresentation du framework symfony
Presentation du framework symfony
Jeremy Gachet11.9K views
Introduction à Symfony2 by Hugo Hamon
Introduction à Symfony2Introduction à Symfony2
Introduction à Symfony2
Hugo Hamon15.2K views
Rationally boost your symfony2 application with caching tips and monitoring by Giulio De Donato
Rationally boost your symfony2 application with caching tips and monitoringRationally boost your symfony2 application with caching tips and monitoring
Rationally boost your symfony2 application with caching tips and monitoring
Giulio De Donato70.6K views
Alphorm.com Support de la Formation Symfony 3 , les fondamentaux-ss by Alphorm
Alphorm.com Support de la Formation Symfony 3 , les fondamentaux-ssAlphorm.com Support de la Formation Symfony 3 , les fondamentaux-ss
Alphorm.com Support de la Formation Symfony 3 , les fondamentaux-ss
Alphorm36.9K views
Symfony 2 : chapitre 2 - Les vues en Twig by Abdelkader Rhouati
Symfony 2 : chapitre 2 - Les vues en TwigSymfony 2 : chapitre 2 - Les vues en Twig
Symfony 2 : chapitre 2 - Les vues en Twig
Abdelkader Rhouati4.1K views
Symfony 2 : chapitre 4 - Les services et les formulaires by Abdelkader Rhouati
Symfony 2 : chapitre 4 - Les services et les formulairesSymfony 2 : chapitre 4 - Les services et les formulaires
Symfony 2 : chapitre 4 - Les services et les formulaires
Abdelkader Rhouati3.5K views
Symfony 2 : chapitre 3 - Les modèles en Doctrine 2 by Abdelkader Rhouati
Symfony 2 : chapitre 3 - Les modèles en Doctrine 2Symfony 2 : chapitre 3 - Les modèles en Doctrine 2
Symfony 2 : chapitre 3 - Les modèles en Doctrine 2
Abdelkader Rhouati3.6K views
Symfony 2 : chapitre 1 - Présentation Générale by Abdelkader Rhouati
Symfony 2 : chapitre 1 - Présentation GénéraleSymfony 2 : chapitre 1 - Présentation Générale
Symfony 2 : chapitre 1 - Présentation Générale
Abdelkader Rhouati6.5K views

More from Les-Tilleuls.coop

Symfony on steroids
: Vue.js, Mercure, Panther by
Symfony on steroids
: Vue.js, Mercure, PantherSymfony on steroids
: Vue.js, Mercure, Panther
Symfony on steroids
: Vue.js, Mercure, PantherLes-Tilleuls.coop
46K views56 slides
Official "push" and real-time capabilities for Symfony and API Platform (Merc... by
Official "push" and real-time capabilities for Symfony and API Platform (Merc...Official "push" and real-time capabilities for Symfony and API Platform (Merc...
Official "push" and real-time capabilities for Symfony and API Platform (Merc...Les-Tilleuls.coop
53.9K views62 slides
Progressively enhance your Symfony 4 app using Vue, API Platform, Mercure and... by
Progressively enhance your Symfony 4 app using Vue, API Platform, Mercure and...Progressively enhance your Symfony 4 app using Vue, API Platform, Mercure and...
Progressively enhance your Symfony 4 app using Vue, API Platform, Mercure and...Les-Tilleuls.coop
43.5K views55 slides
HTTP/2: speed up your apps and dispatch real time updates (Symfony and API Pl... by
HTTP/2: speed up your apps and dispatch real time updates (Symfony and API Pl...HTTP/2: speed up your apps and dispatch real time updates (Symfony and API Pl...
HTTP/2: speed up your apps and dispatch real time updates (Symfony and API Pl...Les-Tilleuls.coop
35.7K views59 slides
Panther: test your Symfony apps with real web browsers by
Panther: test your Symfony apps with real web browsersPanther: test your Symfony apps with real web browsers
Panther: test your Symfony apps with real web browsersLes-Tilleuls.coop
28.1K views57 slides
API Platform: A Framework for API-driven Projects by
API Platform: A Framework for API-driven ProjectsAPI Platform: A Framework for API-driven Projects
API Platform: A Framework for API-driven ProjectsLes-Tilleuls.coop
23.8K views72 slides

More from Les-Tilleuls.coop(15)

Symfony on steroids
: Vue.js, Mercure, Panther by Les-Tilleuls.coop
Symfony on steroids
: Vue.js, Mercure, PantherSymfony on steroids
: Vue.js, Mercure, Panther
Symfony on steroids
: Vue.js, Mercure, Panther
Les-Tilleuls.coop46K views
Official "push" and real-time capabilities for Symfony and API Platform (Merc... by Les-Tilleuls.coop
Official "push" and real-time capabilities for Symfony and API Platform (Merc...Official "push" and real-time capabilities for Symfony and API Platform (Merc...
Official "push" and real-time capabilities for Symfony and API Platform (Merc...
Les-Tilleuls.coop53.9K views
Progressively enhance your Symfony 4 app using Vue, API Platform, Mercure and... by Les-Tilleuls.coop
Progressively enhance your Symfony 4 app using Vue, API Platform, Mercure and...Progressively enhance your Symfony 4 app using Vue, API Platform, Mercure and...
Progressively enhance your Symfony 4 app using Vue, API Platform, Mercure and...
Les-Tilleuls.coop43.5K views
HTTP/2: speed up your apps and dispatch real time updates (Symfony and API Pl... by Les-Tilleuls.coop
HTTP/2: speed up your apps and dispatch real time updates (Symfony and API Pl...HTTP/2: speed up your apps and dispatch real time updates (Symfony and API Pl...
HTTP/2: speed up your apps and dispatch real time updates (Symfony and API Pl...
Les-Tilleuls.coop35.7K views
Panther: test your Symfony apps with real web browsers by Les-Tilleuls.coop
Panther: test your Symfony apps with real web browsersPanther: test your Symfony apps with real web browsers
Panther: test your Symfony apps with real web browsers
Les-Tilleuls.coop28.1K views
API Platform: A Framework for API-driven Projects by Les-Tilleuls.coop
API Platform: A Framework for API-driven ProjectsAPI Platform: A Framework for API-driven Projects
API Platform: A Framework for API-driven Projects
Les-Tilleuls.coop23.8K views
API Platform and Symfony: a Framework for API-driven Projects by Les-Tilleuls.coop
API Platform and Symfony: a Framework for API-driven ProjectsAPI Platform and Symfony: a Framework for API-driven Projects
API Platform and Symfony: a Framework for API-driven Projects
Les-Tilleuls.coop20.6K views
API Platform: Full Stack Framework Resurrection by Les-Tilleuls.coop
API Platform: Full Stack Framework ResurrectionAPI Platform: Full Stack Framework Resurrection
API Platform: Full Stack Framework Resurrection
Les-Tilleuls.coop13K views
API Platform 2.1: when Symfony meets ReactJS (Symfony Live 2017) by Les-Tilleuls.coop
API Platform 2.1: when Symfony meets ReactJS (Symfony Live 2017)API Platform 2.1: when Symfony meets ReactJS (Symfony Live 2017)
API Platform 2.1: when Symfony meets ReactJS (Symfony Live 2017)
Les-Tilleuls.coop23.2K views
Creating hypermedia APIs in a few minutes using the API Platform framework by Les-Tilleuls.coop
Creating hypermedia APIs in a few minutes using the API Platform frameworkCreating hypermedia APIs in a few minutes using the API Platform framework
Creating hypermedia APIs in a few minutes using the API Platform framework
Les-Tilleuls.coop12.3K views
Diaporama du sfPot Lillois du 20 mars 2014 by Les-Tilleuls.coop
Diaporama du sfPot Lillois du 20 mars 2014Diaporama du sfPot Lillois du 20 mars 2014
Diaporama du sfPot Lillois du 20 mars 2014
Les-Tilleuls.coop4.4K views
Workshop HTML5 : référencement grâce à la sémantique by Les-Tilleuls.coop
Workshop HTML5 : référencement grâce à la sémantiqueWorkshop HTML5 : référencement grâce à la sémantique
Workshop HTML5 : référencement grâce à la sémantique
Les-Tilleuls.coop2.1K views

Symfony 2 : Performances et Optimisations