SlideShare a Scribd company logo
1 of 59
Download to read offline
Symfony4: a new way to develop
applications
Antonio Perić-Mažar, Locastic
04.06.2019 - #ipc19
Antonio
Perić-Mažar
CEO @ Locastic
Co-founder @ Tinel Meetup
Co-founder @ Blockada
t: antonioperic
m: antonio@locastic.com
Locastic
Helping clients create web
and mobile apps since 2011
• UX/UI
• Mobile apps
• Web apps
• Training & Consulting
www.locastic.com
@locastic
2005.
php 5.3
2009.2005.
php 5.3
2009.2005. 2015.
php 5.3
2009.2005. 2015. Nov 2017.
• Installing bundle is too cumbersome
• Remove bundle is too cumbersome
• The standard edition is not good enough
• You always had a feeling that you have a bunch of code and
packages that your are not using
What we can do better?
– Fabien Potencier
“As a developer, I want to start small, without too many
dependencies. But I also want to be able to grow my
application as I see fit. From a micro-framework style app to a
gigantic monolith. Your choice. The framework should not get
in the way.”
– Fabien Potencier
“As a developer, I want to start small, without too many
dependencies. But I also want to be able to grow my
application as I see fit. From a micro-framework style app to a
gigantic monolith. Your choice. The framework should not get
in the way.”
Composition over
inheritance
• Starting as micro framework
• Compose your application
• Build anything you want; console app, traditional web app, etc
• Based on a micro-kernel and contain 70% less code and files than
new Symfony 3 apps
Symfony4
Composer started as a conversation about how to generically install
bundles/plugins/extensions for Symfony and phpBB.
Fun fact
Composer started as a conversation about how to generically install
bundles/plugins/extensions for Symfony and phpBB.
Fun fact
Neither Symfony nor phpBB uses Composer as a way to install its
bundles/plugins/extensions.
WTF fact
• Composer plugin
• Auto-configurable via recipes
• Official and private recipes
Symfony Flex
Decide which package to install
Run any task to configure them
{
"bundles": {
"SymfonyBundleSwiftmailerBundleSwiftmailerBundle":
["all"]
},
"copy-from-recipe": {
"config/": "%CONFIG_DIR%/"
},
"env": {
"#1": "For Gmail as a transport, use: "gmail://
username:password@localhost"",
"#2": "For a generic SMTP server, use: "smtp://localhost:
25?encryption=&auth_mode="",
"#3": "Delivery is disabled by default via "null://
localhost"",
"MAILER_URL": "null://localhost"
},
"aliases": ["mailer", "mail"]
}
Symfony mailer recipe
• Two repositories
• symfony/recipies
• maintained by Symfony core team, contains only recipies for
components and bundles ‘opinionated’ by core team
• can use alias
• symfony/recipies-contrib
• anyone can contribute
• cannot use alias
Symfony Flex Recipies
https://flex.symfony.com/
• With composer
• composer create-project symfony/skeleton
• composer create-project symfony/website-skeleton
• composer create-project symfony/demo
Starting a new project
• With Symfony Client
• Helps you create new Symfony applications
• supports multiple PHP versions, different PHP config per directory
• Provides a local HTTP/2 web server
• Generates TLS certificates
• Checks for security vulnerabilities
• Seamlessly integrates with SymfonyCloud
• Works on Windows also
Starting a new project
• With Symfony Client
• symfony new my_project
• symfony new ——full my_poject
• symfony serve
Starting a new project
Configuration
No more different
controllers for different enviroments
Your code goes
here
Cache, log…
vendors
.env variables
symfony.lock is used
by flex to track which recipies are
installed in the project
• parameters.yaml is gone
• more flexible but still you need to care about security
• .env - commit - defaults
• .env.local - gitignore
• .env.test - commit - defaults
• .env.test.local - gitignore
.env
Don’t put secrets in .env
file!!!
• Bundle vs no-bundle apps
• All in src/ folder
• App/ namespace
• You should separate, but no need for bundles
• Moving forward to standardisation
• Reduces the perceived complexity, makes your code feels more
decoupled from symfony
• Bundle inheritance mechanisms are depricated in 3.4, removed in 4.0
Bundle-less
applications
Say hi to autowiring
• Introduced in Symfony3
• Allows you to manage services in the container with minimal
configuration
• Reads type-hints on your constructor (or other methods) and
automatically passes the correct services
• Designed to be predictable; if it is not absolutely clear which
dependency should be passed, you will see actionable exception
• Registers each class it finds as the fully qualified class name (FQCN)
Autowiring
# This file is the entry point to configure your own services.
# Files in the packages/ subdirectory configure your dependencies.
# Put parameters here that don't need to change on each machine where the app is deployed
# https://symfony.com/doc/current/best_practices/configuration.html#application-related-configuration
parameters:
services:
# default configuration for services in *this* file
_defaults:
autowire: true # Automatically injects dependencies in your services.
autoconfigure: true # Automatically registers your services as commands, event subscribers, etc.
# makes classes in src/ available to be used as services
# this creates a service per class whose id is the fully-qualified class name
App:
resource: '../src/*'
exclude: '../src/{DependencyInjection,Entity,Migrations,Tests,Kernel.php}'
# controllers are imported separately to make sure services can be injected
# as action arguments even if you don't extend any base controller class
AppController:
resource: '../src/Controller'
tags: ['controller.service_arguments']
# add more service definitions when explicit configuration is needed
# please note that last definitions always *replace* previous ones
By default, all services
are now private.
$container->get(‘service_name’)
is dead
<?php
namespace AppService;
use AppUtilRot13Transformer;
class TwitterClient
{
private $transformer;
public function __construct(Rot13Transformer $transformer)
{
$this->transformer = $transformer;
}
public function tweet($user, $key, $status)
{
$transformedStatus = $this->transformer->transform($status);
// ... connect to Twitter and send the encoded status
}
}
bin/console debug:autowiring
• Webpack Encore is a simpler way to integrate Webpack into your
application
• Step forward after AsseticBundle
• composer require webpack-encore
• Works outside of Symfony
Symfony Webpack
Encore
• Symfony on PHP 7.2 makes your code quite a bit faster than 7.1
• Symfony 2.3 is the second fastest Symfony release since 2.0
• Symfony 3.4 is the slowest release since 2.0 (deprecated features are
probably one of the reasons);
• Symfony 4.0 is almost three times faster as Laravel 5.5.
Performance
Stability and
predictability
• It is possible, not so complex (depending on project)
• It will take a little bit of time
• Upgrade first to Symfony 3.4
Updating to Symfony4
Symfony 4.3 (May 30, 2019)
Keep cooding features!
Symfony4 spirit
• It is a great feeling working with Symfony4
• Symfony has great community that is moving framework forward
• Flex is amazing thing
• New folder structure is more organised and more natural
• Better standardisation
A year later
• Symfony is great as microframework
• Higher level of abstraction is better for prototyping and building
things faster
• Very easy to start, but maybe new developers will think there is to
much magic
• Symfony as framework should not be a limitation for you
A year later
Thank you!
Questions?
Antonio Perić-Mažar
t: antonioperic
m: antonio@locastic.com

