introduzione pratica a symfony
DESCRIPTION
Alessio Barnini @ Drupal Days 2014 code: https://github.com/IbuildingsItaly/drupal-days-code-symfony-introductionTRANSCRIPT
![Page 1: Introduzione pratica a Symfony](https://reader034.vdocuments.net/reader034/viewer/2022052522/554bcd60b4c9058f6c8b4894/html5/thumbnails/1.jpg)
INTRODUZIONE PRATICA A SYMFONY
![Page 2: Introduzione pratica a Symfony](https://reader034.vdocuments.net/reader034/viewer/2022052522/554bcd60b4c9058f6c8b4894/html5/thumbnails/2.jpg)
ALESSIO BARNINIhttp://it.linkedin.com/in/alessiobarnini
@barno7
https://github.com/IbuildingsItaly/drupal-days-code-symfony-introduction
![Page 3: Introduzione pratica a Symfony](https://reader034.vdocuments.net/reader034/viewer/2022052522/554bcd60b4c9058f6c8b4894/html5/thumbnails/3.jpg)
#DrupalDaysIT
• Un framework.
• Un insieme di strumenti.
• Una metodologia di sviluppo.
• Una filosofia.
• Una comunità.
CHE COSA E’ SYMFONY
![Page 4: Introduzione pratica a Symfony](https://reader034.vdocuments.net/reader034/viewer/2022052522/554bcd60b4c9058f6c8b4894/html5/thumbnails/4.jpg)
#DrupalDaysIT
• + Bundle
• + documentato
• + supporto
• + sicurezza
• amico di Drupal ^_^
PERCHÈ SCEGLIERE SYMFONY
![Page 5: Introduzione pratica a Symfony](https://reader034.vdocuments.net/reader034/viewer/2022052522/554bcd60b4c9058f6c8b4894/html5/thumbnails/5.jpg)
#DrupalDaysIT
• Client Server
• Client Server
• Il “lavoro sporco” è fatto dal front controller.
COME “FUNZIONA” ?
![Page 6: Introduzione pratica a Symfony](https://reader034.vdocuments.net/reader034/viewer/2022052522/554bcd60b4c9058f6c8b4894/html5/thumbnails/6.jpg)
#DrupalDaysIT
Ogni richiesta esegue un file Front Controller!
Il sistema delle rotte determina quale funzione PHP deve essere eseguita
IL FLUSSO DI UN’APPLICAZIONE
![Page 7: Introduzione pratica a Symfony](https://reader034.vdocuments.net/reader034/viewer/2022052522/554bcd60b4c9058f6c8b4894/html5/thumbnails/7.jpg)
#DrupalDaysIT!
!
La giusta funzione PHP è eseguita, con il proprio codice che crea e restituisce l'oggetto Response appropriato.
IL FLUSSO DI UN’APPLICAZIONE
![Page 8: Introduzione pratica a Symfony](https://reader034.vdocuments.net/reader034/viewer/2022052522/554bcd60b4c9058f6c8b4894/html5/thumbnails/8.jpg)
#DrupalDaysITDOCTRINE
• Symfony utilizza Doctrine
• E’ un ORM (Object-Relational Mapping).
• Potenti Strumenti di mappatura
![Page 9: Introduzione pratica a Symfony](https://reader034.vdocuments.net/reader034/viewer/2022052522/554bcd60b4c9058f6c8b4894/html5/thumbnails/9.jpg)
#DrupalDaysITTWIG
• Symfony utilizza Twig
• Twig è un template engine
• Sviluppato da SensioLab
![Page 10: Introduzione pratica a Symfony](https://reader034.vdocuments.net/reader034/viewer/2022052522/554bcd60b4c9058f6c8b4894/html5/thumbnails/10.jpg)
#DrupalDaysIT
• E’ un tool che permette una gestione efficace delle dipendenze
• Gestisce l’autoloading e i namespace
• Permette quindi di installare facilmente i Vendor
COMPOSER
![Page 11: Introduzione pratica a Symfony](https://reader034.vdocuments.net/reader034/viewer/2022052522/554bcd60b4c9058f6c8b4894/html5/thumbnails/11.jpg)
#DrupalDaysITCOMPOSER
• Si installa con!
• Viene creato un composer.json
•
• Grazie a composer possiamo installare facilmente Symfony
curl -sS https://getcomposer.org/installer | php
composer install
![Page 12: Introduzione pratica a Symfony](https://reader034.vdocuments.net/reader034/viewer/2022052522/554bcd60b4c9058f6c8b4894/html5/thumbnails/12.jpg)
#DrupalDaysIT
• I Vendor sono dipendenze di Symfony
• Quindi anche i bundle di terze parti
• Un bundle è una cartella con un insieme di file che implementa una singola caratteristica
VENDOR
![Page 13: Introduzione pratica a Symfony](https://reader034.vdocuments.net/reader034/viewer/2022052522/554bcd60b4c9058f6c8b4894/html5/thumbnails/13.jpg)
#DrupalDaysITINSTALLARE SYMFONY
curl -sS https://getcomposer.org/installer | php• Installare Composer
!
• Installare Symfony
!php composer.phar create-project symfony/framework-standard-edition path/ 2.4.3
![Page 14: Introduzione pratica a Symfony](https://reader034.vdocuments.net/reader034/viewer/2022052522/554bcd60b4c9058f6c8b4894/html5/thumbnails/14.jpg)
#DrupalDaysITINSTALLARE SYMFONY
![Page 15: Introduzione pratica a Symfony](https://reader034.vdocuments.net/reader034/viewer/2022052522/554bcd60b4c9058f6c8b4894/html5/thumbnails/15.jpg)
#DrupalDaysITINSTALLARE SYMFONY
![Page 16: Introduzione pratica a Symfony](https://reader034.vdocuments.net/reader034/viewer/2022052522/554bcd60b4c9058f6c8b4894/html5/thumbnails/16.jpg)
#DrupalDaysITINSTALLARE SYMFONY
a fine installazione collegandosi a localhost/config.php è possibile verificare la corretta installazione !
![Page 17: Introduzione pratica a Symfony](https://reader034.vdocuments.net/reader034/viewer/2022052522/554bcd60b4c9058f6c8b4894/html5/thumbnails/17.jpg)
#DrupalDaysITGLI AMBIENTI
In Symfony ci sono 3 Ambienti. Dev - Prod e Test.Ogni ambiente carica una propria configurazione.
per l'ambiente dev: app/config/config_dev.yml
per l'ambiente prod: app/config/config_prod.yml
per l'ambiente test: app/config/config_test.yml
![Page 18: Introduzione pratica a Symfony](https://reader034.vdocuments.net/reader034/viewer/2022052522/554bcd60b4c9058f6c8b4894/html5/thumbnails/18.jpg)
SPONSOR
MEDIA PARTNER