Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Symfony 2 guide for Django developers [closed]

Tags:

django

symfony

After 8 years of PHP development, I switched to python 2 years ago, as much as I loved coding with Django, there are more jobs in PHP than Python in New Zealand (not to mention .NET), I have started to read about Symfony 2. Been through the "The Big Picture" tutorial and it seems very familiar to Django.

Question: Is there a migration guide for Django developers? So it can speed up the learning process?

Searching "Symfony for Django" in Google returns non-relevant results.

like image 657
James Lin Avatar asked Feb 16 '23 03:02

James Lin


2 Answers

I don't think there is a framework seemed to Django in PHP. Is almost impossible because of the languages features. I respect the the opinion of everyone and I'm not to judge but, I'm a a Django developer and I tried Symfony2 and didn't like it much. Specially because there are many configuration files in many formats and It seemed to me a framework for building a C++ application.

I tried Laravel and was pretty happy with it. As happy as you can be with PHP of course. It uses lot of the last features of PHP 5, configuration files are just .php files (just as Django's are .py) and have a very declarative syntax.

The docs are fine, not as great as Django's (I didn't think at the moment that the docs for Symfony2 are great either), and not to mention the framework is 1.5 mb, compared to 70mb+ that is Symfony (with vendors).

To answer your question, there aren't migration guides (because IMHO is impossible to do a straightforward migration). As a Django developer, you must be familiarized with MV* patterns, Symfony2 uses the same approach, MVP pattern, this means won't be hard to you to get it. Basically is the same as Django (far far away really :) ), you have a model, a controller, and the views. You do your business logic in the controller (DefaultController.php is the default for each bundle), you code there a method for each view (usually) which must return a rendered template.

You declare your models in yaml, xml or php with annotations and sync your db with them. This create model objects for you so you can query them in your controller. As you can see, conceptually is the same approach.

Hope this helps! I'll receive a lot of hate from Symfony2 people but is just my opinion.

Good luck :)

like image 61
Paulo Bu Avatar answered Feb 24 '23 19:02

Paulo Bu


No. There isn't.

You'll have to work with the official docs (which are awesome btw).

like image 27
Jakub Zalas Avatar answered Feb 24 '23 17:02

Jakub Zalas