More Related Content

What's hot

CC-Castle; The best Real-Time/Embedded/HighTech language EVER?
CC-Castle; The best Real-Time/Embedded/HighTech language EVER?CC-Castle; The best Real-Time/Embedded/HighTech language EVER?
CC-Castle; The best Real-Time/Embedded/HighTech language EVER?Albert Mietus
 
Symfony Live San Franciso 2017 - BDD API Development with Symfony and Behat
Symfony Live San Franciso 2017 - BDD API Development with Symfony and BehatSymfony Live San Franciso 2017 - BDD API Development with Symfony and Behat
Symfony Live San Franciso 2017 - BDD API Development with Symfony and BehatAdam Englander
 
Advanced Server Integration with Data and Direct
Advanced Server Integration with Data and DirectAdvanced Server Integration with Data and Direct
Advanced Server Integration with Data and DirectSencha
 
Being Dangerous with Twig (Symfony Live Paris)
Being Dangerous with Twig (Symfony Live Paris)Being Dangerous with Twig (Symfony Live Paris)
Being Dangerous with Twig (Symfony Live Paris)Ryan Weaver
 
Introduce anypoint studio
Introduce anypoint studioIntroduce anypoint studio
Introduce anypoint studioSon Nguyen
 
AEM - Binary less replication
AEM - Binary less replicationAEM - Binary less replication
AEM - Binary less replicationAshokkumar T A
 
All Aboard for Laravel 5.1
All Aboard for Laravel 5.1All Aboard for Laravel 5.1
All Aboard for Laravel 5.1Jason McCreary
 
