views:

352

answers:

7

I'm an intermediate PHP developer with no experience building a large scale web application in this language (though I have in others, mainly Rails)...say I wanted to build a social networking site using PHP and MYSQL (preferably) with all the web 2.0 trimmings.

Where should I start? What sort of frameworks should I be looking at? Any up to date modern books that would outline something like this? Really anything for building a modern web app in PHP.

A: 

Wikipedia has a comparison of various social network frameworks / software:

http://en.wikipedia.org/wiki/Comparison_of_social_networking_software

Several of them use PHP / MySQL.

I also saw this book on creating a social network in PHP:

Create a powerful and dynamic Social Networking website in PHP

umop
A: 

I think the place to start is to really understand the fundamentals of HTTP and the tools PHP gives you for dealing with its stateless nature.

Beyond that, I would look into templating. Perhaps Smarty?

Finally, all of the normal MVC design patterns stuff apply equally to PHP, and there are lots of implementations if you'd like to use something off the shelf. You might want to check out Cake, if you need a framework.

dicroce
PHP itself is a templating engine, I'm not sure Smarty is really a good combination with any real framework. I do approve of Cake.
Kalium
Cake is stuck in the PHP4 era. Avoid it and Smarty.
Charles
@Charles, the upcoming release, CakePHP 2.0, will be purely PHP5 and many of the paradigms you learn with CakePHP 1.3 (current version) will apply in CakePHP 2.0. Plus, you don't really provide any valid reason why to avoid it.
Michael
@Michael: In the future, I'll note to avoid CakePHP 1.3, not 2. It should be avoided because of the PHP4-era design, and nothing more. Coding new PHP4-era projects *two and a half years* after PHP4 was EOL'd is insane.
Charles
Cake is super slow. I ran a query using my own framework, and it took 0.9 seconds to run. I used Cake's ORM and it took 6.0 seconds to run. Need I say more ?
Paul Dragoonis
+1  A: 

What sort of frameworks should I be looking at?

Try a modern framework like Kohana or maybe something more engineered-OO like Zend Framework.

You also might want to consider a simple procedural framework instead of an OO framework. PHP does very, very well working at low levels.

Avoid Cake. It tries to be Rails-like, but not only do Rails idioms translate very poorly into PHP, Cake is stuck in the design era of PHP4.

Charles
See my comment you made above. I'm not particularly familiar with Ruby but I'm curious which idioms Cake attempts to emulate and what about it being "stuck in PHP4" makes it a bad choice.
Michael
@Michael, Compare the CakePHP ActiveRecord implementation to the one in Rails. The CakePHP implementation is horribly designed in comparison because of the severe restrictions that a PHP4-era design forces. (It won't get any better in 2.0 either, where the minimum PHP version becomes 5.2. In order to get a more true-to-Rails ActiveRecord implementation, you need Late Static Binding, a 5.3 feature.)
Charles
+3  A: 

Ryan, there is a php framework called Elgg which is a php framework directed at social networking based applications.

Paul Dragoonis
+1  A: 

People Pods may be what you're looking for. It's a PHP framework built with social networking in mind.

Gabriel Evans
+1  A: 

A whole list of them:

Sarfraz
A: 

I suggest you have a look at the Yii Framework. It is very well-designed and was written with performance in mind. They've heavily focused on optimising their code for use in combination with an opcode cache like APC - no other framework has shown the same level of performance improvement when used with APC. Outside of performance, the framework also offers lots of built-in support for security (secure sessions with HMAC, SQL injection prevention, XSS prevention, etc.), forms, user input validation, caching, authentication/access control, and JQuery integration.

If you're an intermediate PHP programmer who is not experienced/confident enough to build your own framework, then Yii is a really good place to start as the code is very elegant and imho the programmer made some great design choices while writing the framework - simply reading through the Yii code makes for a great way to learn about how to design/write good PHP code.

Just my two cents...

Bug Magnet