
Custom Bundles
Bundle creation, extension configuration, compiler passes, reusable bundles, best practices
1Which class must the main bundle class extend in Symfony?
Which class must the main bundle class extend in Symfony?
Відповідь
The main bundle class in Symfony must extend AbstractBundle (Symfony 6.1+) or Bundle. AbstractBundle is recommended as it simplifies configuration and allows defining configuration directly in the bundle class via the configure() method. Bundle remains available for backward compatibility but AbstractBundle offers a more modern API.
2What is the role of the Extension class in a Symfony bundle?
What is the role of the Extension class in a Symfony bundle?
Відповідь
The Extension class (extending ConfigurableExtension or Extension) is responsible for loading the bundle configuration and registering services in the container. It reads the bundle's configuration files, processes application parameters, and configures services via the ContainerBuilder. It implements the load() method which is called during container compilation.
3What is the naming convention for the main class of a bundle named AcmePaymentBundle?
What is the naming convention for the main class of a bundle named AcmePaymentBundle?
Відповідь
By Symfony convention, the main bundle class must have the same name as the bundle. For AcmePaymentBundle, the main class will be AcmePaymentBundle and must be in the corresponding namespace, typically Acme\PaymentBundle. The file will therefore be AcmePaymentBundle.php in the bundle's src/ folder.
What is a Compiler Pass in Symfony and when should it be used?
How to define semantic configuration for a bundle with parameter validation?
+17 питань зі співбесід
Інші теми співбесід Symfony
Modern PHP (8.1+)
Symfony Basics
Routing & Controllers
Twig & Templates
Doctrine ORM Basics
Symfony Forms
Data Validation
Dependency Injection & Services
Security & Authentication
Doctrine Advanced
API Platform
Serializer Component
Events & Event Subscribers
Console & Commands
Messenger Component
HTTP Client
Cache & Performance
Workflow Component
Testing Symfony
Mailer Component
Translations & i18n
EasyAdmin Bundle
Symfony Architecture
Performance & Optimization
Security Advanced
Microservices with Symfony
Real-time & WebSockets
Deployment & DevOps
Опануй Symfony для наступної співбесіди
Отримай доступ до всіх питань, flashcards, технічних тестів, вправ code review та симуляторів співбесід.
Почни безкоштовно