DSpace UI prototype dsember
DSpace UI prototype dsemberDSpace UI prototype dsember
DSpace UI prototype dsemberBram Luyten
 
Laravel and CodeIgniter: pros & cons
Laravel and CodeIgniter: pros & consLaravel and CodeIgniter: pros & cons
Laravel and CodeIgniter: pros & consElenorWisozk
 
Phalcon 2 High Performance APIs - DevWeekPOA 2015
Phalcon 2 High Performance APIs - DevWeekPOA 2015Phalcon 2 High Performance APIs - DevWeekPOA 2015
Phalcon 2 High Performance APIs - DevWeekPOA 2015Jackson F. de A. Mafra
 
What's New in WCF 4.5
What's New in WCF 4.5What's New in WCF 4.5
What's New in WCF 4.5Ido Flatow
 
11.Open Data Protocol(ODATA)
11.Open Data Protocol(ODATA) 11.Open Data Protocol(ODATA)
11.Open Data Protocol(ODATA) Nguyen Tuan
 
[WSO2Con EU 2017] An Overview of Ballerina Composer
[WSO2Con EU 2017] An Overview of Ballerina Composer[WSO2Con EU 2017] An Overview of Ballerina Composer
[WSO2Con EU 2017] An Overview of Ballerina ComposerWSO2
 
Application Note APLX-LMW-0403: Interfacing the Apache Web ...
Application Note APLX-LMW-0403: Interfacing the Apache Web ...Application Note APLX-LMW-0403: Interfacing the Apache Web ...
Application Note APLX-LMW-0403: Interfacing the Apache Web ...webhostingguy
 

What's hot (20)

Laravel 5.4
Laravel 5.4 Laravel 5.4
Laravel 5.4
 
CC-Castle; The best Real-Time/Embedded/HighTech language EVER?
CC-Castle; The best Real-Time/Embedded/HighTech language EVER?CC-Castle; The best Real-Time/Embedded/HighTech language EVER?
CC-Castle; The best Real-Time/Embedded/HighTech language EVER?
 
Laravel Introduction
Laravel IntroductionLaravel Introduction
Laravel Introduction
 
Laravel Tutorial PPT
Laravel Tutorial PPTLaravel Tutorial PPT
Laravel Tutorial PPT
 
Symfony Live San Franciso 2017 - BDD API Development with Symfony and Behat
Symfony Live San Franciso 2017 - BDD API Development with Symfony and BehatSymfony Live San Franciso 2017 - BDD API Development with Symfony and Behat
Symfony Live San Franciso 2017 - BDD API Development with Symfony and Behat
 
Advanced Server Integration with Data and Direct
Advanced Server Integration with Data and DirectAdvanced Server Integration with Data and Direct
Advanced Server Integration with Data and Direct
 
Being Dangerous with Twig (Symfony Live Paris)
Being Dangerous with Twig (Symfony Live Paris)Being Dangerous with Twig (Symfony Live Paris)
Being Dangerous with Twig (Symfony Live Paris)
 
PHP & Twilio
PHP & TwilioPHP & Twilio
PHP & Twilio
 
Introduce anypoint studio
Introduce anypoint studioIntroduce anypoint studio
Introduce anypoint studio
 
AEM - Binary less replication
AEM - Binary less replicationAEM - Binary less replication
AEM - Binary less replication
 
All Aboard for Laravel 5.1
All Aboard for Laravel 5.1All Aboard for Laravel 5.1
All Aboard for Laravel 5.1
 
Anypoint lessons
Anypoint lessonsAnypoint lessons
Anypoint lessons
 
DSpace UI prototype dsember
DSpace UI prototype dsemberDSpace UI prototype dsember
DSpace UI prototype dsember
 
Laravel overview
Laravel overviewLaravel overview
Laravel overview
 
Laravel and CodeIgniter: pros & cons
Laravel and CodeIgniter: pros & consLaravel and CodeIgniter: pros & cons
Laravel and CodeIgniter: pros & cons
 
Phalcon 2 High Performance APIs - DevWeekPOA 2015
Phalcon 2 High Performance APIs - DevWeekPOA 2015Phalcon 2 High Performance APIs - DevWeekPOA 2015
Phalcon 2 High Performance APIs - DevWeekPOA 2015
 
What's New in WCF 4.5
What's New in WCF 4.5What's New in WCF 4.5
What's New in WCF 4.5
 
