Symfony is a powerful PHP framework that follows the Model-View-Controller (MVC) architecture. Here are its core concepts explained:
1. Service Container ⚙️
The service container (also called the Dependency Injector) manages classes, interfaces, and their dependencies. It allows you to configure and retrieve services easily.
2. Event System ⚡
Symfony's EventDispatcher lets you decouple components by listening to and triggering events. For example, you can modify the response before it's sent to the client.
3. Dependency Injection 📦
Instead of hardcoding dependencies, Symfony uses DI to inject them dynamically. This promotes loose coupling and testability.
4. Routing 🧭
Symfony maps URLs to controllers using routes. You can define routes in YAML, XML, or annotations.
5. Security 🔒
Built-in security features handle authentication, authorization, and CSRF protection. Use security.yaml
to configure roles and access control.
6. Bundle System 📦
Bundles are reusable modules that add functionality to your Symfony app. The core bundles include FrameworkBundle
, SecurityBundle
, and DoctrineBundle
.
For a deeper dive into these concepts, check out the Symfony documentation or our Symfony tutorials. 🚀