views:

1209

answers:

9

As a way to find inspiration and improve my PHP skills, I am looking for some beautiful PHP source code to read, preferably an open source "standard" web site rather than a more tool-like project such as phpMyAdmin.

So, where can I find some beautiful PHP code?

+6  A: 

Try looking at the source of the best PHP frameworks - Zend's, Symfony and CakePHP. They are very well documented and generally well designed.

Eran Galperin
I'd argue Cake. You can **build** beautifully coded applications with Cake, but last times I plumbed the depths (about a year ago) there was a ton of ugly needed for PHP 4 compatibility.
Alan Storm
A: 

PHP.net is an open source website, but isn't exactly beautiful - some of it feels archaic but it works and is very secure.

Symfony is worth looking at, and there are some projects in the PHP.net CVS that are a bit more modern than the website.

Ross
+4  A: 

Not all opensource projects are great examples as of how things are done.

Take a look at PEAR, ezComponents and the Zend Framework. All three are pretty popular in the PHP world, they solve a ton of different problems [each sometimes with a different approach] and they all follow great coding standards.

Also, there is often a trade-off between beautiful/elegant code and code that is very optimized. For example, if you want to see code that is powered to run a large website which needs to handle a lot of traffic, check out Mediawiki. It's build on very efficient code, but it's not very pretty.

Till
+7  A: 

CodeIgniter code is beautiful. There are many projects written in CodeIgniter which are publically available and you can check out the source code.

Have a look at the Getting started page of CodeIgniter's tutorial and read through. I can gaurantee you'll be inspired and want to fire up your IDE and get coding straight away :).

You can also download and have a look at the source code of Bamboo invoice. When I need inspiration I also search for 'php code' on youtube :)

Ali
The one ugly thing about CodeIgniter is its PHP4-compatibility. It would probably look nicer without it.
christian studer
+3  A: 

Kohana and Zend Framework i'd say. Zend's coding standards is also a good read.

olle
+1  A: 

ezComponents: Well documented, and has very handy tutorials.

Imran
A: 

Krugle.org is a great place to browse for code. Not just PHP, of course.

ign
A: 

Have a look at "Expert PHP 5 tools" book. There is e-book available in web also.

Bakhtiyor
+1  A: 

PHPUnit consists of great PHP5.3 code http://github.com/sebastianbergmann/phpunit/tree/

Also the Lithium Framework uses great PHP 5.3 code http://rad-dev.org/lithium/source

powtac