SlideShare uma empresa Scribd logo
1 de 39
Symfony2
PHP Framework
Turdaliev Nursultan
nursultan@gmail.com
Symfony at a Glance
• Symfony is a PHP framework.
• Symfony is a framework, a set of tools
and a development methodology.
A PHP framework
Basically, a framework consists of:
– A toolbox - a set of prefabricated, rapidly integratable software components. This
means that you will have to write less code, with less risk of error. This also
means greater productivity and the ability to devote more time to doing those
things which provide greater added value, such as managing guiding
principles, side effects, etc.
– A methodology – an “assembly diagram” for applications. A structured
approach may seem constraining at first. But in reality it allows developers to
work both efficiently and effectively on the most complex aspects of a task, and
the use of Best Practices guarantees the stability, maintainability and
upgradeability of the applications you develop
Symfony in 5 minutes
 Why should I use a framework?
 When should I use a framework?
 6 good reasons to use Symfony
 The technological benefits of Symfony in 6 easy lessons
 10 criteria for choosing the correct framework
Why should I use a framework?
A framework is not absolutely necessary: it is “just” one of the tools
that is available to help you develop better and faster!
Better, because a framework provides you with the certainty that you are
developing an application that is in full compliance with the business rules,
that is structured, and that is both maintainable and upgradable.
Faster, because it allows developers to save time by re-using generic modules
in order to focus on other areas. Without, however, ever being tied to the
framework itself.
Why should I use a framework?
To make long story short.
A framework is a pledge of quality, upgradability
and maintainability of applications at lower cost.
When should I use a framework?
• Well... Whenever you need to, while developing a web application or a site, of
course!
• Why would you have a custom piece of furniture made if you could find one
that perfectly matches your décor, right off the shelf? The same is true for
computer applications: Before you dive in to create a framework, a little survey
work is in order.
• Besides a framework, there are other solutions that are available to develop
both Web sites and Web applications: CMSs (Content Management System)
and their supplemental modules, as well as packaged professional solutions
(CRM, e-commerce solutions, etc.). If their native features line up perfectly
with your immediate and future needs, no question about it: Go for it! There is
no point in reinventing the wheel.
• On the other hand, when there are specific needs, specific business rules or
even the need to mix building blocks (content and e-commerce, for
example), a framework solution is necessary: it allows an application to be
developed that perfectly matches your current needs, while still being
innovative.
When should I use a framework?
To make long story short.
..but that is not always necessary, especially when
the requirements are of a more generic nature.
6 good reasons to use Symfony
Using a Framework is a good thing. Making the right
choice is even better. Without going too deep into things and in
no particular order, here are 6 good reasons to use Symfony, from
a strategic point of view
1. Reputation
2. Permanence
3. References
4. Innovation
5. Resources
http://symfony.com/six-good-reasons
6 good reasons to use Symfony
To make long story short.
10 criteria for choosing the correct
framework
You're making progress and that's a good
thing! You already know that you are going to
use a framework to develop your site or your
application. But which one? Here is a checklist
that you can use to avoid making a mistake:
Popularity and community size
The more well-known and recognized
the framework is, the more it will be
“living,” evolving and complete: new
ideas, the number and quality of plug-
ins, etc.
Philosophy
This is the very essence of the
framework: it is a fundamental criterion for
ensuring that it will meet your needs. A tool
developed by professionals for their own
needs will obviously meet the demands of
other professionals.
Sustainability
Before choosing a framework, make
sure that it will be able to keep up with you
for the duration. This simplifies both the
maintenance and upgrading of your
applications.
Support
Another criterion that should not be
overlooked is the ease of finding answers to
your questions and getting help. Identify the
support that is available: from the publisher.
From a community (mailing lists, IRC, etc.)?
From Service Companies
(development, support, training)?
Technique
To avoid becoming trapped in a
labyrinth, it is always preferable to choose
an interoperable solution; one that
respects best practices in terms of
development (design patterns)
Security
Any application is potentially
vulnerable. To minimize risk, it is always
better to select a framework capable of
ensuring security functions (XSS
management, for example).
Documentation
It is an absolute necessity to
evaluating the nature, volume and quality
of existing literature about a framework: a
well-documented tool is both easier to use
and more upgradeable.
License
Licenses are important simply because
they can have a significant impact on your
applications. For example, an application
developed using a GPL-licensed framework
will necessarily be subject to GPL. On the
other hand, this is not the case for an MIT-
licensed framework.
Availability of resources on the
market
Perhaps you would want to have a
technical team surround you during the
development phase or in the longer term, for
both maintenance and upgrades. In other
words, make sure that the skills required for
the tool that you are using are available on the
open market.
Try it out!
That's the key! Don't be satisfied with
reading reviews, comments and rumors, good
or bad, on the Internet. By testing it out, you
will be able to make up your own mind and
ensure that you are completely comfortable
with the tool..
To make long story short.
Ready?
Symfony2 and HTTP
Fundamentals
HTTP is Simple
HTTP (Hypertext Transfer Protocol to the geeks) is a text language that allows two
machines to communicate with each other. That's it! For example, when checking for
the latest xkcd comic, the following (approximate) conversation takes place:
Symfony2 is built from the
ground-up around that
reality. Whether you realize
it or not, HTTP is
something you use
everyday. With
Symfony2, you'll learn how
to master it.
Step1: The Client sends a Request
Every conversation on the web starts with a request. The request is a text message
created by a client (e.g. a browser, an iPhone app, etc) in a special format known
as HTTP. The client sends that request to a server, and then waits for the
response.
In HTTP-speak, this HTTP request would actually look something like this:
GET / HTTP/1.1
Host: xkcd.com Accept:text/html
User-Agent: Mozilla/5.0
(Macintosh)
Step1: The Client sends a Request
This simple message communicates everything necessary about exactly
which resource the client is requesting. The first line of an HTTP request is
the most important and contains two things: the URI and the HTTP method.
The URI (e.g. /, /contact, etc) is the unique address or location that
identifies the resource the client wants. The HTTP method (e.g. GET) defines
what you want to do with the resource.
Once a server has received the request, it knows exactly which resource the client
needs (via the URI) and what the client wants to do with that resource (via the method).
For example, in the case of a GET request, the server prepares the resource and returns it
in an HTTP response. Consider the response from the xkcd web server:
Step 2: The Server returns a Response
Translated into HTTP, the response sent back to the browser will look
something like this:
HTTP/1.1200 OK
Date: Sat, 02 Apr 2011 21:05:05 GMT Server : lighttpd/1.4.19
Content-Type: text/html
<html> <!-- ... HTML for the xkcd comic --> </html>
Step 2: The Server returns a Response
The HTTP response contains the requested resource (the HTML content in this case), as well as
other information about the response. The first line is especially important and contains the HTTP
response status code (200 in this case). The status code communicates the overall outcome of the
request back to the client. Was the request successful? Was there an error? Different status codes
exist that indicate success, an error, or that the client needs to do something (e.g. redirect to
another page). A full list can be found on Wikipedia's List of HTTP status codes article.
This request-response conversation is the fundamental process that drives all
communication on the web. And as important and powerful as this process is, it's
inescapably simple.
The most important fact is this: regardless of the language you use, the type of
application you build (web, mobile, JSON API), or the development philosophy you
follow, the end goal of an application is always to understand each request and
create and return the appropriate response.
Requests, Responses
and Web Development
Requests and Responses in PHP
So how do you interact with the "request" and create a "response" when using PHP?
In reality, PHP abstracts you a bit from the whole process:
Symfony provides an alternative to the raw PHP approach via two classes that allow you
to interact with the HTTP request and response in an easier way. The Request class is a
simple object-oriented representation of the HTTP request message. With it, you have all
the request information at your fingertips:
Requests and Responses in Symfony
Symfony also provides a Response class: a simple PHP representation of an HTTP
response message. This allows your application to use an object-oriented interface to
construct the response that needs to be returned to the client:
Requests and Responses in Symfony
Like HTTP itself, the Request and Response objects are pretty simple.
The hard part of building an application is writing what comes in between.
In other words, the real work comes in writing the code that interprets the
request information and creates the response.
Your application probably does many things, like sending emails,
handling form submissions, saving things to a database, rendering HTML
pages and protecting content with security. How can you manage all of this
and still keep your code organized and maintainable?
Symfony was created to solve these problems so that you don't have to.
The Journey from the Request to the Response
Traditionally, applications were built so that each "page" of a site was its own physical
file:
The Front Controller
There are several problems with this approach, including the
inflexibility of the URLs (what if you wanted to change blog.php to
news.php without breaking all of your links?) and the fact that each
file must manually include some set of core files so that security,
database connections and the "look" of the site can remain
consistent.
A much better solution is to use a front controller: a single PHP file that handles every
request coming into your application. For example:
Now, every request is handled exactly
the same way. Instead of individual URLs
executing different PHP files, the front
controller is always executed, and the
routing of different URLs to different
parts of your application is done
internally. This solves both problems
with the original approach. Almost all
modern web apps do this - including
apps like WordPress.
Stay Organized
Each "page" of your site is defined in a routing configuration file that maps different URLs to different PHP
functions. The job of each PHP function, called a controller, is to use information from the request - along
with many other tools Symfony makes available - to create and return a Response object. In other
words, the controller is where your code goes: it's where you interpret the request and create a response.
The Front Controller
To make long story short!
Installing and
Configuring Symfony
Installing a Symfony2 Distribution
First, check that you have installed and configured a Web server
(such as Apache) with PHP 5.3.8 or higher. For more information on
Symfony2 requirements, see the requirements reference

