SlideShare ist ein Scribd-Unternehmen logo
1 von 42
Downloaden Sie, um offline zu lesen
Symfony 2
Die Perle in einem SOA-Ozean
Wer sind wir?

Wer sind wir
Kifah Abbad & Marco Reinwarth
Wo arbeiten wir
devbliss GmbH
Agenda
Die Motivation Symfony 2 einzusetzen
und der Weg dorthin

Symfony Besonderheiten
& “Best Practices”
Motivation
Motivation Symfony 2 einzusetzen
“die Geschichte wie Symfony2 immer mehr
Gewicht bei devbliss bekommen hat”

“Wie kann ich mein bestehendes
Projekt mit Symfony2 aufwerten”
Der Monolith
neue Ideen
Apps
Feed
Chat

Design

Responsive

Gamification
Notifications
Mobile
Services
GWT

Mobile

Reverse Proxy

?
Java
Service

Python
Service

...
PHP Legacy Code
Services
GWT

Mobile

Reverse Proxy

Symfony 2 - PHP REST Api
Java
Service

Python
Service

...
PHP Legacy Code
Services

Reverse Proxy
Routen
Konfiguration
Symfony 2 - PHP REST Api

PHP Legacy Code
Services

Reverse Proxy
Routen
Konfiguration
Symfony 2 - PHP REST Api

PHP Legacy Code
Services
Client

Reverse Proxy
verify

signing
Symfony 2 - PHP REST Api

Service
PHP Legacy Code
Services
GWT

Mobile

Reverse Proxy

Symfony 2 - PHP REST Api
Java
Service

Python
Service

...
PHP Legacy Code
Bestehende Systeme erweitern
Client
Mobile App
Entwickler
3rd Party Apps

Symfony 2 - PHP REST Api

PHP Legacy Code
Bestehende Systeme erweitern
Client

Symfony 2 Service

PHP Legacy Code
unser Weg vom Monolithen zu Symfony 2
●
●
●
●

klein beginnen
Continuous Shipping
aus Erfahrungen lernen
Symfonys Flexibilität nutzen
heute
Learning Management System
LMS
Symfony Applications
Talking AMQP

Question
Management

Assessment
Engine

AMQP
LMS
GWT

JS

Reverse Proxy

Question
Management

Assessment
Engine

Product & User Management

AMQP
Teil 2
Symfony Besonderheiten & “Best Practices”
Symfony2 Besonderheiten
Die Schönheit von Symfony2, kommt zur Geltung
Einheitlichkeit → DevblissBundle
● Abstrakter, Wiederverwendbarer Bundle
● git submodule
○ Eigene Annotationen (Custom Annotations)
○ Event Listener
○ Genereller Controller
○ ……..USW
Symfony2 Besonderheiten
Eigene Annotationen
Beispiel 1: JsonKey

GWT-Frontend

