You are on page 1of 3

Symfony Framework

Informacintomadadehttp://symfony.com/ataglance
Versinalmomentodeescribir:2.4.2
APHPframework
Inordertobetterunderstandwhataframeworkis,letsleavetheworldofcomputersciencefora
momentandimagineamountaineeringadventure.Developinganapplicationisverysimilarto
climbingarockwall:youareatthebottom(youhaveanapplicationtobecreated)andyouneed
toreachthesummit(andbepleasedwiththeachievementofdesigninganapplicationthat
worksperfectly.)

Ifnoonehaseverclimbedthewallinquestion,youwillhavetogetbyonyourown:testing
routes,occasionallybacktrackingsothatyoudontgetstuckinacorner,drivinginpitons,etc.In
contrast,ifthewallhasalreadybeenconquered,thosewhohavegonebeforeyouwillalready
havedonethistrialanderrorwork,openinguppossiblepaths(theframe)andinstallingthetools
thatwillfacilitatetheclimb(yourwork).
Basically,aframeworkconsistsof:

Atoolboxasetofprefabricated,rapidlyintegratablesoftwarecomponents.Thismeans
thatyouwillhavetowritelesscode,withlessriskoferror.Thisalsomeansgreater
productivityandtheabilitytodevotemoretimetodoingthosethingswhichprovide
greateraddedvalue,suchasmanagingguidingprinciples,sideeffects,etc.

Amethodologyanassemblydiagramforapplications.Astructuredapproachmay
seemconstrainingatfirst.Butinrealityitallowsdeveloperstoworkbothefficientlyand
effectivelyonthemostcomplexaspectsofatask,andtheuseofBestPractices
guaranteesthestability,maintainabilityandupgradeabilityoftheapplicationsyoudevelop.

Andalthoughitmightbeobvious,wethoughtitbesttosayitanywaySymfonyisaPHP
framework,whichmeansthatitpermitswebapplicationstobebuiltinPHP!
The technological benefits of Symfony in 6 easy lessons
Referencia:http://symfony.com/sixtechnicalreasons

Faster and less greedy


Symfony2wasconceivedfromthestarttobefastandtofavorperformance.Bywayof
comparison,Symfony2isabout3timesfasterthanVersion1.4orthanZendFramework1.10,
whiletakingup2timeslessmemory.
DocumentocreadoporFranciscoQuintero
Unlimited flexibility
1. FullStack(completeversion):youwanttodevelopacomplexapplicationandyouneed
manyfunctionalities.
2. Brickbybrick:youbuildyourframeworkaccordingtothefunctionalitiesthatyouwillneed.
3. Microframework:asastandalone,Symfony2canalsobeusedtodevelopaspecific
functionalityinoneofyourprojects.Withouthavingtoredevelopeverythingandwithout
installingtheentireframework,butonlythespecificbrickthatyouneed.

Expandable
Fromthesmallestbricktothecompletecoreitself,everythingispresentedasabundle(or
plugininSymfonylanguage)inSymfony2.Eachbundleisintendedtoaddfunctionalitytothe
framework,ofcourse,andeachbundlecanalsobereusedinanotherprojectorsharedwiththe
restofthecommunity.
Stable and sustainable
DevelopedbySensioLabs,majorversionsofSymfonyareallsupportedfor3yearsbythe
company.Andevenforlifeasfarassecurityrelatedissuesareconcerned.
Forevengreaterstability,theminorversionsofSymfony2scontractandinterfacearealso
guaranteedandcompatibilitybetweenallminorversionswillbeensuredontheAPIdefinedby
thepublicinterfaces.
The joy of developing
Bytakingcareofanumberofunpleasanttasks(developmentofminorfunctionalities,for
example),Symfony2allowsdeveloperstofocusontheactualhighlightsofanapplicationandto
bothfullyvalidatetheirroleandimprovetheirproductivity.
Ease of use
Completelyflexibletosatisfytheneedsofprofessionalsandadvancedusersalike,Symfony2is
alsoveryaccessible.Plentifuldocumentation,communityandprofessionalsupport,and
embeddedbestpracticeswithintheframework(bestpracticesthatarenativelyappliedwithout
havingtobeawareofthemorunderstandingthem)allowabeginnertoveryquicklyfeelatease
withSymfony.

Ejemplos de cdigo
Controllers
AcontrollerisafancynameforaPHPfunctionormethodthathandlesincomingrequestsand
returnsresponses(oftenHTMLcode).InsteadofusingthePHPglobalvariablesandfunctions
(like$_GETorheader())tomanagetheseHTTPmessages,Symfonyusesobjects:Request
andResponse.Thesimplestpossiblecontrollermightcreatetheresponsebyhand,basedon
DocumentocreadoporFranciscoQuintero
therequest:

//src/Acme/DemoBundle/Controller/WelcomeController.php
namespaceAcme\DemoBundle\Controller

useSymfony\Bundle\FrameworkBundle\Controller\Controller

classWelcomeControllerextendsController
{
publicfunctionindexAction()
{
return$this>render('AcmeDemoBundle:Welcome:index.html.twig')
}
}

publicfunctionindexAction()
{
$response=$this>render('AcmeDemoBundle:Welcome:index.txt.twig')
$response>headers>set('ContentType','text/plain')

return$response
}

Templates
Thecontrollerrendersthesrc/Acme/DemoBundle/Resources/views/Demo/hello.html.twig
template(orAcmeDemoBundle:Demo:hello.html.twigifyouusethelogicalname):

{#src/Acme/DemoBundle/Resources/views/Demo/hello.html.twig#}
{%extends"AcmeDemoBundle::layout.html.twig"%}

{%blocktitle"Hello"~name%}

{%blockcontent%}
<h1>Hello{{name}}!</h1>
{%endblock%}

Referencias
LibrodeSymfony
SymfonyCookbook
DocumentocreadoporFranciscoQuintero

You might also like