SlideShare a Scribd company logo
Symfony Nano Framework
It’s so minute it wouldn’t be able to cover a small water biscuit
Loïc Faugeronhttp://constant.co
@epiloic
Loïc Faugeron
gnugat
@epiloic
Blog - https://gnugat.github.io
2
Constant Commerce
Symfony 3, PHP 7, phpspec
@epiloic
Site - http://constant.co
3
Symfony Nano Framework
Micro
@epiloic4
1. Micro Framework?
2. Standard Edition
3. Symfony Flex
4. Empty Edition
5. Micro Framework Bundle
1. Micro Framework?
What does it mean for you?
@epiloic7
Examples
● Laravel: Lumen
● Zend: Expressive
● Symfony: ???
@epiloic8
Silex?
Bundles Incompatibility
@epiloic9
MicroKernelTrait?
Fabpot: It’s just a regular Kernel with some method
helpers [...] There’s nothing micro here
See Fabien’s comments - https://github.com/symfony/symfony/pull/15990#r40645358
@epiloic10
Symfony?
@epiloic11
● HttpKernel
● Routing
● DependencyInjection
● EventDispatcher
● Config
@epiloic12
Hello World
@epiloic13
Metrics
@epiloic14
API (usage in your app)
Number of steps to add new route
@epiloic15
Dependencies
composer show | wc -l
@epiloic16
Footprint
Apache Benchmark and Blackadder Blackfire
2. Standard Edition
Solves 80%, out of the box
@epiloic18
composer create-project symfony/framework-standard-edition
cd framework-standard-edition
@epiloic19
<?php
// src/AppBundle/Controller/DefaultController.php
namespace AppBundleController;
use SensioBundleFrameworkExtraBundleConfigurationRoute;
use SymfonyBundleFrameworkBundleControllerController;
use SymfonyComponentHttpFoundationRequest;
use SymfonyComponentHttpFoundationResponse;
class DefaultController extends Controller
{
/**
* @Route("/", name="homepage")
*/
public function indexAction(Request $request)
{
return new Response('Hello World');
}
}
@epiloic20
SYMFONY_ENV=prod composer update -oa --no-dev
php -S localhost:2502 -t web &
curl 'http://localhost:2502/app.php'
ab -c 10 -t 10 'http://localhost:2502/app.php'
killall php
@epiloic21
Results
● API: 1 step to add new route
● Dependencies: 85 (34 + 51)
● Footprint: 400 req / s
@epiloic22
3. Symfony Flex
Add what you need
@epiloic24
composer create-project symfony/skeleton:3.3.x-dev
cd skeleton
composer require symfony/dotenv
@epiloic25
# .env
###> symfony/framework-bundle ###
APP_ENV=prod
APP_DEBUG=0
APP_SECRET=31611929636ceb325e27091c2856ab8b
###< symfony/framework-bundle ###
@epiloic26
<?php
// src/Controller/HelloController.php
namespace AppController;
use SymfonyComponentHttpFoundationRequest;
use SymfonyComponentHttpFoundationResponse;
class HelloController
{
public function world(Request $request)
{
return new Response('Hello World');
}
}
@epiloic27
# etc/routing.yaml
hello_world:
path: /
defaults:
_controller: ‘AppControllerHelloController:world’
methods:
- GET
@epiloic28
composer update -oa --no-dev
php -S localhost:2504 -t web &
curl 'http://localhost:2504/index.php'
ab -c 10 -t 10 'http://localhost:2504/index.php'
killall php
@epiloic29
Results
● API: 2 steps to add new route [+1]
● Dependencies: 28 [/3]
● Footprint: 950 req / s [x2.5]
@epiloic30
@epiloic31
4. Empty Edition
Add what you need
@epiloic33
composer create-project gnugat/symfony-empty-edition
cd symfony-empty-edition
@epiloic34
<?php
// src/AppBundle/Controller/HelloController.php
namespace AppBundleController;
use SymfonyComponentHttpFoundationRequest;
use SymfonyComponentHttpFoundationResponse;
class HelloController
{
public function world(Request $request)
{
return new Response('Hello World');
}
}
@epiloic35
# app/config/services/controller.yml
services:
app.hello_controller:
class: ‘AppBundleControllerHelloController’
@epiloic36
# app/config/routings/app.yml
hello_world:
path: /
defaults:
_controller: app.hello_controller:world
methods:
- GET
@epiloic37
SYMFONY_ENV=prod composer update -oa --no-dev
php -S localhost:2503 -t web &
curl 'http://localhost:2503/app.php'
ab -c 10 -t 10 'http://localhost:2503/app.php'
killall php
@epiloic38
Results
● API: 3 steps to add new route [+1]
● Dependencies: 25 [/1.1]
● Footprint: 1 000 req / s [x1.1]
@epiloic39
@epiloic40
5. MicroFrameworkBundle
Add what you need++
@epiloic42
composer require gnugat/micro-framework-bundle
composer remove symfony/framework-bundle
@epiloic43
<?php
// app/AppKernel.php
use SymfonyComponentHttpKernelKernel;
use SymfonyComponentConfigLoaderLoaderInterface;
class AppKernel extends Kernel
{
public function registerBundles()
{
return array(
new GnugatMicroFrameworkBundleGnugatMicroFrameworkBundle(),
new AppBundleAppBundle(),
);
}
// ...
}
@epiloic44
# app/config/config.yml
imports:
- { resource: parameters.yml }
- { resource: services/ }
@epiloic45
rm -rf var/*
SYMFONY_ENV=prod composer update -o --no-dev
php -S localhost:2505 -t web &
curl 'http://localhost:2505/app.php'
ab -c 10 -t 10 'http://localhost:2505/app.php'
killall php
@epiloic46
@epiloic47
Results
● API: 3 steps to add new route [0]
● Dependencies: 16 [/1.5]
● Footprint: 1 200 req / s [x1.2]
Conclusion
@epiloic49
Questions?
@epiloic50
Resources
Blackadder II
Blackadder the Third
Blackadder goes forth
http://gnugat.github.io/micro-framework-bundle/

More Related Content

PDF
Console Apps: php artisan forthe:win
PDF
Plone and docker
PPTX
Flask vs. Django
PPTX
Laravel Beginners Tutorial 1
PPTX
Composer Lightning Talk
PPTX
10 Laravel packages everyone should know
PPTX
Laravel for Web Artisans
PDF
Flask Introduction - Python Meetup
Console Apps: php artisan forthe:win
Plone and docker
Flask vs. Django
Laravel Beginners Tutorial 1
Composer Lightning Talk
10 Laravel packages everyone should know
Laravel for Web Artisans
Flask Introduction - Python Meetup

What's hot (20)

PPTX
Workshop Laravel 5.2
PPTX
PDF
All the Laravel things: up and running to making $$
PPTX
Using Visual Studio to build XAML Universal Apps
PDF
Php phalcon - Another approach to develop website - Techcamp Saigon 2014
PPTX
Intro to Laravel
PPT
How Danga::Socket handles asynchronous processing and how to write asynchrono...
PDF
WP Weekend #2 - Corcel, aneb WordPress přes Laravel
PDF
php[world] 2015 Laravel 5.1: From Homestead to the Cloud
PDF
The Symfony CLI
PPT
Going serverless with Fn project, Fn Flow and Kubernetes
PDF
Knowing Laravel 5 : The most popular PHP framework
PDF
Python Flask app deployed to OPenShift using Wercker CI
PDF
Why Laravel?
PPTX
How to install laravel framework in windows
PDF
Laravel Code Generators and Packages
PPTX
Creating your own framework on top of Symfony2 Components
PDF
Hands-on with the Symfony2 Framework
KEY
Pinto+Stratopan+Love
PDF
Phalcon / Zephir Introduction at PHPConfTW2013
Workshop Laravel 5.2
All the Laravel things: up and running to making $$
Using Visual Studio to build XAML Universal Apps
Php phalcon - Another approach to develop website - Techcamp Saigon 2014
Intro to Laravel
How Danga::Socket handles asynchronous processing and how to write asynchrono...
WP Weekend #2 - Corcel, aneb WordPress přes Laravel
php[world] 2015 Laravel 5.1: From Homestead to the Cloud
The Symfony CLI
Going serverless with Fn project, Fn Flow and Kubernetes
Knowing Laravel 5 : The most popular PHP framework
Python Flask app deployed to OPenShift using Wercker CI
Why Laravel?
How to install laravel framework in windows
Laravel Code Generators and Packages
Creating your own framework on top of Symfony2 Components
Hands-on with the Symfony2 Framework
Pinto+Stratopan+Love
Phalcon / Zephir Introduction at PHPConfTW2013
Ad

Similar to Symfony Nano Framework (20)

PDF
Symfony: Your Next Microframework (SymfonyCon 2015)
ODP
An introduction to Symfony 2 for symfony 1 developers
PDF
Symfony 4: A new way to develop applications #ipc19
PDF
Symfony2 revealed
PDF
Symfony 4: A new way to develop applications #phpsrb
PDF
Symfony2 San Francisco Meetup 2009
PDF
The Naked Bundle - Tryout
PDF
The Naked Bundle - Symfony Barcelona
PDF
The Naked Bundle - Symfony Usergroup Belgium
PDF
Build powerfull and smart web applications with Symfony2
PDF
Symfony internals [english]
PDF
The Naked Bundle - Symfony Live London 2014
PDF
Silex Cheat Sheet
PDF
Silex Cheat Sheet
PDF
Symfony2 - WebExpo 2010
PDF
Symfony2 - WebExpo 2010
PDF
Symfony4: A new way to develop applications | Antonio Peric | CODEiD
PDF
PHP Frameworks and Symfony
PDF
Symfony 2 (PHP Quebec 2009)
PDF
Symfony4 - A new way of developing web applications
Symfony: Your Next Microframework (SymfonyCon 2015)
An introduction to Symfony 2 for symfony 1 developers
Symfony 4: A new way to develop applications #ipc19
Symfony2 revealed
Symfony 4: A new way to develop applications #phpsrb
Symfony2 San Francisco Meetup 2009
The Naked Bundle - Tryout
The Naked Bundle - Symfony Barcelona
The Naked Bundle - Symfony Usergroup Belgium
Build powerfull and smart web applications with Symfony2
Symfony internals [english]
The Naked Bundle - Symfony Live London 2014
Silex Cheat Sheet
Silex Cheat Sheet
Symfony2 - WebExpo 2010
Symfony2 - WebExpo 2010
Symfony4: A new way to develop applications | Antonio Peric | CODEiD
PHP Frameworks and Symfony
Symfony 2 (PHP Quebec 2009)
Symfony4 - A new way of developing web applications
Ad

Recently uploaded (20)

PPTX
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
PPTX
Recipes for Real Time Voice AI WebRTC, SLMs and Open Source Software.pptx
PPTX
CH1 Production IntroductoryConcepts.pptx
PPTX
Internet of Things (IOT) - A guide to understanding
PPTX
Geodesy 1.pptx...............................................
DOCX
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
PPTX
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
PPTX
Lecture Notes Electrical Wiring System Components
PDF
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
PDF
Operating System & Kernel Study Guide-1 - converted.pdf
PPTX
additive manufacturing of ss316l using mig welding
PPTX
UNIT-1 - COAL BASED THERMAL POWER PLANTS
DOCX
573137875-Attendance-Management-System-original
PDF
Automation-in-Manufacturing-Chapter-Introduction.pdf
PDF
Evaluating the Democratization of the Turkish Armed Forces from a Normative P...
PDF
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
PDF
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
PPTX
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
PDF
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
PPT
CRASH COURSE IN ALTERNATIVE PLUMBING CLASS
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
Recipes for Real Time Voice AI WebRTC, SLMs and Open Source Software.pptx
CH1 Production IntroductoryConcepts.pptx
Internet of Things (IOT) - A guide to understanding
Geodesy 1.pptx...............................................
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
Lecture Notes Electrical Wiring System Components
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
Operating System & Kernel Study Guide-1 - converted.pdf
additive manufacturing of ss316l using mig welding
UNIT-1 - COAL BASED THERMAL POWER PLANTS
573137875-Attendance-Management-System-original
Automation-in-Manufacturing-Chapter-Introduction.pdf
Evaluating the Democratization of the Turkish Armed Forces from a Normative P...
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
CRASH COURSE IN ALTERNATIVE PLUMBING CLASS

Symfony Nano Framework