How can I integrate zendframework 2 library with my Symfony 2 application? How to autoload and how to use it? I would like to use some classes.
How can I integrate zendframework 2 library with my Symfony 2 application? How to
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
To integrate Zendframework 2 into Symfony 2, If you’re using the Symfony Standard Distribution, add the following to the deps file at the root of your project:
Now, update the vendor libraries by running:
If you are not using Symfony Standard Distribution, you will have to clone from github in vendor folder.
Next, add the Zend namespace to the app/autoload.php file so that these libraries can be autoloaded.
Then It’s done, You can use zendframework library. For example I will show Zend\Json class usage in the default symfony 2 application.
Open src/Acme/DemoBundle/Controller/DemoController.php and edit indexAction method the code like below:
In this example I am using a zendframework class to convert an array to json