Nov 23, 2010 - the request (HTTP, console mode, mail, and so on) from the model and the ...... href="http://localhost/fr
A Gentle Introduction to symfony
Build professional websites faster with PHP and symfony
symfony 1.3 & 1.4
This PDF is brought to you by
License: GFDL Version: gentle-introduction-1.4-en-2012-11-09
Table of Contents
ii
Table of Contents Chapter 1: Introducing Symfony..................................................................... 11 Symfony in Brief ...................................................................................................... 11 Symfony Features............................................................................................................... 11 Who Made Symfony and Why? ........................................................................................... 12 The Symfony Community.................................................................................................... 13 Is Symfony for Me?............................................................................................................. 14
Fundamental Concepts ............................................................................................ 14 PHP..................................................................................................................................... 14 Object-Oriented Programming (OOP) ................................................................................ 14 Magic Methods ................................................................................................................... 15 Object-Relational Mapping (ORM) ..................................................................................... 15 Rapid Application Development (RAD)............................................................................... 16 YAML .................................................................................................................................. 17
Summary.................................................................................................................. 18 Chapter 2: Exploring Symfony’s Code............................................................. 19 The MVC Pattern ..................................................................................................... 19 MVC Layering..................................................................................................................... 20 Layer Separation Beyond MVC .......................................................................................... 23 Symfony’s MVC Implementation ........................................................................................ 26 Symfony Core Classes ........................................................................................................ 28
Code Organization ................................................................................................... 29 Project Structure: Applications, Modules, and Actions...................................................... 29 File Tree Structure ............................................................................................................. 29
Common Instruments .............................................................................................. 33 Parameter Holders ............................................................................................................. 33 Constants............................................................................................................................ 35 Class Autoloading ............................................................................................................... 35
Summary.................................................................................................................. 36 Chapter 3: Running Symfony .......................................................................... 37 Prerequisites............................................................................................................ 37 Third-Party Software .......................................................................................................... 37 Command Line Interface .................................................................................................... 37 PHP Configuration.............................................................................................................. 38
Symfony Installation ................................................................................................ 38 Initializing the Project Directory ........................................................................................ 38 Choosing the Symfony Version........................................................................................... 39 Choosing the Symfony Installation Location ...................................................................... 39 Installing Symfony .............................................................................................................. 39
Project Setup ........................................................................................................... 41 Project Creation ................................................................................................................. 41 Configuring the > I never say my name
Listing 4-14
To avoid this hassle, you should always use the link_to() helper to create hyperlinks to your application’s actions. And if you only want to generate the URL part, the url_for() is the helper you’re looking for. A helper is a PHP function defined by symfony that is meant to be used within templates. It outputs some HTML code and is faster to use than writing the actual HTML code by yourself. Listing 4-9 demonstrates the use of the hyperlink helpers. Listing 4-9 - The link_to(), and url_for() Helpers
Hello, world!
Or should I say good evening? It is already .