A Gentle Introduction to Symfony

A Gentle Introduction to Symfony

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-2010-10-13 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 Database................................................................................................... 41 Application Creation........................................................................................................... 42 ----------------- Brought to you by Table of Contents iii Directory Structure Rights ................................................................................................. 42 Web Server Configuration ....................................................................................... 43 The ugly Way ...................................................................................................................... 43 The secure Way .................................................................................................................. 43 Using the Sandbox................................................................................................... 46 Summary.................................................................................................................. 47 Chapter 4: The Basics Of Page Creation......................................................... 48 Creating a Module Skeleton .................................................................................... 48 Adding a Page.......................................................................................................... 50 Adding an Action ................................................................................................................ 50 Adding a Template.............................................................................................................. 51 Passing Information from the Action to the Template ....................................................... 52 Linking to Another Action........................................................................................ 53 Getting Information from the Request .................................................................... 54 Summary.................................................................................................................. 55 Chapter 5: Configuring Symfony .................................................................... 56 The Configuration System ....................................................................................... 56 YAML Syntax and Symfony Conventions............................................................................ 57 Help, a YAML File Killed My App!...................................................................................... 60 Overview of the Configuration Files........................................................................ 61 Project Configuration ......................................................................................................... 61 Application Configuration .................................................................................................. 61 Module Configuration......................................................................................................... 63 Environments........................................................................................................... 64 What Is an Environment? ................................................................................................... 64 Configuration Cascade ....................................................................................................... 66 The Configuration Cache ......................................................................................... 68 Accessing the Configuration from Code .................................................................. 69 The sfConfig Class .......................................................................................................... 69 Custom Application Settings and app.yml ....................................................................... 70 Tips for Getting More from Configuration Files...................................................... 71 Using Constants in YAML Configuration Files................................................................... 71 Using Scriptable Configuration.......................................................................................... 72 Browsing Your Own YAML File .........................................................................................

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    397 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us