Mais conteúdo relacionado

Semelhante a Symfony2

COMPUTER APPLICATION PROJECT ON
COMPUTER APPLICATION PROJECT ON COMPUTER APPLICATION PROJECT ON
COMPUTER APPLICATION PROJECT ON Jitender Suryavansh
 
Open Source Content Management Systems for Small and Medium Businesses, Chari...
Open Source Content Management Systems for Small and Medium Businesses, Chari...Open Source Content Management Systems for Small and Medium Businesses, Chari...
Open Source Content Management Systems for Small and Medium Businesses, Chari...Will Hall
 
Day 2-presentation
Day 2-presentationDay 2-presentation
Day 2-presentationDeb Forsten
 
Outsourcing php india
Outsourcing php indiaOutsourcing php india
Outsourcing php indiataishaaben
 
Best PHP Frameworks 2013
Best PHP Frameworks 2013Best PHP Frameworks 2013
Best PHP Frameworks 2013itechroom
 
Open Source Project Management
Open Source Project ManagementOpen Source Project Management
Open Source Project ManagementSemen Arslan
 
Symfony framework-An overview and usability for web development
Symfony framework-An overview and usability for web developmentSymfony framework-An overview and usability for web development
Symfony framework-An overview and usability for web developmentifour_bhavesh
 
