Skip to content
  • About
    • What is Symfony?
    • Community
    • News
    • Contributing
    • Support
  • Documentation
    • Symfony Docs
    • Symfony Book
    • Screencasts
    • Symfony Bundles
    • Symfony Cloud
    • Training
  • Services
    • Platform.sh for Symfony Best platform to deploy Symfony apps
    • SymfonyInsight Automatic quality checks for your apps
    • Symfony Certification Prove your knowledge and boost your career
    • SensioLabs Professional services to help you with Symfony
    • Blackfire Profile and monitor performance of your apps
  • Other
  • Blog
  • Download
sponsored by SensioLabs
  1. Home
  2. Documentation
  3. Cookbook
  • Documentation
  • Book
  • Reference
  • Bundles
  • Cloud

The Cookbook

Edit this page

Warning: You are browsing the documentation for Symfony 2.1, which is no longer maintained.

Read the updated version of this page for Symfony 6.3 (the current stable version).

The Cookbook

  • Assetic

    • How to Use Assetic for Asset Management
    • How to Minify JavaScripts and Stylesheets with YUI Compressor
    • How to Use Assetic For Image Optimization with Twig Functions
    • How to Apply an Assetic Filter to a Specific File Extension
  • Bundles

    • How to install 3rd party Bundles
    • How to use Best Practices for Structuring Bundles
    • How to use Bundle Inheritance to Override parts of a Bundle
    • How to Override any Part of a Bundle
    • How to remove the AcmeDemoBundle
    • How to expose a Semantic Configuration for a Bundle
  • Cache

    • How to use Varnish to speed up my Website
  • Configuration

    • How to Master and Create new Environments
    • How to override Symfony's Default Directory Structure
    • Understanding how the Front Controller, Kernel and Environments work together
    • How to Set External Parameters in the Service Container
    • How to use PdoSessionHandler to store Sessions in the Database
    • How to use the Apache Router
    • Configuring a web server
  • Console

    • How to create a Console Command
    • How to use the Console
    • How to generate URLs and send Emails from the Console
    • How to enable logging in Console Commands
  • Controller

    • How to customize Error Pages
    • How to define Controllers as Services
  • Debugging

    • How to optimize your development Environment for debugging
  • Deployment

    • How to deploy a Symfony2 application
  • Doctrine

    • How to handle File Uploads with Doctrine
    • How to use Doctrine Extensions: Timestampable, Sluggable, Translatable, etc.
    • How to Register Event Listeners and Subscribers
    • How to use Doctrine's DBAL Layer
    • How to generate Entities from an Existing Database
    • How to work with Multiple Entity Managers and Connections
    • How to Register Custom DQL Functions
    • How to Define Relationships with Abstract Classes and Interfaces
    • How to implement a simple Registration Form
  • Email

    • How to send an Email
    • How to use Gmail to send Emails
    • How to Work with Emails During Development
    • How to Spool Emails
    • How to test that an Email is sent in a functional Test
  • Event Dispatcher

    • How to setup before and after Filters
    • How to extend a Class without using Inheritance
    • How to customize a Method Behavior without using Inheritance
    • (service container) How to create an Event Listener
  • Form

    • How to customize Form Rendering
    • How to use Data Transformers
    • How to Dynamically Modify Forms Using Form Events
    • How to Embed a Collection of Forms
    • How to Create a Custom Form Field Type
    • How to Create a Form Type Extension
    • How to use the Virtual Form Field Option
    • How to Unit Test your Forms
    • How to configure Empty Data for a Form Class
    • (validation) How to create a Custom Validation Constraint
    • (doctrine) How to handle File Uploads with Doctrine
  • Logging

    • How to use Monolog to write Logs
    • How to Configure Monolog to Email Errors
    • How to log Messages to different Files
  • Profiler

    • How to create a custom Data Collector
  • Request

    • How to register a new Request Format and Mime Type
    • (session) Making the Locale "Sticky" during a User's Session
  • Routing

    • How to force routes to always use HTTPS or HTTP
    • How to allow a "/" character in a route parameter
    • How to configure a redirect to another route without a custom controller
    • How to use HTTP Methods beyond GET and POST in Routes
    • How to use Service Container Parameters in your Routes
    • How to create a custom Route Loader
  • Security

    • How to load Security Users from the Database (the Entity Provider)
    • How to add "Remember Me" Login Functionality
    • How to implement your own Voter to blacklist IP Addresses
    • How to use Access Control Lists (ACLs)
    • How to use Advanced ACL Concepts
    • How to force HTTPS or HTTP for Different URLs
    • How to customize your Form Login
    • How to secure any Service or Method in your Application
    • How to create a custom User Provider
    • How to create a custom Authentication Provider
    • How to change the Default Target Path Behavior
  • Service Container

    • How to create an Event Listener
    • How to work with Scopes
    • How to work with Compiler Passes in Bundles
  • Sessions

    • Session Proxy Examples
    • Making the Locale "Sticky" during a User's Session
    • Configuring the Directory where Sessions Files are Saved
  • symfony1

    • How Symfony2 differs from symfony1
  • Templating

    • How to Inject Variables into all Templates (i.e. Global Variables)
    • How to use PHP instead of Twig for Templates
    • How to write a custom Twig Extension
    • How to render a Template without a custom Controller
  • Testing

    • How to simulate HTTP Authentication in a Functional Test
    • How to simulate Authentication with a Token in a Functional Test
    • How to test the Interaction of several Clients
    • How to use the Profiler in a Functional Test
    • How to test code that interacts with the Database
    • How to test Doctrine Repositories
    • How to customize the Bootstrap Process before running Tests
    • (email) How to test that an Email is sent in a functional Test
  • Validation

    • How to create a Custom Validation Constraint
  • Web Services

    • How to Create a SOAP Web Service in a Symfony2 Controller
  • Workflow

    • How to Create and store a Symfony2 Project in git
    • How to Create and store a Symfony2 Project in Subversion
