PacktLib: Object-Oriented Programming with PHP5

Object-Oriented Programming with PHP5

Credits

About the Author

About the Reviewers

Introduction

OOP vs. Procedural Programming

Introduction to PHP

A Little History of OOP in PHP

Procedural vs. OO Coding Style

Benefits of OOP

Dissection of an Object

Difference of OOP in PHP4 and PHP5

Some Basic OO Terms

General Coding Conventions

Summary

Kick-Starting OOP

Let's Bake Some Objects

Using an Object

Modifiers

Constructors and Destructors

Class Constants

Extending a Class [Inheritance]

Polymorphism

Interface

Abstract Class

Static Method and Properties

Accessor Methods

Using Magic Methods to Set/Get Class Properties

Magic Methods for Overloading Class Methods

Visually Representing a Class

Summary

More OOP

Class Information Functions

Exception Handling

Iterators

ArrayObject

Array to Object

Accessing Objects in Array Style

Serialization

Object Cloning

Autoloading Classes or Classes on Demand

Method Chaining

Life Cycle of an Object in PHP and Object Caching

Summary

Design Patterns

You Might have Done this Before…

Strategy Pattern

Factory Pattern

Abstract Factory

Adapter Pattern

Singleton Pattern

Iterator Pattern

Observer Pattern

Proxy Pattern or Lazy Loading

Decorator Pattern

Active Record Pattern

Facade Pattern

Summary

Reflection and Unit Testing

Reflection

ReflectionMethod

ReflectionParameter

ReflectionProperty

Unit Testing

Summary

Standard PHP Library

Available Objects in SPL

ArrayObject

ArrayIterator

DirectoryIterator

RecursiveDirectoryIterator

RecursiveIteratorIterator

AppendIterator

FilterIterator

LimitIterator

NoRewindIterator

SeekableIterator

RecursiveIterator

SPLFileObject

SPLFileInfo

SPLObjectStorage

Summary

Database in an OOP Way

Introduction to MySQLi

PDO

Introduction to Data Abstraction Layers

Introduction to ActiveRecord

Summary

Cooking XML with OOP

Formation of XML

Introduction to SimpleXML

Modifying Existing Documents

Other Useful Functions

Summary

Building Better with MVC

What is MVC?

Planning for the Project

Designing the Bootstrap File

Adding Database Support

Building Applications over our Framework

Summary

Index