{ “myAnswers”=... }
class ActivityImportEvent extends Event
{
/**

Reverse Proxy

* answers property
* @AssertType("array")
* @AssertNotNull(message="field_cannot_be_null")
* @AssertNotBlank(message="field_cannot_be_empty")
* @JsonKey("myAnswers")

Symfony2 Backend

*/
protected $answers = array();

$answers=....
Symfony2 Besonderheiten
Eigene Annotationen
Beispiel 2: Signed Objects
@Route("/what/ever",
requirements = {...},
options = {
"payload" = {
"name" = {...},
"permission" = {
"required" = true,
"type"
"signed"
},
}
}

= "UserPermission",
= true
Symfony2 Besonderheiten
Eigene Annotationen
Beispiel 2: Signed Objects
@Route("/what/ever",
requirements = {...},
options = {
"payload" = {
"name" = {...},
"permission" = {
"required" = true,
"type"
"signed"
},
}
}

= "UserPermission[]”,
= true
Symfony2 Besonderheiten
Event Listener 1 - Exceptions Listener
Reverse Proxy

Event:kernel.exception

Symfony2 App
→ devbliss.exception_listener
Symfony2 Besonderheiten
Eigene Error Exceptions Listener
● Keine HTML Seiten -> JSON-Error Payload
● Ins Symfony Log schreiben
● Eindeutige ID zum Wiedererkennen
{
"errorDetail":[
],
"errorId":"4564b6456456b54645b6",
"errorMessage":"users_userid_avatar_put_no_payload",
"errorType":"Exception"
}
Symfony2 Besonderheiten
Eigener Exceptionslistener
//BadRequestException()
if ($classId == '') {
throw new BadRequestException();
}
//ValidationException
if (!$user->isValidPassword($newPassword)) {
throw new ValidationException(array(),'new password invalid');
}
Symfony2 Besonderheiten
Eigener Exceptions Listener
#service.yml (Devbliss Bundle)
services:
devbliss.exception_listener:
class: DevblissCoreBundleEventListenerExceptionListener
arguments:
- @templating
- @logger
tags:
- { name: kernel.event_listener, event: kernel.exception, method:
onCoreException }
Symfony2 Besonderheiten
Event Listener 2 - Url Parameter Controller Listener
Reverse Proxy

Event:kernel.controller

Symfony2 App → devbliss.controller_listener.url_parameter
Symfony2 Besonderheiten
Event Listener 3 - Url Parameter Controller Listener
/**
*
* @Route("activity/{id}",
*
requirements = {
*
"id"
*
"tokens"

= "d+",
= "(d+(?:,d+)*)",

*
}
* )
*/
public function getActivityResults($id, Array $tokens)
{
Route: activity/45/5
=> $id = 45, $tokens = array(5)
Route: activity/45/5,6,7 => $id = 45, $tokens = array(5,6,7)
Symfony2 Besonderheiten
Event Listener - Reverse Proxy Session Listener
Reverse Proxy

Event:kernel.request

Symfony2 App → devbliss.request_listener.reverse_proxy_session
Symfony2 Besonderheiten
Allgemeiner Controller
● Wiederverwendbarkeit, Controller schlank halten
abstract class Controller extends SymfonyController
{
protected function getSession()
protected function performValidation()
......
Symfony2 Besonderheiten
Symfony Console Component
Symfony2 Besonderheiten
Symfony Console Component-Produkte Import
php app/console jura:prod_import

Products
Units
Sections
Activity Sets
Symfony2 Besonderheiten
Doctrine Fixtures -> DB-Dumps
array()....
foreach…..

php app/console qm:dump_fixture
Symfony2 Besonderheiten
RabbitMQ-Consumers/Workers

php app/console ae:result_worker
Symfony2 Besonderheiten
Klassen in den DI-Container als Services service.yml
sams_memcached:
class:

"JuraMemcachedBundleServiceMemcachedService"

arguments:

[@service_container]

quiz_service:
class:

"JuraQuizBundleServiceQuizService"

arguments:

[@service_container]
Symfony2 Besonderheiten
Weitere Populäre Symfony Features
● ORM/ODM Fixtures
● Symfony2 @Asserts, eigene Asserts
● Doctrine Tree Extension
Section
ActivitySet

Unit
ActivitySet
Symfony Code

Trennung und Individualisierung
Sources

/usr/share/hauptprojekt
configs ( z.B. parameter.yml)

/etc
Logs (prod.log...usw)

/var/log/hauptprojekt
Caches (/prod….usw)

/var/cache/hauptprojekt
Continuous Integration
Continuous Integration

PHP Code Sniffer

Doctests
(Integration Tests)
Mockery
Fazit

Symfony2 ist und bleibt ein
wichtiger Teil unserer Infrastruktur
Symfony 2 Die Perle in einem SOA-Ozean

Danke!
Fragen ?
http://joind.in/9756
Slides bald auf http://www.devbliss.
com

Weitere ähnliche Inhalte

Empfohlen

Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsPixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Applitools
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at WorkGetSmarter
 

Empfohlen (20)

Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 

Symfony 2 Die Perle in einem SOA-Ozean