11.Open Data Protocol(ODATA)
11.Open Data Protocol(ODATA) 11.Open Data Protocol(ODATA)
11.Open Data Protocol(ODATA)
 
[WSO2Con EU 2017] An Overview of Ballerina Composer
[WSO2Con EU 2017] An Overview of Ballerina Composer[WSO2Con EU 2017] An Overview of Ballerina Composer
[WSO2Con EU 2017] An Overview of Ballerina Composer
 
Application Note APLX-LMW-0403: Interfacing the Apache Web ...
Application Note APLX-LMW-0403: Interfacing the Apache Web ...Application Note APLX-LMW-0403: Interfacing the Apache Web ...
Application Note APLX-LMW-0403: Interfacing the Apache Web ...
 

Similar to Symfony 4: A new way to develop applications #ipc19

Fabien Potencier "Symfony 4 in action"
Fabien Potencier "Symfony 4 in action"Fabien Potencier "Symfony 4 in action"
Fabien Potencier "Symfony 4 in action"Fwdays
 
Dependency management with Composer
Dependency management with ComposerDependency management with Composer
Dependency management with ComposerJason Grimes
 
Symfony4 - Deep dive
Symfony4 - Deep diveSymfony4 - Deep dive
Symfony4 - Deep diveSalma Ghareeb
 
Hands-on with the Symfony2 Framework
Hands-on with the Symfony2 FrameworkHands-on with the Symfony2 Framework
Hands-on with the Symfony2 FrameworkRyan Weaver
 
Symfony Components 2.0 on PHP 5.3
Symfony Components 2.0 on PHP 5.3Symfony Components 2.0 on PHP 5.3
Symfony Components 2.0 on PHP 5.3Fabien Potencier
 
Migration of a legacy project to Symfony
Migration of a legacy project to SymfonyMigration of a legacy project to Symfony
Migration of a legacy project to SymfonyPixel Federation
 
How to automate elixir phoenix deployment with distillery and edeliver on ubu...
How to automate elixir phoenix deployment with distillery and edeliver on ubu...How to automate elixir phoenix deployment with distillery and edeliver on ubu...
How to automate elixir phoenix deployment with distillery and edeliver on ubu...VasiliyPodnebesniy
 
Workshop: Symfony2 Intruduction: (Controller, Routing, Model)
Workshop: Symfony2 Intruduction: (Controller, Routing, Model)Workshop: Symfony2 Intruduction: (Controller, Routing, Model)
Workshop: Symfony2 Intruduction: (Controller, Routing, Model)Antonio Peric-Mazar
 
IBM Bluemix cloudfoundry platform
IBM Bluemix cloudfoundry platformIBM Bluemix cloudfoundry platform
IBM Bluemix cloudfoundry platformDaniela Zuppini
 
Dev traning 2016 symfony
Dev traning 2016   symfonyDev traning 2016   symfony
Dev traning 2016 symfonySacheen Dhanjie
 
MWLUG 2015 - IBM Connections - Installing the Free "Extras" and Integrating w...
MWLUG 2015 - IBM Connections - Installing the Free "Extras" and Integrating w...MWLUG 2015 - IBM Connections - Installing the Free "Extras" and Integrating w...
MWLUG 2015 - IBM Connections - Installing the Free "Extras" and Integrating w...Victor Toal
 
Deployment with capifony
Deployment with capifonyDeployment with capifony
Deployment with capifonyJan De Coster
 
Composer Lightning Talk
Composer Lightning TalkComposer Lightning Talk
Composer Lightning TalkEric Johnson
 
Why we choose Symfony2
Why we choose Symfony2Why we choose Symfony2
Why we choose Symfony2Merixstudio
 
Symfony4: A new way to develop applications | Antonio Peric | CODEiD
Symfony4: A new way to develop applications | Antonio Peric | CODEiDSymfony4: A new way to develop applications | Antonio Peric | CODEiD
Symfony4: A new way to develop applications | Antonio Peric | CODEiDCODEiD PHP Community
 

Similar to Symfony 4: A new way to develop applications #ipc19 (20)

Fabien Potencier "Symfony 4 in action"
Fabien Potencier "Symfony 4 in action"Fabien Potencier "Symfony 4 in action"
Fabien Potencier "Symfony 4 in action"
 
Dependency management with Composer
Dependency management with ComposerDependency management with Composer
Dependency management with Composer
 
