The Cookbook
Edit this pageWarning: You are browsing the documentation for Symfony 2.6, which is no longer maintained.
Read the updated version of this page for Symfony 7.0 (the current stable version).
The Cookbook
-
- How to Use Assetic for Asset Management
- Combining, Compiling and Minimizing Web Assets with PHP Libraries
- How to Minify CSS/JS Files (Using UglifyJS and UglifyCSS)
- 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
-
- How to Install 3rd Party Bundles
- Best Practices for Reusable 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 Load Service Configuration inside a Bundle
- How to Create Friendly Configuration for a Bundle
- How to Simplify Configuration of multiple Bundles
Composer
-
- How to Master and Create new Environments
- How to Override Symfony's default Directory Structure
- Using Parameters within a Dependency Injection Class
- 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
- How to Organize Configuration Files
- How to Use MongoDbSessionHandler to Store Sessions in a MongoDB Database
Debugging
-
- 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 DBAL
- 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 Provide Model Classes for several Doctrine Implementations
- How to Implement a simple Registration Form
- Console Commands
- (configuration) How to Use PdoSessionHandler to Store Sessions in the Database
-
- 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 Reduce Code Duplication with "inherit_data"
- How to Unit Test your Forms
- How to Configure empty Data for a Form Class
- How to Use the submit() Function to Handle Form Submissions
- (validation) How to Create a custom Validation Constraint
- (doctrine) How to Handle File Uploads with Doctrine
-
- How to Force Routes to always Use HTTPS or HTTP
- How to Allow a "/" Character in a Route Parameter
- How to Configure a Redirect 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
- Redirect URLs with a Trailing Slash
- How to Pass Extra Information from a Route to a Controller
Security Authentication (Identifying/Logging in the User)
- How to Build a Traditional Login Form
- How to Load Security Users from the Database (the Entity Provider)
- How to Add "Remember Me" Login Functionality
- How to Impersonate a User
- How to Customize your Form Login
- How to Create a custom User Provider
- How to Create a Custom Form Password Authenticator
- How to Authenticate Users with API Keys
- How to Create a custom Authentication Provider
- Using pre Authenticated Security Firewalls
- How to Change the default Target Path Behavior
- Using CSRF Protection in the Login Form
- How to Choose the Password Encoder Algorithm Dynamically
- How to Use multiple User Providers
- How to Restrict Firewalls to a Specific Request
- How to Restrict Firewalls to a Specific Host
Serializer
-
- Session Proxy Examples
- Making the Locale "Sticky" during a User's Session
- Configuring the Directory where Session Files are Saved
- Bridge a legacy Application with Symfony Sessions
- Limit Session Metadata Writes
- (configuration) How to Use PdoSessionHandler to Store Sessions in the Database
- (configuration) How to Use MongoDbSessionHandler to Store Sessions in a MongoDB Database
- Avoid Starting Sessions for Anonymous Users
PSR-7
symfony1
-
- 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
- (form) How to Unit Test your Forms
-
- How to Use PHP's built-in Web Server
- (configuration) Configuring a Web Server
This work, including the code samples, is licensed under a
Creative Commons BY-SA 3.0
license.