By Fatskills Exam Guides Team — the exam nerds behind 28,500+ quizzes and 2.1M practice questions across 500+ global exams.
What is Symfony? Symfony is one of the most widely used PHP frameworks (ranking 3rd in popularity after Laravel and CodeIgniter)with a set of reusable components and options. Symfony aims to expedite the creation and maintenance of web applications and replace repetitive coding tasks. Symfony is known for its low-performance overhead, it gives developers control over the overall configuration.
Advantages of Symfony: Flexible, Reliable, Easy to test Extensive online community support, Long-term support Good documentation
Q 1. Explain the bundles in Symfony. Bundles in Symfony are similar to packages or plugins in other CMS or frameworks. In Symfony, bundles provide the developers with the flexibility to use pre-built features consisted of third-party bundles or to create and distribute their own bundles.
Symfony has two types of bundles:
Application specific bundles Reusable bundles
Q 2. In which technology Symfony routing configuration files are written? The Symfony routing configuration files are written with YAML, XML and PHP technology. The default routing configuration file in Symfony is: app/config/routing.yml
Q 3. What are the benefits of using Symfony? Using Symfony has a number of its unique benefits, such as:
Fast development Unlimited user flexibility MVC pattern The stable and sustainable framework Better user control & ease of use Expandable
Q 4. Mention the cache adapters present in Symfony. Symfony has five cache adapters available inside it. The available cache adapters are as following:
File system cache adapter Array cache adapter APCu cache adapter PHP files cache adapter Redis cache adapter
Q 5. How to get the request / query parameters in Symfony? In Symfony, developers can get the request parameter by using the following syntax:
$this->container->get('request'); $name=$request->query->get('name');
Q 6. What is Symfony? Symfony is a leading, reliable and one of the most used PHP framework combined with a set of highly featureful and reusable PHP components to create websites, dynamic web applications, web services and microservices. It is an open source framework and supports the MVC design pattern.
Q 7. What is a Symfony controller? Symfony controller is a PHP function that obtains information from the HTTP request to construct and return an HTTP response. The response can vary and could be an XML document, an HTML page, a redirect, a 404 error, a serialized JSON array, or any other request.
Q 8. Explain an Environment in Symfony. A group of configurations used to run an application is basically described as an Environment in Symfony.
This framework has two default environments:
Prod: Optimized for executing an application on production Dev: Used when an application is developed locally.
Q 9. Mention few web servers supported by Symfony. Symfony framework supports various user popular web servers. For example, few of the best web servers compatible with Symfony are LAMP, WAMP, XAMP, MAMP, Microsoft IIS, Nginx, and PHP's built-in web server.
Q 10. Explain the tasks performed by a Symfony controller. A Symfony controller can do virtually anything inside this framework. From redirecting and forwarding to accessing core services to rendering templates; a controller in Symfony can be used for various basic tasks.
Q 11. What are the innovations used in Symfony2 compared to Symfony1? Few crucial innovations that implemented with Symfony2 are as following:
Use of the Dependency Injection Pattern Complete Bundle setup Packed as Distributions Ease of debugging an application Improved security additions
Q 12. Explain Serializer in Symfony. Serializer is a component present is Symfony that offers developers an option to convert a PHP object into a specific format such as JSON, Binary, XML, etc.
Q 13. Explain the case of user access denies in Symfony. When an unauthorized individual tries to access the web application, Symfony shows a 403 HTTP status and throws an error page denying the user access request.
Q 14. Is it possible to create a Symfony application using composer? Then, how? Yes, it's possible to create a Symfony application using composer. The developer needs to run the following command in the console to install Symfony using composer:
Example: composer create-project symphony/framework-standard-edition my_project_name
Q 15. Explain the session set and get methods in Symfony2. Symfony2 uses a SessionInterface object set and get method to get and set sessions.
Following syntax can be referred as an example:
Example: public function sessionAction(SessionInterface $session) { // store an attribute for reuse during a later user request $session->set('user_id', 5); // get the attribute set by another controller in another request $user_id = $session->get('user_id'); }
Q 16. Mention the form helper functions in Symfony. Symfony has following form helper functions for developers:
Checkbox Form_start Form_end Textarea Input_password_tag
Q 17. Is it possible to create a request object in Symfony, then how? Yes, it's possible to create a request object in Symfony by developers. Use the
createFromGlobals() methods to simply create the request object.
Join 4M+ learners. Unlock unlimited quizzes, wrong-answer tracking, flashcards + reminders, study guides, and 1-on-1 challenges.