views:

401

answers:

8

I'm currently working on a browser-based MMO and have chosen the LAMP stack because of the extremely low cost to start with in production (versus Windows + IIS + ASP.NET/C# + SQL Server, even though I have MSDN Universal). However I will need a PHP framework for this as it's no easy task. I am not restricted by anything other than the ability to run on Linux, as I will use a dedicated cloud hosting solution (and a VMWare image for development) and can configure it as needed.

In no specific order:

  1. It has to be easily scalable; this is crucial. If the game becomes a steady success it will eventually outgrow the server beyond what the host provides and would have to be moved to several load-balanced servers. It is crucial that this can be done with minimum effort. I do know this might require following strict conventions, so if you know of any for your suggested framework please explain what would be needed.
  2. It has to provide modules for all the core tasks: authentication, ACL, database access, MVC, and so on. One or two missing modules are fine, as long as they can easily be written and integrated.
  3. It should support internationalization. I think there is no excuse for any web framework not to provide means of translating the application and switching between languages without a lot of effort from the programmer.
  4. Must have very good community support and preferably commercial support as well. Yes, I do know QCodo/QCubed is so nice, but it is not mature enough for this task.
  5. Smooth AJAX support is required. Whether the framework comes with AJAX-capable widgets or has an easy way of adding AJAX is not relevant, as long as AJAX is easily doable. I plan to use jQuery + Dojo or one of them alone - not exactly sure.
  6. Auto-magically doing stuff when it improves readability and relieves a lot of effort would be especially nice if it is generally reliable and does not interfere with other requirements. This seems to be the case of CakePHP.

I have read a lot of comparisons and I know it's a really hot debate. The general answer is "try and see for yourself what suits you". However, I can't say it is easy for this task and I'm calling for your experience with building applications with similar requirements. So far I'm tied up between Zend and CakePHP by the general criteria, however, all well-known frameworks offer the same functionality in some way or another with different approaches each with it's own advantages and disadvantages.

Edits:

  1. I am kinda new to MVC, however, I am willing to learn it and I don't care if a framework is easier for those new to MVC. I have lots of time to learn MVC and any other architectures (or whatever they're called) you recommend.
  2. I will use Zend as a utility "framework", even though it's just a collection of libraries (some good ones though, as I have been told).
  3. Current PHP contenders are: CakePHP, Kohana, Zend alone.
+4  A: 

I see you have looked at Zend and CakePHP, but I would like to point you in a different direction.

http://kohanaphp.org/

