views:

1443

answers:

6

Which one of this frameworks would you recommend to someone who knows the basics of PHP? What are the advantages and disadvantages?

A: 

In your case I would go with (in this order):

  1. Kohana
  2. Zend Framework

Since they are easier to pick up (specially for a beginner) than Symphony.

Alix Axel
+8  A: 

I wouldn't suggest any frameworks to someone who knows just the basics. Instead, I'd suggest to get a firm grip on OOP and the most common Design Patterns first, because that is what you will find in these frameworks. It also doesn't hurt to know your way around the various available PHP libs and extensions.

Gordon
Viet
I disagree. In fact, all senior developers in my team work on building frameworks and APIs while junior developers are much less prone to make mistakes when working with frameworks. God forbid if we didn't use frameworks the code would be all over the place. I settled with CodeIgniter after evaluating all of the above. Kohana is not a mature product--for example it doesn't care for backward compatibility which means it's good for learning but not for production.
aleemb
@aleemb I don't believe frameworks make juniors write less erroneous code. If the juniors have no clue about proper OOD, they will write OO spaghetti code, e.g. a common beginner mistake with MVC frameworks is to create fat controllers and anemic models. This usually leads to code duplication, which basically is *code all over the place*. They also often favor inheritance and composition over aggregation. Or they code against concrete implementations instead of interfaces. Both leads to monolithic, hard to maintain structures. Frameworks help solve concrete problems, not write clean code.
Gordon
Those who don't use frameworks are doomed to re-invent them. Poorly. In my mind, using a framework will *help* you learn proper architecture, designs patterns, etc. Plus having a common grammar allows you draw insight from other programmers using that same framework.
Bryan M.
@Bryan Let them reinvent them then. They will learn a lot from it. See this article http://www.brandonsavage.net/why-every-developer-should-write-their-own-framework/
Gordon
@Gordon it's a sliding scale. MVC is better than no MVC. Using 960grid or blueprint is easier than not using it. jQuery alleviates a lot of issues. In fact, once you write the basic interfaces and provide a few model controllers, the work flows a lot more seamlessly. Perfection is an endless pursuit but a good start makes it that much easier.
aleemb
@aleemb There is no doubt frameworks are helpful. I am not saying *not to use them at all*. I am saying, when you are a beginner, learn the *concepts*, e.g. Design Patterns and OOP instead of *framework Xs* concrete implementation thereof. It's like learning proper English before talking a dialect.
Gordon
+1  A: 

Even though ZF is well established and well documented, I would suggest Kohana since it is quite a bit less complex. It is very easy to start tinkering with it by simply downloading or cloning the sample application from github.

Symphony is not for beginners. I disagree that frameworks in general are not for beginners. Starting with a blank file and no framework leaves all of the architectural design up to someone who has no idea what they are doing while starting with a lightweight framework like Kohana gives you a well-organised platform and documentation to hit the ground running. Learning OO without any examples to guide you is very difficult since you don't already know what good OO design looks like.

After downloading/cloning the Kohana sample app, hit the docs and you'll be writing well-designed OO code in no time.

ColinM
+2  A: 

I think frameworks are a double edged sword for beginners. You may be able to do more in less time in many cases but in other cases (not a few) you will make mistakes because you do not understand the complexity of the framework code. I think you should be able to read a framework and understand its architecture if you want to used it.

That said it seems that the real cracks use Symphony. I might become or might already be the best, most versatile, most powerfull framework out there. But it definitely needs a lot of understanding of the principles of programming as well as web techonology and server technology in general.

Also very powerfull and much easier to start with is Zend Framework. It can definitely do much more for you than Kohana.

If you want a lightweight framework, Kohana is a good choice too. It has come a long way the last months and I think it is rapidly establishing itself as the new lightweight favourite.

So all in all, the three frameworks you mentioned are the three top frameworks on the PHP framework market at the moment and you won't make a mistake with any of them.

tharkun
They framework is called "symfony" ;)
Felix Kling
A: 

For a beginner and using the three examples you gave I would say start with Kohana(or Code Igniter) for these reasons.

  1. It's a lightweight framework which is a good starting point for full PHP development because it serves as a guide in how to organize a project in a language that doesn't have a lot of structure on it's own
  2. Introduces basic MVC concepts.
  3. Has basic features that will be useful in any PHP project e.g. caching, data filtering etc

I would then move on the Zend Framework if you plan or strive to work on larger projects for these reasons:

  1. Kohana documentation is greatly lacking (it's manageable for a beginner because you end up poking around and see what makes a framework tick so that they don't see like this ominous holy code which is a plus; but in a major project with timelines it's annoying)
  2. Kohana enforces certain conventions which is often inconvenient in major projects
  3. Lacks mature features that are useful in "enterprise" development e.g. a decent unit testing system (there is rudimentary phpunit modules to use in Kohana and you can certainly use base PHPUnit but in contrast Zend Framework has extended PHPUnit functionality to better suite it's framework)
  4. Better support. Zend framework has the Zend Company behind it as well as a huge community. This is a huge win for them because it permeates in everything about the framework e.g. configuration is thought out much better in Zend framework,more robust security featues, proper class autoloading based on PEAR namespacing, and it has a plethora of contributed components. Some of these benefits you can shrug of when starting but become invaluable when taking on large projects.

I've not used symfony but from what I can tell that also has some useful features once you get more versed in PHP (better ORM, better scaffolding etc). Synopsis: Kohana is a good start but I'd advise against roosting there if you plan to get into PHP beyond small sites.

Akeem
A: 

I always wondered why people say that not providing a unit test system is a major drawback in a framework. Well, testing you app is your responsability and you should use the tools you're most confortable with. Me, for instance, prefer SimpleTest and are bothered with framework that come bundled with and promote the use of their own testing system. Why learn another unit test system when SimpleTest is more than enough?

Notice that providing a unit test system and unit testing the framework is two completely different things. The framework should be unit tested, period. But for this task, the developers of the framework may use the tool they prefer most. They may even roll their own test framework (it seems that some people never learn and keep reinventing the wheel). However, (IMHO) the framework test should be kept separate from the framework itself. It shouldn't even be included on the framework tarball, but be kept as a separate package that interest only to developers of the framework.

Just my 2c.

FVS