views:

283

answers:

11

It's not hard to find example PHP code. The problem seems to be that most of it is frameworks/libraries/etc. This is great, but I'd like to see an example of an actual website.

This stems from my perception that I can't build anything but "toys." My websites tend to be fairly CRUDdy, and it feels like my sites are a bit of generic MVC stuff and a lot of "SELECT" and "INSERT" statements.

I just want some assurance that I'm not "doing it wrong" since these are personal projects, and I'd like to use them to get a job.

+4  A: 

What about PHPBB, which is neither a framework, nor a library?

There are also plenty of Open Source websites you can find just by making some search. Especially blogs, content management systems, etc.


Edit: responding to the first comment to my answer, I want just to add that looking at Open Source websites would probably help to have an image of what large (or not so large) projects are, and also how things are done by experienced developers (for example using PDO, SQL transactions, templates, etc.).

But please take in account that most of the time, those projects are developed by several people. And since PHP does not have any coding standard and does everything possible to force the people to not use good practices, large, collaborative projects are not so good at improving your coding standard nor learning good practices. For this, books may me much more helpful, especially books about good practices.

MainMa
The second part of your answer, I like... but I would personally not recommend anyone to look at PHPBB for good coding practice.
tharkun
True, phpbb is bad. But please consider that there are **much worse** alternatives, such as wordpress mentioned below.
Lo'oris
@tharkun: see the edit to my answer. By the way, if you know an Open Source websites which actually use good practices, feel free to add an answer to this question.
MainMa
+1  A: 

It may be worth looking at wordpress. I haven't looked at the php behind it, but I know I learned a lot looking at the DB definitions.

Kyle
Wordpress code is a total hell. Don't use it as a reference.
halfdan
As is most turnkey php solutions it seems :)
thomasmalt
+1  A: 

Usually a framework is a good compromise between writing quality code and performance. Larger websites that need scale come up with their own custom hacks which eventually evolve into frameworks. In my experience writing in pure PHP it's too easy to go the quickest way to implementing a feature and end up with a mishmash of code, but others might be more disciplined.

Novikov
+3  A: 

Below is a good site that also make its source available (which is very well commented and easy to follow/understand, from a Zend Framework standpoint)

http://www.dasprids.de/

Instructions/info for the source http://www.dasprids.de/behind-the-site

Actual source http://site.svn.dasprids.de/

jsuggs
Just as a disclaimer, I don't agree with 100% of his architectural decisions, but in general it shows many "best practices" and would highly recommend it as a good starting point/reference.
jsuggs
+4  A: 

Check out MediaWiki. That's the same software that runs Wikipedia, and it's open source.

rmeador
+1  A: 

It's not hard to find example PHP code.

Good point is that you know how to find code. You said your code ends up in a generic MVC and CRUDdy, i think this is what most of the web applications around are doing. But the important thing to consider here is they do these MVC/CRUD stuffs in managed way and following standard Object Oriented Design Patterns.

If you want to get examples of real PHP applications then search for open source codes for that specific type application and not frameworks/libraries. Frameworks/libraries are a bunch of PHP CLASSES combined together following the application design architectures and they are supposed to provide you a code base to start your new project with existing set of usable codes, not that they give you the "application feel" rather "structured feel" at the starting point. But once you get along these frameworks/libraries working together to provide you a structured way to build your application, things will really ease later. Your job is guaranteed ;)

If you want to develop codes with these MVC frameworks then start with Codeigniter. It is well documented and as you stated your existing code turns out to be like MVC, you'll grab this framework and how to build with it in one shot. I've written a Hello World in Codeigniter you can refer to start with it. (Also Refer: Codeigniter Documentation)

To find code for real application (not frameworks/libraries) you might think of slightly changing your search queries, search for categories of web application or alike you want to see, not just for the code to do this and code to do that, always search for the better and efficient ways to code and develop things. Github, Sourceforge.net, Google Code are really great places to search for "real" & "cool" open source PHP applications.

bhu1st
A: 

My code of satya-weblog.com is almost live. I am using wordpress V 2.9, so download that and you know about my site! Check at symfony framework also and you come to know of propel, yml etc

Satya Prakash
A: 

Well, actually you can learn a lot by studying a solid framework like ie. the Zend Framework. If you would like to learn that I suggest you first have a look at the Zend Framework Quickstart and then start reading Surviving the deep end. Once you covered these, you should have learned the basics of the Zend Framework, and then you can start looking at open source projects that use it. As far as CMSes go, there are a few using the Zend Framework, like TomatoCMS and pimCore.

BTW Creating a website isn't exactly rocket science, most sites are in fact just a collection of dull CRUD screens (sometimes spiced up with some AJAX to deliver a better user experience) that are used to add content to the site...

wimvds
+4  A: 

It's worth noting that the php.net website is itself open source.

John McCollum
A: 

Starting with a lightweight framework would be a better solution, and for that I do suggest codeigniter as a starter. Zend would be kind of heavy-weight framework, so starting with it would a little complex. I'm not downgrading Zend but as a starter that wont be a good idea.

Sudhir
A: 

On beta.mkforlag.com, where I try out new ideas and develop new pages and new layout for the main domain, most of the source code can be seen. Most of the site is in Swedish, but most of the php code (comments, variable names etc.) is in English.

You should also keep in mind that although I've been using PHP a couple of years I'm no PHP expert and most likely "doing it wrong" in many cases. If you're not that advanced, though, you may find at least some of my code useful.

matsolof