The Factors For The Website
The Factors For The WebsiteThe Factors For The Website
The Factors For The WebsiteJulie May
 
Characteristics of PHP web development services to boost productivity
Characteristics of PHP web development services to boost productivityCharacteristics of PHP web development services to boost productivity
Characteristics of PHP web development services to boost productivityJohn William
 
System design for Web Application
System design for Web ApplicationSystem design for Web Application
System design for Web ApplicationMichael Choi
 
Software design.edited (1)
Software design.edited (1)Software design.edited (1)
Software design.edited (1)FarjanaAhmed3
 
report_vendor_connect
report_vendor_connectreport_vendor_connect
report_vendor_connectYash Mittal
 
How to run an Enterprise PHP Shop
How to run an Enterprise PHP ShopHow to run an Enterprise PHP Shop
How to run an Enterprise PHP ShopJim Plush
 
Which Tools Are The Best For Symfony Projects_.pdf
Which Tools Are The Best For Symfony Projects_.pdfWhich Tools Are The Best For Symfony Projects_.pdf
Which Tools Are The Best For Symfony Projects_.pdfMoon Technolabs Pvt. Ltd.
 
Learn How To Develop With CakePHP
Learn How To Develop With CakePHPLearn How To Develop With CakePHP
Learn How To Develop With CakePHPMichael Bourque
 
Top 30 Scalability Mistakes
Top 30 Scalability MistakesTop 30 Scalability Mistakes
Top 30 Scalability MistakesJohn Coggeshall
 
Which Tools Are The Best For Symfony Projects_.pdf
Which Tools Are The Best For Symfony Projects_.pdfWhich Tools Are The Best For Symfony Projects_.pdf
Which Tools Are The Best For Symfony Projects_.pdfMoon Technolabs Pvt. Ltd.
 
