O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Symfony 1.3 Web Application Development

Book Description

Design, develop, and deploy feature-rich, high-performance PHP web applications using the Symfony framework

  • Create powerful web applications by leveraging the power of this Model-View-Controller-based framework

  • Covers all the new features of version 1.3 – many exciting plug-ins for you

  • Learn by doing without getting into too much theoretical detail – create a "real-life" milkshake store application

  • Includes best practices to shorten your development time and improve performance

In Detail

With its flexible architecture, the Symfony framework allows you to build modern web applications and web services easily and rapidly. The MVC components separate the logic from the user interface and therefore make developing, changing, and testing your applications much faster. Using Symfony you can minimize repetitive coding tasks, optimize performance, and easily integrate with other libraries and frameworks.

Although this framework contains with many powerful features, most developers do not exploit Symfony to its full potential.

This book makes it easy to get started and produce a powerful and professional-looking web site utilizing the many features of Symfony. Taking you through a real-life application, it covers all major Symfony framework features without pushing you into too much theoretical detail, as well as throwing some light on the best practices for rapid application development.

This book takes you through detailed examples as well as covering the foundations that you will need to get the most out of the Symfony framework. You will learn to shorten the development time of your complex applications and maintain them with ease. You will create several useful plug-ins and add them to your application and automate common tasks. The book also covers best practices and discussions on security and optimization. You will learn to utilize all major features of this framework by implementing them in your application.

By the end, you should have a good understanding of the development features of Symfony (for Propel as well as Doctrine editions), and be able to deploy a high-performance web site quite easily.

Table of Contents

  1. Symfony 1.3 Web Application Development
    1. Table of Contents
    2. Symfony 1.3 Web Application Development
    3. Credits
    4. About the Authors
    5. About the Reviewer
    6. Preface
      1. What this book covers
      2. What you need for this book
      3. Who this book is for
      4. Conventions
      5. Reader feedback
      6. Customer support
        1. Downloading the example code for the book
        2. Errata
        3. Piracy
        4. Questions
    7. 1. Getting Started with Symfony
      1. Exploring Symfony
        1. The framework
          1. The Model-View-Controller pattern
            1. Controller
            2. Model
        2. Taking a look at the key features
          1. Forms and validation
          2. Plugins
          3. Internationalization and localization
          4. Generators
          5. Cache
          6. Testing
          7. Configuration files
      2. Coding guidelines
        1. Symfony-specific guidelines
      3. Installing Symfony
      4. Summary
    8. 2. Developing Our Application
      1. The milkshake shop
        1. Creating the skeleton folder structure
        2. Creating our database schema
        3. Configuring the ORM layer
          1. Configuring the database connection
            1. Using another database engine
        4. Generating the models, forms, and filters
        5. Building the database
          1. Creating the application modules
        6. Handling the routing
        7. The application logic
          1. Rendering the template
          2. Adding our routing rules
          3. Configuring template parameters
          4. Styling the pages
        8. Common installation problems
          1. Web server 404 error page
          2. A symfony 'Oop! An error occurred'
          3. Pages and debug bar do not render correctly
      2. Summary
    9. 3. Adding the Business Logic and Complex Application Logic
      1. The generated models
        1. Populating the database
      2. Retrieving data using the models
          1. Defining the criteria
          2. Hydration
      3. Retrieving the result set from the action
        1. The template logic
          1. Returned results
          2. Using the DAOs
          3. Displaying the results
        2. Helpers
        3. Paginating our menu
          1. Adding the pager business logic
          2. Setting a configuration option
        4. Amending the action
          1. Accessing the $_POST, $_GET, and $_REQUEST variables
          2. Accessing the application and module configuration file
          3. Building up the routing
          4. Organizing a template with partials
        5. Creating the milkshake page
          1. Routing with an object
          2. Adding the route to the template
          3. Retrieving many-to-many results
          4. Accessing related objects in the action
          5. Accessing related objects in the templates
      4. Plugins
        1. DbFinderPlugin
          1. Finishing off the location page
            1. Summary
    10. 4. User Interaction and Email Automation
      1. The signup module
      2. Binding a form to a database table
        1. A look at the generated base class
        2. Rendering the form
        3. Customizing form widgets and validators
          1. Removing unneeded fields
          2. Modifying the form widgets
          3. Adding form validators
          4. Form naming convention and setting its style
      3. Submitting the form
      4. Changing the global rendering of forms
      5. Customizing the rendering of the form
        1. Form security for the user
      6. Creating a simple form
      7. Automated email responses
        1. Adding the mailer settings to the application
        2. Creating the application logic
        3. The partial email template
      8. Flashing temporary values
      9. Creating a plugin
      10. Packaging a plugin
      11. Summary
    11. 5. Generating the Admin Area
      1. How Symfony can help us
      2. Initializing generator
        1. Creating application and module
        2. Exploring list view
          1. Looking into the generated list view code
      3. Customizing the admin generator
        1. Customizing the edit view
      4. Handling foreign keys using admin generator
        1. Accessing application settings from generator.yml
        2. Using partials in the generated views
      5. Customizing the layout
      6. Securing the application
        1. Setting up credentials (permissions)
        2. Handling credentials in templates
        3. Tidying up the backend
      7. Summary
    12. 6. Advanced Forms and JavaScript
      1. Adding JavaScript code into the Symfony project
        1. JavaScript frameworks
        2. Using JavaScript helpers
        3. Adding JavaScript files into the header section
      2. Creating more advanced admin modules
        1. Installing the required plugins and libraries
        2. Creating an advanced admin module
          1. Adding file upload and thumbnails
        3. Handling many-to-many relations
        4. Adding jQuery calendar and TinyMCE widget
      3. Autocompleting the search
      4. Other JavaScript helpers
      5. Summary
    13. 7. Internationalizing our Global Positions
      1. Internationalization and localization
        1. Refactoring the schema
        2. Rebuilding with test data
      2. Setting and getting the culture and language
        1. Preferred culture and language
      3. The action
      4. Adding culture to the routing
      5. Localizing the template
      6. Translating interface text
        1. Configuring i18n for the templates
      7. Dictionary files
      8. Translating the interface
        1. Adding the culture links
        2. Translating the static text
      9. Summary
    14. 8. Extending Symfony
      1. Bridging to other frameworks
        1. Bridging with eZ Components
          1. Configuring the component with Symfony
          2. Using the component
        2. Bridging with the Zend Framework
          1. Extending the core classes with your own
      2. Multiple inheritance
      3. Summary
    15. 9. Optimizing for Performance
      1. HTTP compression
      2. Caching
        1. Cache settings
        2. Caching globally
        3. Caching page-by-page
        4. Caching without the layout
        5. Caching with the layout
        6. Caching parts of a template
        7. Dynamic cache
        8. Cache storage
        9. Caching dynamic pages
      3. Looking at the database
        1. Setting limits and columns in the criteria
        2. Creating your own SQL statements
        3. Limit your queries
      4. Caching your queries
        1. ETags
        2. Less requests
          1. Stylesheets
          2. JavaScripts
      5. Other tools to aid you
        1. Firefox developer tools
        2. Database tools
          1. Deciding on your table types
        3. Accelerators
        4. memcached
        5. Caching database calls
      6. Summary
    16. 10. Final Tweaks and Deployment
      1. Editing the default pages
      2. Disabling the application
        1. Symfony on the server or not?
        2. Transferring your application to the server
          1. rsync
        3. Symfony and rsync
      3. Summary
    17. Index