Symfony Principle

Symfony: Build your App, not your Tools?
You now know that the goal of any app is to interpret each incoming request and create an appropriate response. As an application grows, it becomes more difficult to keep your code organized and maintainable.Invariably, the same complex tasks keep coming up over and over again: persisting things to the database, rendering and reusing templates, handling form submissions, sending emails, validating user input and handling security.
The good news is that none of these problems is unique. Symfony provides a framework full of tools that allow you to build your application, not your tools. With Symfony, nothing is imposed on you: you're free to use the full Symfony Framework, or just one piece of Symfony all by itself.
Standalone Tools: The Symfony Components?
So what is Symfony? First, Symfony is a collection of over twenty independent libraries that can be used inside any PHP project. These libraries, called the Symfony Components, contain something useful for almost any situation, regardless of how your project is developed. To name a few:
HttpFoundation
Contains the Request

and Response

classes, as well as other classes for handling sessions and file uploads.
Routing
Powerful and fast routing system that allows you to map a specific URI (e.g. /contact

) to some information about how that request should be handled (e.g. execute the contactAction()

method).
Form
A full-featured and flexible framework for creating forms and handling form submissions.
Validator
A system for creating rules about data and then validating whether or not user-submitted data follows those rules.
Templating
A toolkit for rendering templates, handling template inheritance (i.e. a template is decorated with a layout) and performing other common template tasks.
Security
A powerful library for handling all types of security inside an application.
Translation
A framework for translating strings in your application.

Each one of these components is decoupled and can be used in any PHP project, regardless of whether or not you use the Symfony Framework. Every part is made to be used if needed and replaced when necessary.

The Full Solution: The Symfony Framework?
So then, what is the Symfony Framework? The Symfony Framework is a PHP library that accomplishes two distinct tasks:
Provides a selection of components (i.e. the Symfony Components) and third-party libraries (e.g. Swift Mailer for sending emails);
Provides sensible configuration and a "glue" library that ties all of these pieces together.

The goal of the framework is to integrate many independent tools in order to provide a consistent experience for the developer. Even the framework itself is a Symfony bundle (i.e. a plugin) that can be configured or replaced entirely.
Symfony provides a powerful set of tools for rapidly developing web applications without imposing on your application. Normal users can quickly start development by using a Symfony distribution, which provides a project skeleton with sensible defaults. For more advanced users, the sky is the limit.

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
  • 序言:七十年代末,一起剝皮案震驚了整個(gè)濱河市,隨后出現(xiàn)的幾起案子,更是在濱河造成了極大的恐慌湿弦,老刑警劉巖,帶你破解...
    沈念sama閱讀 219,490評(píng)論 6 508
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件贝咙,死亡現(xiàn)場(chǎng)離奇詭異虑啤,居然都是意外死亡,警方通過(guò)查閱死者的電腦和手機(jī)饱溢,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 93,581評(píng)論 3 395
  • 文/潘曉璐 我一進(jìn)店門喧伞,熙熙樓的掌柜王于貴愁眉苦臉地迎上來(lái),“玉大人绩郎,你說(shuō)我怎么就攤上這事潘鲫。” “怎么了肋杖?”我有些...
    開(kāi)封第一講書(shū)人閱讀 165,830評(píng)論 0 356
  • 文/不壞的土叔 我叫張陵溉仑,是天一觀的道長(zhǎng)。 經(jīng)常有香客問(wèn)我兽愤,道長(zhǎng)彼念,這世上最難降的妖魔是什么? 我笑而不...
    開(kāi)封第一講書(shū)人閱讀 58,957評(píng)論 1 295
  • 正文 為了忘掉前任浅萧,我火速辦了婚禮逐沙,結(jié)果婚禮上,老公的妹妹穿的比我還像新娘洼畅。我一直安慰自己吩案,他們只是感情好,可當(dāng)我...
    茶點(diǎn)故事閱讀 67,974評(píng)論 6 393
  • 文/花漫 我一把揭開(kāi)白布帝簇。 她就那樣靜靜地躺著徘郭,像睡著了一般。 火紅的嫁衣襯著肌膚如雪丧肴。 梳的紋絲不亂的頭發(fā)上残揉,一...
    開(kāi)封第一講書(shū)人閱讀 51,754評(píng)論 1 307
  • 那天,我揣著相機(jī)與錄音芋浮,去河邊找鬼抱环。 笑死,一個(gè)胖子當(dāng)著我的面吹牛纸巷,可吹牛的內(nèi)容都是我干的镇草。 我是一名探鬼主播,決...
    沈念sama閱讀 40,464評(píng)論 3 420
  • 文/蒼蘭香墨 我猛地睜開(kāi)眼瘤旨,長(zhǎng)吁一口氣:“原來(lái)是場(chǎng)噩夢(mèng)啊……” “哼梯啤!你這毒婦竟也來(lái)了?” 一聲冷哼從身側(cè)響起存哲,我...
    開(kāi)封第一講書(shū)人閱讀 39,357評(píng)論 0 276
  • 序言:老撾萬(wàn)榮一對(duì)情侶失蹤因宇,失蹤者是張志新(化名)和其女友劉穎七婴,沒(méi)想到半個(gè)月后,有當(dāng)?shù)厝嗽跇?shù)林里發(fā)現(xiàn)了一具尸體察滑,經(jīng)...
    沈念sama閱讀 45,847評(píng)論 1 317
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡本姥,尸身上長(zhǎng)有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 37,995評(píng)論 3 338
  • 正文 我和宋清朗相戀三年,在試婚紗的時(shí)候發(fā)現(xiàn)自己被綠了杭棵。 大學(xué)時(shí)的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片。...
    茶點(diǎn)故事閱讀 40,137評(píng)論 1 351
  • 序言:一個(gè)原本活蹦亂跳的男人離奇死亡氛赐,死狀恐怖魂爪,靈堂內(nèi)的尸體忽然破棺而出,到底是詐尸還是另有隱情艰管,我是刑警寧澤滓侍,帶...
    沈念sama閱讀 35,819評(píng)論 5 346
  • 正文 年R本政府宣布,位于F島的核電站牲芋,受9級(jí)特大地震影響撩笆,放射性物質(zhì)發(fā)生泄漏。R本人自食惡果不足惜缸浦,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 41,482評(píng)論 3 331
  • 文/蒙蒙 一夕冲、第九天 我趴在偏房一處隱蔽的房頂上張望。 院中可真熱鬧裂逐,春花似錦歹鱼、人聲如沸。這莊子的主人今日做“春日...
    開(kāi)封第一講書(shū)人閱讀 32,023評(píng)論 0 22
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽(yáng)。三九已至掺涛,卻和暖如春庭敦,著一層夾襖步出監(jiān)牢的瞬間,已是汗流浹背薪缆。 一陣腳步聲響...
    開(kāi)封第一講書(shū)人閱讀 33,149評(píng)論 1 272
  • 我被黑心中介騙來(lái)泰國(guó)打工秧廉, 沒(méi)想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留,地道東北人矮燎。 一個(gè)月前我還...
    沈念sama閱讀 48,409評(píng)論 3 373
  • 正文 我出身青樓定血,卻偏偏與公主長(zhǎng)得像,于是被迫代替她去往敵國(guó)和親诞外。 傳聞我的和親對(duì)象是個(gè)殘疾皇子澜沟,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 45,086評(píng)論 2 355

推薦閱讀更多精彩內(nèi)容