Web Application Development Cost.pdf
Web Application Development Cost.pdfWeb Application Development Cost.pdf
Web Application Development Cost.pdfSimform
 

Semelhante a Symfony2 (20)

COMPUTER APPLICATION PROJECT ON
COMPUTER APPLICATION PROJECT ON COMPUTER APPLICATION PROJECT ON
COMPUTER APPLICATION PROJECT ON
 
Open Source Content Management Systems for Small and Medium Businesses, Chari...
Open Source Content Management Systems for Small and Medium Businesses, Chari...Open Source Content Management Systems for Small and Medium Businesses, Chari...
Open Source Content Management Systems for Small and Medium Businesses, Chari...
 
Day 2-presentation
Day 2-presentationDay 2-presentation
Day 2-presentation
 
Outsourcing php india
Outsourcing php indiaOutsourcing php india
Outsourcing php india
 
Best PHP Frameworks 2013
Best PHP Frameworks 2013Best PHP Frameworks 2013
Best PHP Frameworks 2013
 
Open Source Project Management
Open Source Project ManagementOpen Source Project Management
Open Source Project Management
 
Symfony framework-An overview and usability for web development
Symfony framework-An overview and usability for web developmentSymfony framework-An overview and usability for web development
Symfony framework-An overview and usability for web development
 
The Factors For The Website
The Factors For The WebsiteThe Factors For The Website
The Factors For The Website
 
Characteristics of PHP web development services to boost productivity
Characteristics of PHP web development services to boost productivityCharacteristics of PHP web development services to boost productivity
Characteristics of PHP web development services to boost productivity
 
Applications Report
Applications ReportApplications Report
Applications Report
 
System design for Web Application
System design for Web ApplicationSystem design for Web Application
System design for Web Application
 
Software design.edited (1)
Software design.edited (1)Software design.edited (1)
Software design.edited (1)
 
report_vendor_connect
report_vendor_connectreport_vendor_connect
report_vendor_connect
 
How to run an Enterprise PHP Shop
How to run an Enterprise PHP ShopHow to run an Enterprise PHP Shop
How to run an Enterprise PHP Shop
 
Which Tools Are The Best For Symfony Projects_.pdf
Which Tools Are The Best For Symfony Projects_.pdfWhich Tools Are The Best For Symfony Projects_.pdf
Which Tools Are The Best For Symfony Projects_.pdf
 
Learn How To Develop With CakePHP
Learn How To Develop With CakePHPLearn How To Develop With CakePHP
Learn How To Develop With CakePHP
 
Computer software specialists wikki verma
Computer software specialists   wikki vermaComputer software specialists   wikki verma
Computer software specialists wikki verma
 
Top 30 Scalability Mistakes
Top 30 Scalability MistakesTop 30 Scalability Mistakes
Top 30 Scalability Mistakes
 
Which Tools Are The Best For Symfony Projects_.pdf
Which Tools Are The Best For Symfony Projects_.pdfWhich Tools Are The Best For Symfony Projects_.pdf
Which Tools Are The Best For Symfony Projects_.pdf
 
Web Application Development Cost.pdf
Web Application Development Cost.pdfWeb Application Development Cost.pdf
Web Application Development Cost.pdf
 

Último

"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 

Último (20)

"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 

