Q:

Is the way of grouping classes different with PHP?

As the title states; the way one groups classes in PHP compared to for example Java, is it supposed to be different? I am currently reading O'Reilly's book OOA&D and in the chapters I've learned to use one class for each specific task and not one class for a grouped thing. Recently, I looked upon some code for a calendar, and the class was thousands of lines and had everything inside it that was to be used. However, this feels to me like it's violating the point of having many objects doing one task, but seeing as PHP is web development, is it supposed to be different? E.g. monster-classes.

A:

Answer: use good design principles, even in PHP.
In addition to not creating Monster classes (also known as God-classes or objects) the following patterns are worth mentioning specifically:

Object naming:

Class names should be nouns because they are objects.
Method names should be verbs, because they are actions.

Cohesion.  The short-version is basically: methods do one thing and do it well.
Property Visibility: Variables should private unless you've got a dang good reason not to, and in such case, use protected.  Almost always you should avoid public.
Use interfaces and abstractions. Almost no one uses interfaces in PHP, but they should.  It means that I can write my own implementation details but still hook in with some service that uses the class.

A somewhat outdated article on PHP design patterns that's still worth reading but is hard on the eyes.
Short-version:
If you are ever relying on an array to hold a particular structure it should probably be in a class.

An example from my life: ActiveRecord
What if I want to build a website that does not need any particular Active Record implemenation?  At the moment, I'm quite stuck once I choose an implementation because they are all so unique.  If they actually implemented an ActiveRecordInterface, I would be able to swap out my actual ActiveRecordEngine if I wanted to change.

