views:

672

answers:

10

It's hard for me to imagine a php script that is more than a few hundred lines of code. It seems that, for a non-persistent environment, web-based scripting is usually done is small chunks and used for the purpose of delivering a portion of a website to the end user. I'd like to know if people are developing any type of large, or persistent, or complex apps with php, and what is it exactly you are working on. I've only done small projects for small websites, so I don't know what can be accomplished on a larger scale. It would also be nice to know what libraries you are using, and what other technologies you are integrating with. Please enlighten me so I can start to dream of bigger things!

+1  A: 

MediaWiki is one of the largest public PHP apps, and it's got very nice code. . I know some larger ones, but they're utterly awful and you'd learn nothing by reading them.

John Millikin
The MediaWiki code base is ok until you decide to extend it. I've been doing NLP research with it so i guess my view point is skewed by the complexity of my problem.
gradbot
+1  A: 

There are lots of complex OpenSource php applications. For example, the Drupal CMS, which can be considered a platform in its own right for developing other web sites.

You can browse through the source code online: http://cvs.drupal.org/viewvc.py/drupal/drupal/

Rob Walker
+10  A: 

I would look at some of the well-known open source web apps that use PHP to get a good sense of what can be accomplished, and how PHP is used in each of them. The advantage is that since they are all open source, you can actually look at the PHP code to see how various functionality was implemented.

Some good examples to look at include:

Also look at some of the popular frameworks to see what kind of functionality they offer (this should give you a good sense of what types of things PHP is most often used for):

Wilco
Ugh, PHP-BB should not be on that list. Never before have I seen so many security vulnerabilities packed into such few lines of incomprehensible spaghetti code.
John Millikin
ROFL, that is SOOOO true, I have an app with 3000+ and I've had everything you can imagine thrown at it with no issues yet.
Unkwntech
Maybe move PHPBB to "Good to look at so you know what NOT to do"
Unkwntech
Haha, good to know - I'll add a note to that one.
Wilco
I'll also say Wordpress' code isn't too crash hot. I'd say better to look at the Zend Framework.
alex
imho, zend framework is the only one on that list which uses proven coding-practices/patterns that are available in the latest versions of php. All the others (to my knowledge) support php4 which cripples their ability to use decent OO features. If you're coming from .net, java, or c and you look at wordpress code you might find yourself jumping off a bridge.
Mike B
Wordpress has to be the most inefficent way to build a page. Basically, it runs twice. First, it includes everything, and has every plugin you have activated (on every page) register the action hook they are trying to hook into (showing the content of a post, etc), then wordpress goes and runs the action hooks. Pretty much everything inside the entire include folder is included every, single, time.
Chacha102
+1  A: 

+1 for Wilco
I have a software I use for some of my clients, it's a CMS, Blog, eCommerce beast, the code base is HUGE, but everything cooperates with each other nicely.

Unkwntech
+1  A: 

For my day-job we run everything in PHP - our front-end website, our backend for agents and employees, inventory, server control interfaces, etc. These are everything from spiffy new AJAX-enabled Zend Framework apps to legacy code that we haven't ported yet. On top of that we use things like Mantis (bug tracking built in PHP), Mediawiki, and phpMyAdmin.

The only thing that isn't PHP are vendor apps because vendors love Java. The one ASP.NET application we have was actually abandoned by the vendor during the project (not really a knock against ASP.NET, that app was just the perfect definition of a runaway project and would have failed no matter what language it was written in).

With mature frameworks like Zend Framework, CodeIgnitor, and CakePHP creating just about anything in PHP is possible.

dragonmantank
+2  A: 

The biggest problem developing large scale programs is definitely keeping them maintainable in the long-term. Initially, a program starts out all full of ideal methods and ideas, but keeping the integrity intact, especially, over time fails, in my opinion, more often than not.

In addition, scope creep is your enemy. You HAVE to reign that in ASAP.

As far as large scale programs go the company I work for has a few internal programs constantly under development. One example is our proprietary website engine. It's a very large code-base that includes a dozen modules (user management, survey system, blogs, user galleries, etc) that allows us to build our clients sites rapidly.

We also develop our own internal project management program for managing our clients work.

You should definitely be thinking in terms of scale in the long term. In almost every project I've worked on there's a permission/group element for users involved. You might want to start thinking about the possibilities and issues involved in that and work up to more complicated functionality.

Eric Lamb
+1  A: 

My company works on educational software. We've recently started doing web-based content delivery, including video and audio, with the backend written entirely in PHP using MySQL. We have two primary apps, one which lives on our servers and one which is delivered to the customer. One clocks in at ~42,000 lines of code (using a physical line count) and one at ~68,000 lines.

We use PEAR extensively and a recently started project is using the Zend Framework.

Michael Johnson
A: 

Get CodeIgniter and rebuild Amazon or Ebay. If you can dream it you can build it in PHP but you might not be able to maintain it because it is so easy to created bad code that works. PHP.net is your friend. Whatever framework you use make sure your read the User Guide and let it guide you.

Clutch
A: 

I can't believe nobody has mentioned the MVC pattern yet. IMO, it's one of the best things you can use to help you maintain large codebases.

alex
A: 

We use PHP at our company. (We do online language learning: http://www.livemocha.com. You should go take a look at the site. Yes, it's sort of a shameless plug, but it's also topical. :-) )

I can't give you a precise number of users, but we put out a press release a while back celebrating hitting the 3 million mark. That's a pretty large scale as web apps go.

We build on the CakePHP framework, which is based on an MVC architecture... at least in theory. In practice, they auto-generate certain methods for the models which tend to have the result of pushing some pieces of model code (caching, deciding which DB to use) into the controllers. They also have a few localization issues in 1.2 that make me think this part of the framework hasn't really reached maturity yet. That said, I find CakePHP pretty comfortable to work with overall, and you should at least take a look at it if you're considering implementing a large-scale web app in PHP. It has some excellent documentation available as well (google for "CakePHP bakery").

Arkaaito