Symfony2

  • 2. Symfony at a Glance • Symfony is a PHP framework. • Symfony is a framework, a set of tools and a development methodology.
  • 3. A PHP framework Basically, a framework consists of: – A toolbox - a set of prefabricated, rapidly integratable software components. This means that you will have to write less code, with less risk of error. This also means greater productivity and the ability to devote more time to doing those things which provide greater added value, such as managing guiding principles, side effects, etc. – A methodology – an “assembly diagram” for applications. A structured approach may seem constraining at first. But in reality it allows developers to work both efficiently and effectively on the most complex aspects of a task, and the use of Best Practices guarantees the stability, maintainability and upgradeability of the applications you develop
  • 4. Symfony in 5 minutes  Why should I use a framework?  When should I use a framework?  6 good reasons to use Symfony  The technological benefits of Symfony in 6 easy lessons  10 criteria for choosing the correct framework
  • 5. Why should I use a framework? A framework is not absolutely necessary: it is “just” one of the tools that is available to help you develop better and faster! Better, because a framework provides you with the certainty that you are developing an application that is in full compliance with the business rules, that is structured, and that is both maintainable and upgradable. Faster, because it allows developers to save time by re-using generic modules in order to focus on other areas. Without, however, ever being tied to the framework itself.
  • 6. Why should I use a framework? To make long story short. A framework is a pledge of quality, upgradability and maintainability of applications at lower cost.
  • 7. When should I use a framework? • Well... Whenever you need to, while developing a web application or a site, of course! • Why would you have a custom piece of furniture made if you could find one that perfectly matches your décor, right off the shelf? The same is true for computer applications: Before you dive in to create a framework, a little survey work is in order. • Besides a framework, there are other solutions that are available to develop both Web sites and Web applications: CMSs (Content Management System) and their supplemental modules, as well as packaged professional solutions (CRM, e-commerce solutions, etc.). If their native features line up perfectly with your immediate and future needs, no question about it: Go for it! There is no point in reinventing the wheel. • On the other hand, when there are specific needs, specific business rules or even the need to mix building blocks (content and e-commerce, for example), a framework solution is necessary: it allows an application to be developed that perfectly matches your current needs, while still being innovative.
  • 8. When should I use a framework? To make long story short. ..but that is not always necessary, especially when the requirements are of a more generic nature.
  • 9. 6 good reasons to use Symfony Using a Framework is a good thing. Making the right choice is even better. Without going too deep into things and in no particular order, here are 6 good reasons to use Symfony, from a strategic point of view 1. Reputation 2. Permanence 3. References 4. Innovation 5. Resources http://symfony.com/six-good-reasons
  • 10. 6 good reasons to use Symfony To make long story short.
  • 11. 10 criteria for choosing the correct framework You're making progress and that's a good thing! You already know that you are going to use a framework to develop your site or your application. But which one? Here is a checklist that you can use to avoid making a mistake:
  • 12. Popularity and community size The more well-known and recognized the framework is, the more it will be “living,” evolving and complete: new ideas, the number and quality of plug- ins, etc.
  • 13. Philosophy This is the very essence of the framework: it is a fundamental criterion for ensuring that it will meet your needs. A tool developed by professionals for their own needs will obviously meet the demands of other professionals.
  • 14. Sustainability Before choosing a framework, make sure that it will be able to keep up with you for the duration. This simplifies both the maintenance and upgrading of your applications.
  • 15. Support Another criterion that should not be overlooked is the ease of finding answers to your questions and getting help. Identify the support that is available: from the publisher. From a community (mailing lists, IRC, etc.)? From Service Companies (development, support, training)?
  • 16. Technique To avoid becoming trapped in a labyrinth, it is always preferable to choose an interoperable solution; one that respects best practices in terms of development (design patterns)
  • 17. Security Any application is potentially vulnerable. To minimize risk, it is always better to select a framework capable of ensuring security functions (XSS management, for example).
  • 18. Documentation It is an absolute necessity to evaluating the nature, volume and quality of existing literature about a framework: a well-documented tool is both easier to use and more upgradeable.
  • 19. License Licenses are important simply because they can have a significant impact on your applications. For example, an application developed using a GPL-licensed framework will necessarily be subject to GPL. On the other hand, this is not the case for an MIT- licensed framework.
  • 20. Availability of resources on the market Perhaps you would want to have a technical team surround you during the development phase or in the longer term, for both maintenance and upgrades. In other words, make sure that the skills required for the tool that you are using are available on the open market.
  • 21. Try it out! That's the key! Don't be satisfied with reading reviews, comments and rumors, good or bad, on the Internet. By testing it out, you will be able to make up your own mind and ensure that you are completely comfortable with the tool..
  • 22. To make long story short.
  • 25. HTTP is Simple HTTP (Hypertext Transfer Protocol to the geeks) is a text language that allows two machines to communicate with each other. That's it! For example, when checking for the latest xkcd comic, the following (approximate) conversation takes place: Symfony2 is built from the ground-up around that reality. Whether you realize it or not, HTTP is something you use everyday. With Symfony2, you'll learn how to master it.
  • 26. Step1: The Client sends a Request Every conversation on the web starts with a request. The request is a text message created by a client (e.g. a browser, an iPhone app, etc) in a special format known as HTTP. The client sends that request to a server, and then waits for the response.
  • 27. In HTTP-speak, this HTTP request would actually look something like this: GET / HTTP/1.1 Host: xkcd.com Accept:text/html User-Agent: Mozilla/5.0 (Macintosh) Step1: The Client sends a Request This simple message communicates everything necessary about exactly which resource the client is requesting. The first line of an HTTP request is the most important and contains two things: the URI and the HTTP method. The URI (e.g. /, /contact, etc) is the unique address or location that identifies the resource the client wants. The HTTP method (e.g. GET) defines what you want to do with the resource.
  • 28. Once a server has received the request, it knows exactly which resource the client needs (via the URI) and what the client wants to do with that resource (via the method). For example, in the case of a GET request, the server prepares the resource and returns it in an HTTP response. Consider the response from the xkcd web server: Step 2: The Server returns a Response
  • 29. Translated into HTTP, the response sent back to the browser will look something like this: HTTP/1.1200 OK Date: Sat, 02 Apr 2011 21:05:05 GMT Server : lighttpd/1.4.19 Content-Type: text/html <html> <!-- ... HTML for the xkcd comic --> </html> Step 2: The Server returns a Response The HTTP response contains the requested resource (the HTML content in this case), as well as other information about the response. The first line is especially important and contains the HTTP response status code (200 in this case). The status code communicates the overall outcome of the request back to the client. Was the request successful? Was there an error? Different status codes exist that indicate success, an error, or that the client needs to do something (e.g. redirect to another page). A full list can be found on Wikipedia's List of HTTP status codes article.
  • 30. This request-response conversation is the fundamental process that drives all communication on the web. And as important and powerful as this process is, it's inescapably simple. The most important fact is this: regardless of the language you use, the type of application you build (web, mobile, JSON API), or the development philosophy you follow, the end goal of an application is always to understand each request and create and return the appropriate response. Requests, Responses and Web Development
  • 31. Requests and Responses in PHP So how do you interact with the "request" and create a "response" when using PHP? In reality, PHP abstracts you a bit from the whole process:
  • 32. Symfony provides an alternative to the raw PHP approach via two classes that allow you to interact with the HTTP request and response in an easier way. The Request class is a simple object-oriented representation of the HTTP request message. With it, you have all the request information at your fingertips: Requests and Responses in Symfony
  • 33. Symfony also provides a Response class: a simple PHP representation of an HTTP response message. This allows your application to use an object-oriented interface to construct the response that needs to be returned to the client: Requests and Responses in Symfony
  • 34. Like HTTP itself, the Request and Response objects are pretty simple. The hard part of building an application is writing what comes in between. In other words, the real work comes in writing the code that interprets the request information and creates the response. Your application probably does many things, like sending emails, handling form submissions, saving things to a database, rendering HTML pages and protecting content with security. How can you manage all of this and still keep your code organized and maintainable? Symfony was created to solve these problems so that you don't have to. The Journey from the Request to the Response
  • 35. Traditionally, applications were built so that each "page" of a site was its own physical file: The Front Controller There are several problems with this approach, including the inflexibility of the URLs (what if you wanted to change blog.php to news.php without breaking all of your links?) and the fact that each file must manually include some set of core files so that security, database connections and the "look" of the site can remain consistent. A much better solution is to use a front controller: a single PHP file that handles every request coming into your application. For example: Now, every request is handled exactly the same way. Instead of individual URLs executing different PHP files, the front controller is always executed, and the routing of different URLs to different parts of your application is done internally. This solves both problems with the original approach. Almost all modern web apps do this - including apps like WordPress.
  • 36. Stay Organized Each "page" of your site is defined in a routing configuration file that maps different URLs to different PHP functions. The job of each PHP function, called a controller, is to use information from the request - along with many other tools Symfony makes available - to create and return a Response object. In other words, the controller is where your code goes: it's where you interpret the request and create a response.
  • 37. The Front Controller To make long story short!
  • 39. Installing a Symfony2 Distribution First, check that you have installed and configured a Web server (such as Apache) with PHP 5.3.8 or higher. For more information on Symfony2 requirements, see the requirements reference