This article contains short and simple explanations of UML class diagram design concepts. They are helpful for ones who want to improve UML understanding. These explanations consist of a few lines of PHP code and a diagram and summary of how they are related to each other.
Quick links: generalization, composition, shared aggregation, interfaces, association.
Class is represented on the UML diagram by rectangle with class name in it. Class rectangle has three sections: class information (such as name, superclass, stereotype, etc) in the first, attributes in the second and operations in the third. In other words, class variable definitions are in the second section and method declarations are in the third one. Abstract classes have their names in italic. "+", "#" or "-" sign before attribute/operation name means its scope: "public", "protected" or "private" respectively.
Lines on diagram that connects classes represent relationships between them: inheritance (generalization), composition and association.
Class diagrams allow you to put into view the whole structure of your application, not only the class you are editing. Just looking on the diagram and thinking may bring up an idea on how to improve the structure of your application or prove that it is correct and matches requirements.
Example of class diagram: Zend Framework Zend_Json classes with class variables and methods.

A generalization defines a taxonomic relationship between two classifiers: a more general one and a more specific one. And that means inheritance. For example, when one class extends another this is called "Generalization" in UML. It is shown as a line with a hollow triangle that connects two classifiers.
Composite aggregation defines a relation between composite and composed objects. The composite object consists (or is made up) of smaller “composed” objects. It creates, modifies and destroys them. For example: window contains title, table row contains fields.
Composition is shown as a line with a black diamond near the composed object.
The shared aggregation indicates that some classifier (process or class) cannot be performed/completed without another classifier. For example, book reading is not possible without a book but the book can be used in two different reading processes. Another example: database driven web form consists of fields, actions and pooled data connection and the connection can be used by another form/control.
So, the book reading process cannot be performed without a book and reader (it aggregates book and reader) and the book instance is shared by the reading process instances. Similarly, the data driven form cannot be completed without a data connection (it aggregates data connection) and the connection is shared by different forms.
On class diagrams shared aggregation is represented by a line with a hollow diamond.
Example #1. Book reading processes are represented by the ReadingProcess class and it aggregates the Reader and Book classes.

Example #2. A data driven form aggregates connection and fields. Fields are owned by the form and connection is shared by the forms.

A shared aggregation between two classes is usually represented by a class property that is initialized in constructor with instance of another class and never gets changed during the object lifetime.
An interface is a specification of behaviour that a class should implement in order to be used by some specific part of a system. In other words, interface specifies how objects communicate with each other.
There are two notations for interfaces:
Example of circle notation: class ChildNodes implements a set of interfaces from PHP SPL library.
Rectangular notation: class Button implements interface IButton and provide realization of the click method.
An association usually means that you have a sentence that describes a relation between two (or more) classes and this sentence is not like one of the following:
Examples of associations:
Usually the class method that operates with the object or the read/write class property represents an associative relationship in source code.
An association is represented by a solid line with optional navigation, multiplicity, roles, and name.
Example of association: the Node class (parent) can contain unlimited number of the Node and Attribute objects (children).