Symfony4 - Deep dive
Symfony4 - Deep diveSymfony4 - Deep dive
Symfony4 - Deep dive
 
Hands-on with the Symfony2 Framework
Hands-on with the Symfony2 FrameworkHands-on with the Symfony2 Framework
Hands-on with the Symfony2 Framework
 
Symfony Components 2.0 on PHP 5.3
Symfony Components 2.0 on PHP 5.3Symfony Components 2.0 on PHP 5.3
Symfony Components 2.0 on PHP 5.3
 
Automation in Cloud
Automation in CloudAutomation in Cloud
Automation in Cloud
 
Symfony 2.0 on PHP 5.3
Symfony 2.0 on PHP 5.3Symfony 2.0 on PHP 5.3
Symfony 2.0 on PHP 5.3
 
Migration of a legacy project to Symfony
Migration of a legacy project to SymfonyMigration of a legacy project to Symfony
Migration of a legacy project to Symfony
 
Symfony quick tour_2.3
Symfony quick tour_2.3Symfony quick tour_2.3
Symfony quick tour_2.3
 
Running Symfony
Running SymfonyRunning Symfony
Running Symfony
 
How to automate elixir phoenix deployment with distillery and edeliver on ubu...
How to automate elixir phoenix deployment with distillery and edeliver on ubu...How to automate elixir phoenix deployment with distillery and edeliver on ubu...
How to automate elixir phoenix deployment with distillery and edeliver on ubu...
 
Workshop: Symfony2 Intruduction: (Controller, Routing, Model)
Workshop: Symfony2 Intruduction: (Controller, Routing, Model)Workshop: Symfony2 Intruduction: (Controller, Routing, Model)
Workshop: Symfony2 Intruduction: (Controller, Routing, Model)
 
IBM Bluemix cloudfoundry platform
IBM Bluemix cloudfoundry platformIBM Bluemix cloudfoundry platform
IBM Bluemix cloudfoundry platform
 
Dev traning 2016 symfony
Dev traning 2016   symfonyDev traning 2016   symfony
Dev traning 2016 symfony
 
MWLUG 2015 - IBM Connections - Installing the Free "Extras" and Integrating w...
MWLUG 2015 - IBM Connections - Installing the Free "Extras" and Integrating w...MWLUG 2015 - IBM Connections - Installing the Free "Extras" and Integrating w...
MWLUG 2015 - IBM Connections - Installing the Free "Extras" and Integrating w...
 
Deployment with capifony
Deployment with capifonyDeployment with capifony
Deployment with capifony
 
Composer Lightning Talk
Composer Lightning TalkComposer Lightning Talk
Composer Lightning Talk
 
Why we choose Symfony2
Why we choose Symfony2Why we choose Symfony2
Why we choose Symfony2
 
Symfony4: A new way to develop applications | Antonio Peric | CODEiD
Symfony4: A new way to develop applications | Antonio Peric | CODEiDSymfony4: A new way to develop applications | Antonio Peric | CODEiD
Symfony4: A new way to develop applications | Antonio Peric | CODEiD
 
Phalcon - Giant Killer
Phalcon - Giant KillerPhalcon - Giant Killer
Phalcon - Giant Killer
 

More from Antonio Peric-Mazar

You call yourself a Senior Developer?
You call yourself a Senior Developer?You call yourself a Senior Developer?
You call yourself a Senior Developer?Antonio Peric-Mazar
 
Using API Platform to build ticketing system #symfonycon
Using API Platform to build ticketing system #symfonyconUsing API Platform to build ticketing system #symfonycon
Using API Platform to build ticketing system #symfonyconAntonio Peric-Mazar
 
Using API platform to build ticketing system (translations, time zones, ...) ...
Using API platform to build ticketing system (translations, time zones, ...) ...Using API platform to build ticketing system (translations, time zones, ...) ...
Using API platform to build ticketing system (translations, time zones, ...) ...Antonio Peric-Mazar
 
Are you failing at being agile? #digitallabin
Are you failing at being agile? #digitallabinAre you failing at being agile? #digitallabin
Are you failing at being agile? #digitallabinAntonio Peric-Mazar
 
A year with progressive web apps! #webinale
A year with progressive web apps! #webinaleA year with progressive web apps! #webinale
A year with progressive web apps! #webinaleAntonio Peric-Mazar
 
The UI is the THE application #dpc19
The UI is the THE application #dpc19The UI is the THE application #dpc19
The UI is the THE application #dpc19Antonio Peric-Mazar
 
