0%

Book Description

Learn to leverage PHP5's OOP features to write manageable applications with ease

  • General OOP concepts explained

  • Implement Design Patterns in your applications and solve common OOP Problems

  • Take full advantage of native built-in objects

  • Test your code by writing unit tests with PHPUnit

  • In Detail

    Some basic objected-oriented features were added to PHP3; with PHP5 full support for object-oriented programming was added to PHP. Object-oriented programming was basically introduced to ease the development process as well as reduce the time of development by reducing the amount of code needed. OOP can greatly improve the performance of a properly planned and designed program.

    This book covers all the general concepts of OOP then shows you how to make use of OOP in PHP5, with the aid of an ample number of examples.

    This book will help you to understand the core object-oriented programming concepts with PHP. PHP is one of the most popular languages for web application development, and PHP5 supports OOP very well. This book will help you to master core OOP features in PHP as well as advanced Topics like Design Patterns including Model-View-Controller (MVC), and Unit Testing. It includes suggestions to help you to write good code. Moreover this book provides comprehensive documentation and working examples on the Standard PHP Library (SPL), which are hard to find elsewhere. It will really help you to leverage PHP OOP features to write manageable applications with ease.

    Table of Contents

    1. Object-Oriented Programming with PHP5
    2. Credits
    3. About the Author
    4. About the Reviewers
    5. Introduction
      1. What This Book Covers
      2. Who is This Book for
      3. Conventions
      4. Reader Feedback
      5. Customer Support
        1. Downloading the Example Code for the Book
        2. Errata
        3. Questions
    6. 1. OOP vs. Procedural Programming
      1. Introduction to PHP
        1. Ready, Set, Go
      2. A Little History of OOP in PHP
      3. Procedural vs. OO Coding Style
      4. Benefits of OOP
      5. Dissection of an Object
      6. Difference of OOP in PHP4 and PHP5
      7. Some Basic OO Terms
      8. General Coding Conventions
      9. Summary
    7. 2. Kick-Starting OOP
      1. Let's Bake Some Objects
        1. Accessing Properties and Methods from Inside the Class
      2. Using an Object
      3. Modifiers
      4. Constructors and Destructors
      5. Class Constants
      6. Extending a Class [Inheritance]
        1. Overriding Methods
        2. Preventing from Overriding
        3. Preventing from Extending
      7. Polymorphism
      8. Interface
      9. Abstract Class
      10. Static Method and Properties
      11. Accessor Methods
      12. Using Magic Methods to Set/Get Class Properties
      13. Magic Methods for Overloading Class Methods
      14. Visually Representing a Class
      15. Summary
    8. 3. More OOP
      1. Class Information Functions
        1. Checking if a Class Already Exists
        2. Finding Currently Loaded Classes
        3. Finding out if Methods and Properties Exists
        4. Checking the Type of Class
        5. Finding Out the Class Name
      2. Exception Handling
        1. Collecting all PHP Errors as Exception
      3. Iterators
      4. ArrayObject
      5. Array to Object
      6. Accessing Objects in Array Style
      7. Serialization
        1. Magic Methods in Serialization
      8. Object Cloning
      9. Autoloading Classes or Classes on Demand
      10. Method Chaining
      11. Life Cycle of an Object in PHP and Object Caching
      12. Summary
    9. 4. Design Patterns
      1. You Might have Done this Beforeā€¦
      2. Strategy Pattern
      3. Factory Pattern
      4. Abstract Factory
      5. Adapter Pattern
      6. Singleton Pattern
      7. Iterator Pattern
      8. Observer Pattern
      9. Proxy Pattern or Lazy Loading
      10. Decorator Pattern
      11. Active Record Pattern
      12. Facade Pattern
      13. Summary
    10. 5. Reflection and Unit Testing
      1. Reflection
        1. ReflectionClass
      2. ReflectionMethod
      3. ReflectionParameter
      4. ReflectionProperty
      5. Unit Testing
        1. Benefits of Unit Testing
        2. A small Introduction to Vulnerable Bugs
        3. Preparing for Unit Testing
        4. Starting Unit Testing
        5. Testing an Email Validator Object
        6. Unit Testing for Everyday Script
        7. Test Driven Development
          1. Writing Multiple Assertions
        8. PHPUnit API
      6. Summary
    11. 6. Standard PHP Library
      1. Available Objects in SPL
      2. ArrayObject
      3. ArrayIterator
      4. DirectoryIterator
      5. RecursiveDirectoryIterator
      6. RecursiveIteratorIterator
      7. AppendIterator
      8. FilterIterator
      9. LimitIterator
      10. NoRewindIterator
      11. SeekableIterator
      12. RecursiveIterator
      13. SPLFileObject
      14. SPLFileInfo
      15. SPLObjectStorage
      16. Summary
    12. 7. Database in an OOP Way
      1. Introduction to MySQLi
        1. Connecting to MySQL in an OO Way
        2. Selecting Data in an OO Way
        3. Updating Data in an OO Way
        4. Prepared Statements
          1. Basic Prepared Statements
          2. Prepared Statements with Variables
        5. Using BLOB with Prepared Statements
        6. Executing Stored Procedure with MySQLi and PHP
      2. PDO
        1. DSN Settings for Different Databases Engines
        2. Using Prepared Statements with PDO
        3. Calling Stored Procedures
        4. Other Interesting Functions
      3. Introduction to Data Abstraction Layers
        1. ADOdb
          1. Installing ADOdb
          2. Connecting to Different Databases
          3. Basic Database Operations using ADOdb
          4. Inserting, Deleting, and Updating Records
          5. Executing Prepared Statements
        2. MDB2
          1. Installing MDB2
          2. Connecting to Database
          3. Executing Prepared Statements
      4. Introduction to ActiveRecord
        1. Creating a New Record via ActiveRecord
        2. Selecting and Updating Data
      5. Summary
    13. 8. Cooking XML with OOP
      1. Formation of XML
      2. Introduction to SimpleXML
        1. Parsing Documents
        2. Accessing Attributes
        3. Parsing Flickr Feeds using SimpleXML
        4. Managing CDATA Sections using SimpleXML
        5. XPath
        6. DOM API
      3. Modifying Existing Documents
      4. Other Useful Functions
      5. Summary
    14. 9. Building Better with MVC
      1. What is MVC?
      2. Planning for the Project
      3. Designing the Bootstrap File
      4. Adding Database Support
        1. Drivers
      5. Building Applications over our Framework
        1. Authentication Controller
      6. Summary
    18.119.111.9