Need "good" real world examples of class/pattern use in PHP

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
Hi everyone

I need to move on a step in my PHP...

I know what classes are, both in PHP4 and 5 and I'm aware of "patterns"
existing, but what I'm looking for are some real world projects eg. Open  
Source that people consider to use classes and patterns correctly.

I lack a senior person to lead me in this so I feel I'm losing out on
only using bare PHP class features and not really knowing how to design
proper base classes and use inheritence and patterns etc. in real world

Can anyone point me to some good real world examples such as open source
projects that use these so I can learn properly?

Or perhaps someone knows of good online courses that cover this?  I did
a PHP course at a local college, but to say it was BASIC is an  

Thanks in advance.


Re: Need "good" real world examples of class/pattern use in PHP

Quoted text here. Click to load it

Sadly, I don't have any specific examples to give you, but I can offer
you my opinion on this matter.

When I first learned PHP, it was self-taught, and I didn't know much
of anything about programming, let alone OOP. After taking some
university classes, I did some pretty heavy coding in Java, which is
highly object-oriented. Eventually I moved back to PHP, and I found I
was able to apply almost all of what I had learned about objects/
classes/inheritance/object-oriented programming, and using the same
features in PHP was a snap. I guess the moral of my story is that if
you want to educate yourself further, you don't necessarily have to
limit yourself to PHP as the context language. General object-oriented
concepts should apply to your goal.

Or maybe I've totally misread your question and you already have a
good understanding on OOP, and need to know about it's context in PHP
exactly. Heh.

Re: Need "good" real world examples of class/pattern use in PHP

Quoted text here. Click to load it


First, you're doing yourself and the community good by wanting to
learn better engineering practices.  And, while it might be a bit
intimidating at first, if you approach it with enough humility in
understanding that those presented are best practices from years of
development experience, and that, yes, you were wrong =).

For a os "application" that you can check out good programming
practices in action, check out Zend Framework (1.0.1).  I've played
some in the core code, I think it's a good representation of multiple
pattern theories put to practice.  Also, with over 40,000 unit tests,
it is a good representation of TDD.  It also has really good code
documentation using phpDoc.

Also, some books I would recommend:

PHP 5 Objects, Patterns, and Practice by Matt Zandstra
  I read this one, thought it was a good overview
PHP|Architect's Guide to PHP Design Patterns
  Skimmed this one and use it for reference, I think I like this one

and when you get comfortable in design patterns:
Design Patterns: Elements of Reusable Object-Oriented Software

I second what burgermeister said about not limiting yourself to PHP.
But, thanks to PHP5 and a community of experience programmers, you can
at least start your introduction to this world in the comfort of PHP
and later branch to broaden your knowledge.

that should be a good start and make you thirst for more.

Re: Need "good" real world examples of class/pattern use in PHP

Cheers Guys, if anyone does have any specific project they could say
are ideal things to study I'd really like to know also.

I have used other languages and did think it might be useful to find
general information on the methods, obviously if I could find
PHP specific material it would be ideal.

I do have a Java programming book at home and I'll have a look to see
if it covers any of the topics I need, not sure it does.

I'll check out the Zend Framework as prompted, thanks.

I actually have this book "PHP|Architect's Guide to PHP Design Patterns"
you mentioned, but felt it was more a reference than a real world  
situations study guide.

ELINTPimp wrote:
Quoted text here. Click to load it

Site Timeline