A year with progressive web apps! #DevConMU
A year with progressive web apps! #DevConMUA year with progressive web apps! #DevConMU
A year with progressive web apps! #DevConMUAntonio Peric-Mazar
 
Service workers are your best friends
Service workers are your best friendsService workers are your best friends
Service workers are your best friendsAntonio Peric-Mazar
 
Building APIs in an easy way using API Platform
Building APIs in an easy way using API PlatformBuilding APIs in an easy way using API Platform
Building APIs in an easy way using API PlatformAntonio Peric-Mazar
 
Symfony4 - A new way of developing web applications
Symfony4 - A new way of developing web applicationsSymfony4 - A new way of developing web applications
Symfony4 - A new way of developing web applicationsAntonio Peric-Mazar
 
Build your business on top of Open Source
Build your business on top of Open SourceBuild your business on top of Open Source
Build your business on top of Open SourceAntonio Peric-Mazar
 
Building APIs in an easy way using API Platform
Building APIs in an easy way using API PlatformBuilding APIs in an easy way using API Platform
Building APIs in an easy way using API PlatformAntonio Peric-Mazar
 
Lessons learned while developing with Sylius
Lessons learned while developing with SyliusLessons learned while developing with Sylius
Lessons learned while developing with SyliusAntonio Peric-Mazar
 
Drupal8 for Symfony developers - Dutch PHP
Drupal8 for Symfony developers - Dutch PHPDrupal8 for Symfony developers - Dutch PHP
Drupal8 for Symfony developers - Dutch PHPAntonio Peric-Mazar
 
Drupal8 for Symfony Developers (PHP Day Verona 2017)
Drupal8 for Symfony Developers (PHP Day Verona 2017)Drupal8 for Symfony Developers (PHP Day Verona 2017)
Drupal8 for Symfony Developers (PHP Day Verona 2017)Antonio Peric-Mazar
 
Maintainable + Extensible = Clean ... yes, Code!
Maintainable + Extensible = Clean ... yes, Code! Maintainable + Extensible = Clean ... yes, Code!
Maintainable + Extensible = Clean ... yes, Code! Antonio Peric-Mazar
 
A recipe for effective leadership
A recipe for effective leadershipA recipe for effective leadership
A recipe for effective leadershipAntonio Peric-Mazar
 

More from Antonio Peric-Mazar (20)

You call yourself a Senior Developer?
You call yourself a Senior Developer?You call yourself a Senior Developer?
You call yourself a Senior Developer?
 
Using API Platform to build ticketing system #symfonycon
Using API Platform to build ticketing system #symfonyconUsing API Platform to build ticketing system #symfonycon
Using API Platform to build ticketing system #symfonycon
 
Using API platform to build ticketing system (translations, time zones, ...) ...
Using API platform to build ticketing system (translations, time zones, ...) ...Using API platform to build ticketing system (translations, time zones, ...) ...
Using API platform to build ticketing system (translations, time zones, ...) ...
 
Are you failing at being agile? #digitallabin
Are you failing at being agile? #digitallabinAre you failing at being agile? #digitallabin
Are you failing at being agile? #digitallabin
 
A year with progressive web apps! #webinale
A year with progressive web apps! #webinaleA year with progressive web apps! #webinale
A year with progressive web apps! #webinale
 
The UI is the THE application #dpc19
The UI is the THE application #dpc19The UI is the THE application #dpc19
The UI is the THE application #dpc19
 
REST easy with API Platform
REST easy with API PlatformREST easy with API Platform
REST easy with API Platform
 
A year with progressive web apps! #DevConMU
A year with progressive web apps! #DevConMUA year with progressive web apps! #DevConMU
A year with progressive web apps! #DevConMU
 
Service workers are your best friends
Service workers are your best friendsService workers are your best friends
Service workers are your best friends
 
Progressive Web Apps are here!
Progressive Web Apps are here!Progressive Web Apps are here!
Progressive Web Apps are here!
 
Building APIs in an easy way using API Platform
Building APIs in an easy way using API PlatformBuilding APIs in an easy way using API Platform
Building APIs in an easy way using API Platform
 
Symfony4 - A new way of developing web applications
Symfony4 - A new way of developing web applicationsSymfony4 - A new way of developing web applications
Symfony4 - A new way of developing web applications
 
Build your business on top of Open Source
Build your business on top of Open SourceBuild your business on top of Open Source
Build your business on top of Open Source
 
