Which one to go; Yii or Symfony

前端 未结 3 2059
北荒
北荒 2021-02-04 21:05

Okay. I\'m NOT asking which one is better. I know Yii is not better than Symfony, Symfony is not better then Yii.

I\'m asking which one should i go with

3条回答
  •  执念已碎
    2021-02-04 21:27

    I think what you search is to see what is the recommendations more than any Evangelism.

    Just to give some pointers about what is the current state of PHP, and nice components that is using the latest php features.

    Requirements

    Make sure what you use has, a way to...:

    • send to the log (Monolog is a good one)
    • parse text only config (YAML is a good one)
    • logic-less templating, with some convention (Mustach, Twig)
    • dependencies definition manifests (Composer is the way to go, very similar to package.json that Node offers)
    • define common "service" instantiation mechanism (DependencyInjection is one example)
    • abstracted way to load libraries (ClassLoader component is a good one)
    • Localization management (see Symfony2/Twig documentation )
    • abstract database calls without hardcoding database vendor specific (Doctrine2, Propel)
    • Unit testing structure, usage and conventions (PHP Unit, Behat, Mink)
    • Database code doesn't use "mysql" and istead uses mysqli

    And all of that distinct functionality packages that you can mix and match.

    Mix and match

    There is some efforts underway that address this exact issue, here some interresting ones:

    • The PHP Framework Interop Group is a consortium of contributors representing frameworks and they created some standards, namely the three layers known as PSR-0, PSR-1 and PSR-2
    • PHP The Right Way is a collaborative work on what is the current best practices.
    • Tobias Schlitt's definition of a framework

    Hope this helps you. with your own choice of which framework to invest on.

提交回复
热议问题