This work, including the code samples, is licensed under a Creative Commons BY-SA 3.0 license.
TOC
    Version
    We stand with Ukraine.
    Version:
    Put the code quality back at the heart of your project

    Put the code quality back at the heart of your project

    Symfony Code Performance Profiling

    Symfony Code Performance Profiling

    Symfony footer

    ↓ Our footer now uses the colors of the Ukrainian flag because Symfony stands with the people of Ukraine.

    Avatar of Alexandre Segura, a Symfony contributor

    Thanks Alexandre Segura for being a Symfony contributor

    1 commit • 12 lines changed

    View all contributors that help us make Symfony

    Become a Symfony contributor

    Be an active part of the community and contribute ideas, code and bug fixes. Both experts and newcomers are welcome.

    Learn how to contribute

    Symfony™ is a trademark of Symfony SAS. All rights reserved.

    • What is Symfony?

      • Symfony at a Glance
      • Symfony Components
      • Case Studies
      • Symfony Releases
      • Security Policy
      • Logo & Screenshots
      • Trademark & Licenses
      • symfony1 Legacy
    • Learn Symfony

      • Symfony Docs
      • Symfony Book
      • Reference
      • Bundles
      • Best Practices
      • Training
      • eLearning Platform
      • Certification
    • Screencasts

      • Learn Symfony
      • Learn PHP
      • Learn JavaScript
      • Learn Drupal
      • Learn RESTful APIs
    • Community

      • SymfonyConnect
      • Support
      • How to be Involved
      • Code of Conduct
      • Events & Meetups
      • Projects using Symfony
      • Downloads Stats
      • Contributors
      • Backers
    • Blog

      • Events & Meetups
      • A week of symfony
      • Case studies
      • Cloud
      • Community
      • Conferences
      • Diversity
      • Documentation
      • Living on the edge
      • Releases
      • Security Advisories
      • SymfonyInsight
      • Twig
      • SensioLabs
    • Services

      • SensioLabs services
      • Train developers
      • Manage your project quality
      • Improve your project performance
      • Host Symfony projects

      Deployed on

    Follow Symfony

    Search by Meilisearch