Building APIs in an easy way using API Platform
Building APIs in an easy way using API PlatformBuilding APIs in an easy way using API Platform
Building APIs in an easy way using API Platform
 
Lessons learned while developing with Sylius
Lessons learned while developing with SyliusLessons learned while developing with Sylius
Lessons learned while developing with Sylius
 
Drupal8 for Symfony developers - Dutch PHP
Drupal8 for Symfony developers - Dutch PHPDrupal8 for Symfony developers - Dutch PHP
Drupal8 for Symfony developers - Dutch PHP
 
Drupal8 for Symfony Developers (PHP Day Verona 2017)
Drupal8 for Symfony Developers (PHP Day Verona 2017)Drupal8 for Symfony Developers (PHP Day Verona 2017)
Drupal8 for Symfony Developers (PHP Day Verona 2017)
 
Drupal8 for Symfony Developers
Drupal8 for Symfony DevelopersDrupal8 for Symfony Developers
Drupal8 for Symfony Developers
 
Maintainable + Extensible = Clean ... yes, Code!
Maintainable + Extensible = Clean ... yes, Code! Maintainable + Extensible = Clean ... yes, Code!
Maintainable + Extensible = Clean ... yes, Code!
 
A recipe for effective leadership
A recipe for effective leadershipA recipe for effective leadership
A recipe for effective leadership
 

Recently uploaded

Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
Engage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyEngage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyFrank van der Linden
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about usDynamic Netsoft
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number SystemsJheuzeDellosa
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software DevelopersVinodh Ram
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEOrtus Solutions, Corp
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptkotipi9215
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...Christina Lin
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackVICTOR MAESTRE RAMIREZ
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfkalichargn70th171
 

Recently uploaded (20)

Exploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the ProcessExploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the Process
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
Engage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyEngage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The Ugly
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about us
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number Systems
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software Developers
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.ppt
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStack
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
 