Kohana is what I would use if I am was still using PHP. They took CodeIgniter and forked it in a way that makes php feel much less file-based and much more object-based. They have a great templating solution, and also have modules for everything you discussed except for ACL (I don't know what that is so maybe they do have it).

Anyway, I think it is worth checking out.

On Scalability
I noticed some conversation on speed. Although I think Kohana handled things very fast for us, I don't think this as much something to do with the framework as it has to do with other tools.

First I have increased speed on many of my php apps by dropping apache for nginx. Nginx with PHP running as fastcgi is much more light-weight and really increased load times for http://ukclasslist.com. We still use apache locally and the copy running on our server is quicker than our local version.

If you are still having trouble with speed, especially with grabbing large chunks of data you should look into memcache.

sammcd
What are you using now instead of PHP?
Baddie
I have looked at Kohana, it basically is an improved CodeIgniter. TBH all frameworks can deal very well with my task, but I'm having difficulty deciding which would be the best for my task.
iconiK
@Baddie: RoR? ASP.NET? JSP? Lots of choice.
iconiK
I still have a project or two using Kohana. My more recent projects have been Django and App Engine.
sammcd
@iconiK: Well I used Kohana for a few projects and was very happy with it. The only additional advice I can give you is that I have not heard good things about zend from anyone I have talked to about it.
sammcd
I myself prefer CodeIgniter to Kohana, although on a couple of the core differences, I'd rather side with Kohana (proper OOP with PHP5 is a big one). IMO, the reason to choose CI over Kohana has to do with maturity/stability. Kohana seems to merge new ideas into the main codebase too quickly, which means there are too many weaknesses in the 'stable' releases. CI is more limited, and has its weak points (the validation class is absolutely horrendous, for example), but it seems more clean, coherent, and fundamentally solid. I wish they'd make something in between, but if I have to choose..
Jens Roland
A: 

First of all, this is good resource on PHP frameworks:

http://www.phpframeworks.com/

You can get in idea easily as there is good comparison of them there.

Secondly, I would strongly recommend you going through this great tutorial on MVC at phpro.org:

http://www.phpro.org/tutorials/Model-View-Controller-MVC.html

Sarfraz
Thanks for the MVC tutorial, I'll start reading it. Looks pretty good at first sight.
iconiK
@iconiK: thanks you.........
Sarfraz
A: 

Codeigniter is an amazing framework that has a good community support and can scale well as well. Plus you don't need to have shell access to deploy the application. And the MVC integration makes writing applications really easy.

Ritesh M Nayak
This is the general praising of a framework I saw in other questions, which is not what I'm looking for. I'm familiar with CodeIgniter's advantages and the fact that it's good for shared hosting, but I have a whole VPS at my disposal, none of those matter anymore.
iconiK
what needs shell access?
WalterJ89
1 was scalability - CI has this more that most other frameworks
Dan Beam
CI doesn't look much scalable to me. It is fast, I agree, but performance != scalability. It does help with raising the margin until it's time to add another server, but it also lacks point #2 out of the box. Not sure about #3.
iconiK
A: 

Actually you can have both CakePHP and Zend Framework in one. Zend framework is a bit closer to a library than anything else. So its not hard to use Zend libraries in Cakephp. The best of both worlds.

here is an example of a component or controller to do it.

Also it sounds like proformance would be very important. you may find this interesting http://avnetlabs.com/php/php-framework-comparison-benchmarks

As for scalability maybe this question can help

WalterJ89
CakePHP is slow, I know. No wait, not slow. Dead slow. Slow as hell!
iconiK
+3  A: 

I'm pesonally a fan of Kohana. I've CodeIgniter prior to this and Kohana (as I see it) is essentially all the good stuff in CodeIgniter without a lot of the limitations. v3 is the latest version of Kohana and is more robust and flexible than v2.

Performance varies depending on how you're using a framework and its own inherent strengths and weaknesses compared to other frameworks. Your best bet is to use APC (soon to be part of PHP 6) or eAccellerator to cache the compiled PHP scripts.

hiddentao
A: 

Here is a good start point http://phpro.org/tutorials/Model-View-Controller-MVC.html.

D.Martin
+2  A: 

Scaling is not a problem you can expect a web framework to solve. Even successful MMOs with near-limitless budgets have resorted to sharding and instancing. The best approach is to design your application to be modular. As the need arises, you can move major functions to separate servers. Chat, inventory, and auctions are largely independent features and need not be hosted on the same server, for example. To prevent certain gameplay exploits, you will need a messaging service between your servers, and none of the major web frameworks provide this.

The Achilles' heel in PHP web frameworks is the lack of persistent memory. CakePHP is so slow because the entire web framework must re-initialize for every request. Opcode caches like APC only eliminate the need to parse PHP source files.

I would strongly suggest that you consider web frameworks in other languages. Python, Ruby, and Java are all excellent choices. All of these languages will run on inexpensive Linux servers and don't suffer from the above limitation.

Matthew
I have chosen PHP as the best for me, because:1) I find Java to be horrible in many ways. You can't help it.2) Python is annoying as hell with it's indentation; I come from C++.3) Ruby never fails to amaze me with it's easiness to confuse the hell out of me.
iconiK
Also, there is an experiment going to run PHP on .NET like any other language and the current status looks very promising. Though if the game does end up becoming popular and managing that load becomes too cumbersome, I might just get my hands dirty and code the damn thing in C++/Qt or C++/CLI on .NET as a FastCGI module.
iconiK
I came from C++ too, and all the languages I mentioned have grown on me with a little experience. On the other hand, I work with PHP everyday and have grown to dislike it quite a bit.
Matthew
One thing is I will learn Python, to use as a general-purpose scripting language, but I do not feel like I'd enjoy writing web applications in it. One thing that might bite me with PHP: 15 seconds on digg or slashdot front page and the load will be astronomical.
iconiK
@comment about PHP: This PHP feature is what would make me ditch it right now if I knew how do to even simple stuff in ASP.NET: http://stackoverflow.com/questions/146329/what-is-the-worst-gotcha-youve-experienced/1855572#1855572
iconiK
If you can look past the indentation rules, take a look at Django and TurboGears. They're mature web frameworks with large, active communities. My personal favorite is Pylons, but it's somewhat less popular.
Matthew
@Matthew, and what am I supposed to do with the PHP book coming next week? :(
iconiK
@iconiK: Read it. I have several PHP books. :)
Matthew
A: 

Try Agavi. Simply the best PHP framework out there. Got everything you need and you may just extend, configure or change implementation of core classes via factory.

Freely definable environments (development, staging, production etc.), contexts (Web, SOAP, Console etc.), output types (custom set of renderers with layouts/layers/slots/parameters/HTTP headers) like HTML, JSON, PDF or $WHATEVER and simply the best routing system.

Uses XML for configuration and actually makes USE of it with parent files, schema validation and XIncludes. Nice input validation system with strict validation being the default (and not only for GET/POST, but all other inputs like headers, files and cookies as well). Add some i18n/i10n niceties and builtin SOAP magic and you have the most flexible and powerful PHP framework available (not "web"-only framework).

A bit short on documentation, but it has the only true MVC implementation in comparison to Kohana, CakePHP, Zend and all those other frameworks...just have a look at it and ask questions on IRC or the user mailing list. After a steep learning curve it's the last time you had a look at other (PHP) frameworks for a long time. :-)

asdf
I forgot to mention lots of things like caching, slots (sets of actions/views/templates/validations/cache), testing and modules and probably many other things. Symfony and Agavi are both based on the same project (mojavi) and Symfony2's going a lot in the direction of Agavi in terms of some basic features (like XML configs, slots only, PHPUnit, custom layouts etc.). Seems the Agavi guys have a point somewhere. :-)
asdf
I don't like XML configuration files honestly. They're too verbose. I prefer Zend Framework's array config files. For output types I only need HTML and JSON and that is not a problem in any framework. MVC is not an issue in any of the frameworks I know and I don't see anything different at Agavi in this respect. However it does seem pretty darned nice, so I'll take a look at it.
iconiK