Table of Contents
Introduction
Chapter 1: OOP vs. Procedural Programming
Chapter 2: Kick-Starting OOP
Chapter 3: More OOP
Chapter 4: Design Patterns
Chapter 5: Reflection and Unit Testing
Chapter 6: Standard PHP Library
Chapter 7: Database in an OOP Way
Chapter 8: Cooking XML with OOP
Chapter 9: Building Better with MVC
Index
- Chapter 1: OOP vs. Procedural Programming
- Introduction to PHP
- Ready, Set, Go
- 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
- Introduction to PHP
- Chapter 2: Kick-Starting OOP
- Let's Bake Some Objects
- Accessing Properties and Methods from Inside the Class
- Using an Object
- Modifiers
- Constructors and Destructors
- Class Constants
- Extending a Class [Inheritance]
- Overriding Methods
- Preventing from Overriding
- Preventing from Extending
- 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
- Let's Bake Some Objects
- Chapter 3: More OOP
- Class Information Functions
- Checking if a Class Already Exists
- Finding Currently Loaded Classes
- Finding out if Methods and Properties Exists
- Checking the Type of Class
- Finding Out the Class Name
- Exception Handling
- Collecting all PHP Errors as Exception
- Iterators
- ArrayObject
- Array to Object
- Accessing Objects in Array Style
- Serialization
- Magic Methods in Serialization
- Object Cloning
- Autoloading Classes or Classes on Demand
- Method Chaining
- Life Cycle of an Object in PHP and Object Caching
- Summary
- Class Information Functions
- Chapter 4: 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
- Chapter 5: Reflection and Unit Testing
- Reflection
- ReflectionClass
- ReflectionMethod
- ReflectionParameter
- ReflectionProperty
- Unit Testing
- Benefits of Unit Testing
- A small Introduction to Vulnerable Bugs
- Preparing for Unit Testing
- Starting Unit Testing
- Testing an Email Validator Object
- Unit Testing for Everyday Script
- Test Driven Development
- Writing Multiple Assertions
- PHPUnit API
- Summary
- Reflection
- Chapter 6: Standard PHP Library
- Available Objects in SPL
- ArrayObject
- ArrayIterator
- DirectoryIterator
- RecursiveDirectoryIterator
- RecursiveIteratorIterator
- AppendIterator
- FilterIterator
- LimitIterator
- NoRewindIterator
- SeekableIterator
- RecursiveIterator
- SPLFileObject
- SPLFileInfo
- SPLObjectStorage
- Summary
- Chapter 7: Database in an OOP Way
- Introduction to MySQLi
- Connecting to MySQL in an OO Way
- Selecting Data in an OO Way
- Updating Data in an OO Way
- Prepared Statements
- Basic Prepared Statements
- Prepared Statements with Variables
- Using BLOB with Prepared Statements
- Executing Stored Procedure with MySQLi and PHP
- PDO
- DSN Settings for Different Databases Engines
- Using Prepared Statements with PDO
- Calling Stored Procedures
- Other Interesting Functions
- Introduction to Data Abstraction Layers
- ADOdb
- Installing ADOdb
- Connecting to Different Databases
- Basic Database Operations using ADOdb
- Inserting, Deleting, and Updating Records
- Executing Prepared Statements
- MDB2
- Installing MDB2
- Connecting to Database
- Executing Prepared Statements
- ADOdb
- Introduction to ActiveRecord
- Creating a New Record via ActiveRecord
- Selecting and Updating Data
- Summary
- Introduction to MySQLi
- Chapter 8: Cooking XML with OOP
- Formation of XML
- Introduction to SimpleXML
- Parsing Documents
- Accessing Attributes
- Parsing Flickr Feeds using SimpleXML
- Managing CDATA Sections using SimpleXML
- XPath
- DOM API
- Modifying Existing Documents
- Other Useful Functions
- Summary
- Chapter 9: Building Better with MVC
- What is MVC?
- Planning for the Project
- Designing the Bootstrap File
- Adding Database Support
- Drivers
- Building Applications over our Framework
- Authentication Controller
- Summary