Symfony 4: A new way to develop applications #ipc19

  • 1. Symfony4: a new way to develop applications Antonio Perić-Mažar, Locastic 04.06.2019 - #ipc19
  • 2. Antonio Perić-Mažar CEO @ Locastic Co-founder @ Tinel Meetup Co-founder @ Blockada t: antonioperic m: antonio@locastic.com
  • 3. Locastic Helping clients create web and mobile apps since 2011 • UX/UI • Mobile apps • Web apps • Training & Consulting www.locastic.com @locastic
  • 4.
  • 5.
  • 10.
  • 11. • Installing bundle is too cumbersome • Remove bundle is too cumbersome • The standard edition is not good enough • You always had a feeling that you have a bunch of code and packages that your are not using What we can do better?
  • 12. – Fabien Potencier “As a developer, I want to start small, without too many dependencies. But I also want to be able to grow my application as I see fit. From a micro-framework style app to a gigantic monolith. Your choice. The framework should not get in the way.”
  • 13. – Fabien Potencier “As a developer, I want to start small, without too many dependencies. But I also want to be able to grow my application as I see fit. From a micro-framework style app to a gigantic monolith. Your choice. The framework should not get in the way.”
  • 15. • Starting as micro framework • Compose your application • Build anything you want; console app, traditional web app, etc • Based on a micro-kernel and contain 70% less code and files than new Symfony 3 apps Symfony4
  • 16.
  • 17. Composer started as a conversation about how to generically install bundles/plugins/extensions for Symfony and phpBB. Fun fact
  • 18. Composer started as a conversation about how to generically install bundles/plugins/extensions for Symfony and phpBB. Fun fact Neither Symfony nor phpBB uses Composer as a way to install its bundles/plugins/extensions. WTF fact
  • 19. • Composer plugin • Auto-configurable via recipes • Official and private recipes Symfony Flex
  • 20.
  • 21. Decide which package to install Run any task to configure them
  • 22. { "bundles": { "SymfonyBundleSwiftmailerBundleSwiftmailerBundle": ["all"] }, "copy-from-recipe": { "config/": "%CONFIG_DIR%/" }, "env": { "#1": "For Gmail as a transport, use: "gmail:// username:password@localhost"", "#2": "For a generic SMTP server, use: "smtp://localhost: 25?encryption=&auth_mode="", "#3": "Delivery is disabled by default via "null:// localhost"", "MAILER_URL": "null://localhost" }, "aliases": ["mailer", "mail"] } Symfony mailer recipe
  • 23. • Two repositories • symfony/recipies • maintained by Symfony core team, contains only recipies for components and bundles ‘opinionated’ by core team • can use alias • symfony/recipies-contrib • anyone can contribute • cannot use alias Symfony Flex Recipies
  • 25.
  • 26. • With composer • composer create-project symfony/skeleton • composer create-project symfony/website-skeleton • composer create-project symfony/demo Starting a new project
  • 27. • With Symfony Client • Helps you create new Symfony applications • supports multiple PHP versions, different PHP config per directory • Provides a local HTTP/2 web server • Generates TLS certificates • Checks for security vulnerabilities • Seamlessly integrates with SymfonyCloud • Works on Windows also Starting a new project
  • 28. • With Symfony Client • symfony new my_project • symfony new ——full my_poject • symfony serve Starting a new project
  • 29.
  • 31. No more different controllers for different enviroments
  • 36. symfony.lock is used by flex to track which recipies are installed in the project
  • 37. • parameters.yaml is gone • more flexible but still you need to care about security • .env - commit - defaults • .env.local - gitignore • .env.test - commit - defaults • .env.test.local - gitignore .env
  • 38. Don’t put secrets in .env file!!!
  • 39. • Bundle vs no-bundle apps • All in src/ folder • App/ namespace • You should separate, but no need for bundles • Moving forward to standardisation • Reduces the perceived complexity, makes your code feels more decoupled from symfony • Bundle inheritance mechanisms are depricated in 3.4, removed in 4.0 Bundle-less applications
  • 40. Say hi to autowiring
  • 41. • Introduced in Symfony3 • Allows you to manage services in the container with minimal configuration • Reads type-hints on your constructor (or other methods) and automatically passes the correct services • Designed to be predictable; if it is not absolutely clear which dependency should be passed, you will see actionable exception • Registers each class it finds as the fully qualified class name (FQCN) Autowiring
  • 42. # This file is the entry point to configure your own services. # Files in the packages/ subdirectory configure your dependencies. # Put parameters here that don't need to change on each machine where the app is deployed # https://symfony.com/doc/current/best_practices/configuration.html#application-related-configuration parameters: services: # default configuration for services in *this* file _defaults: autowire: true # Automatically injects dependencies in your services. autoconfigure: true # Automatically registers your services as commands, event subscribers, etc. # makes classes in src/ available to be used as services # this creates a service per class whose id is the fully-qualified class name App: resource: '../src/*' exclude: '../src/{DependencyInjection,Entity,Migrations,Tests,Kernel.php}' # controllers are imported separately to make sure services can be injected # as action arguments even if you don't extend any base controller class AppController: resource: '../src/Controller' tags: ['controller.service_arguments'] # add more service definitions when explicit configuration is needed # please note that last definitions always *replace* previous ones
  • 43. By default, all services are now private. $container->get(‘service_name’) is dead
  • 44. <?php namespace AppService; use AppUtilRot13Transformer; class TwitterClient { private $transformer; public function __construct(Rot13Transformer $transformer) { $this->transformer = $transformer; } public function tweet($user, $key, $status) { $transformedStatus = $this->transformer->transform($status); // ... connect to Twitter and send the encoded status } }
  • 46. • Webpack Encore is a simpler way to integrate Webpack into your application • Step forward after AsseticBundle • composer require webpack-encore • Works outside of Symfony Symfony Webpack Encore
  • 47.
  • 48.
  • 49. • Symfony on PHP 7.2 makes your code quite a bit faster than 7.1 • Symfony 2.3 is the second fastest Symfony release since 2.0 • Symfony 3.4 is the slowest release since 2.0 (deprecated features are probably one of the reasons); • Symfony 4.0 is almost three times faster as Laravel 5.5. Performance
  • 51. • It is possible, not so complex (depending on project) • It will take a little bit of time • Upgrade first to Symfony 3.4 Updating to Symfony4
  • 52. Symfony 4.3 (May 30, 2019)
  • 53.
  • 55. • It is a great feeling working with Symfony4 • Symfony has great community that is moving framework forward • Flex is amazing thing • New folder structure is more organised and more natural • Better standardisation A year later
  • 56. • Symfony is great as microframework • Higher level of abstraction is better for prototyping and building things faster • Very easy to start, but maybe new developers will think there is to much magic • Symfony as framework should not be a limitation for you A year later
  • 57.