symfony - the first acquaintance, reasoning and impression.

    Today I want to tell you about my recently held first acquaintance with the symfony framework .

    Since before that I had been developing my applications on the Zend Framework for a long time (about a year and a half) - I have something to compare with.

    Firstly, I would immediately like to note that the documentation for this framework is scarce (no, I’m not talking about the lack of such a language in Russian, although this is not particularly pleasing, I’m saying that the native documentation on the project’s website is very incomplete. This Naturally, I will classify it as “cons."

    But, let’s say this - nothing is impossible. And digging around (albeit longer, but still) you can get to the truth (although how true this is, optimal, etc.) is unknown, because unfortunately there are no familiar programmers around me who would use symfony to develop )

    I really liked the implementation of the localization system in this framework. Who worked with this will probably agree with me, and who did not come across I will show with examples:

    And so - localization


    Let's say we have the indexSuccess.php template (for those who still do not know that symfony is built on the MVC model, please read at least a little about this framework using the links provided by me above). So, in this template we write in our default language (the default language), let it be English - since it is recognized internationally.

    In turn, in the structure of the project directories there is such a directory as i18n (short for internationlisation. Where the number 18 is nothing other than the number of letters between "i" and "n"). In this directory, a file is created (created by handles) general.ru.xml, into which, as you already guessed, the Russian translation will be added. Here is an example:
    image
    (sorry for the picture instead of text, but I have no more strength to deal with the habraparser)

    As you can guess when switching the user culture (in other words, when changing the language) symfony parses the xml file general.ru.xml for the presence of a translation for each phrase.

    In general, I like this approach ... especially when processor xml parsers are just around the corner. All this works really fast (with a relatively small amount of static text, I haven’t tried more yet).


    I also tried “their” helper for building forms. I can say that it’s not quite intricate and my first impression is that it will not be easy to build complex forms (there is no second impression yet, because I haven’t delved deeper).

    Form helper


    Using it is pretty simple, it’s probably easier to show with an example than to explain:

    Accordingly, this function returns:

    (хватило бы терпения одалеть хабрапарсер)

    Which is very interesting - you still have to close the tag yourself. The same with the rest of the inputs, selects, and so on:



    :


    It all starts with

    Yes, yes ... I think you guessed what I want to continue about - about the lack of consistency of the template in this form. Perhaps I will attribute this again to the category of "cons." I can present you a screen template of one very small page and you will be amazed how difficult it is to read:

    you say: “Don’t use such helpers!”, But I will answer that I know this framework very, very poorly, so for now I’m following the advice from the official documentation without risking experimenting on your own.

    In conclusion, I will say that at this stage, at which I know this framework very poorly, I do not like it at all. But I will hope for the best ...

    PS And yes ... why do I use this framework? Because they asked to use it at a new job and, according to the results, naturally report on its suitability.

    PPS I do not want to offend anyone, if I’m wrong somewhere - correct, I’ve been working with this framework for the second day and expressing my current impression.

    Also popular now: