PHP Master

Book Description

PHP Master is tailor-made for the PHP developer who's serious about taking their server-side applications to the next level and who wants to really keep ahead of the game by adhering to best practice, employing the most effective object-oriented programming techniques, wrapping projects in layers of security and ensuring their code is doing its job perfectly.

Table of Contents

  1. PHP Master: Write Cutting-edge Code (1/2)
  2. PHP Master: Write Cutting-edge Code (2/2)
  3. Table of Contents (1/2)
  4. Table of Contents (2/2)
  5. Preface
    1. Who Should Read This Book
    2. What’s in This Book
    3. Where to Find Help
      1. The SitePoint Forums
      2. The Book’s Website
        1. The Code Archive
        2. Updates and Errata
    4. The SitePoint Newsletters
    5. The SitePoint Podcast
    6. Your Feedback
    7. Acknowledgments
      1. Lorna Mitchell
      2. Davey Shafik
      3. Matthew Turland
    8. Conventions Used in This Book
      1. Code Samples
      2. Tips, Notes, and Warnings
  6. Object Oriented Programming
    1. Why OOP?
      1. Vocabulary of OOP
    2. Introduction to OOP
      1. Declaring a Class
      2. Class Constructors
      3. Instantiating an Object
      4. Autoloading
      5. Using Objects
      6. Using Static Properties and Methods
      7. Objects and Namespaces
    3. Object Inheritance
    4. Objects and Functions
      1. Type Hinting
      2. Polymorphism
      3. Objects and References
      4. Passing Objects as Function Parameters
      5. Fluent Interfaces
    5. public, private, and protected
      1. public
      2. private
      3. protected
      4. Choosing the Right Visibility
      5. Using Getters and Setters to Control Visibility
      6. Using Magic __get and __set Methods
    6. Interfaces
      1. SPL Countable Interface Example
      2. Counting Objects
      3. Declaring and Using an Interface
      4. Identifying Objects and Interfaces
    7. Exceptions
      1. Handling Exceptions
      2. Why Exceptions?
      3. Throwing Exceptions
      4. Extending Exceptions
      5. Catching Specific Types of Exception
      6. Setting a Global Exception Handler
      7. Working with Callbacks
    8. More Magic Methods
      1. Using __call() and __callStatic()
      2. Printing Objects with __toString()
      3. Serializing Objects
    9. Objective Achieved
  7. Databases
    1. Persistent Data and Web Applications
    2. Choosing How to Store Data
    3. Building a Recipe Website with MySQL
      1. Creating the Tables
    4. PHP Database Objects
      1. Connecting to MySQL with PDO
      2. Selecting Data from a Table
      3. Data Fetching Modes
      4. Parameters and Prepared Statements
      5. Binding Values and Variables to Prepared Statements
      6. Inserting a Row and Getting Its ID
      7. How many rows were inserted, updated, or deleted?
      8. Deleting Data
    5. Dealing with Errors in PDO
      1. Handling Problems When Preparing
      2. Handling Problems When Executing
      3. Handling Problems When Fetching
    6. Advanced PDO Features
      1. Transactions and PDO
      2. Stored Procedures and PDO
    7. Designing Databases
      1. Primary Keys and Indexes
      2. MySQL Explain
        1. Foreign Keys
        2. Handling Many-to-Many Relationships
      3. Inner Joins
      4. Outer Joins
      5. Aggregate Functions and Group By
      6. Normalizing Data
    8. Databases—sorted!
  8. APIs
    1. Before You Begin
      1. Tools for Working with APIs
      2. Adding APIs into Your System
    2. Service-oriented Architecture
    3. Data Formats
      1. Working with JSON
      2. Working with XML
    4. HTTP: HyperText Transfer Protocol
      1. The HTTP Envelope
      2. Making HTTP Requests
        1. cURL
        2. PHP cURL Extension
        3. PHP pecl_http Extension
        4. PHP Streams
      3. HTTP Status Codes
      4. HTTP Headers
        1. Accept and Content-Type
      5. HTTP Verbs
    5. Understanding and Choosing Service Types
      1. PHP and SOAP
      2. Describing a SOAP Service with a WSDL
    6. Debugging HTTP
      1. Using Logging to Gather Information
      2. Inspecting HTTP Traffic
    7. RPC Services
      1. Consuming an RPC Service: Flickr Example
      2. Building an RPC Service
    8. Ajax and Web Services
      1. Cross-domain Requests
    9. Developing and Consuming RESTful Services
      1. Beyond Pretty URLs
      2. RESTful Principles
      3. Building a RESTful Service
        1. Using Rewrite Rules to Redirect to index.php
        2. Collecting Incoming Data
        3. Routing the Requests
        4. A Note on Data Storage
        5. GETting One Event or Many
        6. Creating Data with POST Requests
        7. Updating Resources with PUT
        8. DELETEing Records
    10. Designing a Web Service
    11. Service Provided
  9. Design Patterns
    1. What Are Design Patterns?
      1. Choosing the Right One
      2. Singleton
        1. Problems with Singletons
      3. Traits
      4. Registry (1/2)
      5. Registry (2/2)
      6. Factory
      7. Iterator (1/3)
      8. Iterator (2/3)
      9. Iterator (3/3)
      10. Observer
      11. Dependency Injection
      12. Model-View-Controller (1/3)
      13. Model-View-Controller (2/3)
      14. Model-View-Controller (3/3)
        1. The Controller
        2. The Model
        3. The View
    2. Pattern Formation
  10. Security
    1. Be Paranoid
    2. Filter Input, Escape Output
      1. Filtering and Validation
    3. Cross-site Scripting
      1. The Attack
      2. The Fix
      3. Online Resources
    4. Cross-site Request Forgery
      1. The Attack
      2. The Fix
      3. Online Resources
    5. Session Fixation
      1. The Attack
      2. The Fix
      3. Online Resources
    6. Session Hijacking
      1. The Attack
      2. The Fix
      3. Online Resources
    7. SQL Injection
      1. The Attack
      2. The Fix
      3. Online Resources
    8. Storing Passwords
      1. The Attack
      2. The Fix
      3. Online Resources
    9. Brute Force Attacks
      1. The Attack
      2. The Fix
      3. Online Resources
    10. SSL
      1. The Attack
      2. The Fix
      3. Online Resources
    11. Resources
  11. Performance
    1. Benchmarking
    2. System Tweaks
      1. Code Caching
      2. INI Settings
    3. Databases
    4. File System
      1. Caching
        1. Disk Cache
        2. APC
        3. Memcached
    5. Profiling
      1. Installing XHProf
      2. Installing XHGui (1/2)
      3. Installing XHGui (2/2)
    6. Summary
  12. Automated Testing
    1. Unit Testing
      1. Installing PHPUnit
      2. Writing Test Cases
      3. Running Tests
      4. Test Doubles
      5. Writing Testable Code (1/2)
      6. Writing Testable Code (2/2)
      7. Testing for Views and Controllers
    2. Database Testing
      1. Database Test Cases
      2. Connections
      3. Data Sets
      4. Assertions
    3. Systems Testing
      1. Initial Setup
      2. Commands
      3. Locators
      4. Assertions
      5. Database Integration
      6. Debugging
      7. Automating Writing Tests
    4. Load Testing
      1. ab
      2. Siege
    5. Tried and Tested
  13. Quality Assurance
    1. Measuring Quality with Static Analysis Tools
      1. phploc
      2. phpcpd
      3. phpmd
    2. Coding Standards
      1. Checking Coding Standards with PHP Code Sniffer
      2. Viewing Coding Standards Violations
      3. PHP Code Sniffer Standards
    3. Documentation and Code
      1. Using phpDocumentor
      2. Other Documentation Tools
    4. Source Control
      1. Working with Centralized Version Control
      2. Using Subversion for Source Control
      3. Designing Repository Structure
        1. Branch-per-version
        2. Branch-per-feature
      4. Distributed Version Control
      5. Social Tools for Coding
      6. Using Git for Source Control
      7. The Repository as the Root of the Build Process
    5. Automated Deployment
      1. Instantly Switching to a New Version
      2. Managing Database Changes
      3. Automated Deployment and Phing
    6. Ready to Deploy
  14. Appendix A: PEAR and PECL
    1. What is PEAR?
    2. What is PECL?
    3. Installing Packages
      1. PEAR Channels
      2. Using PEAR Code
    4. Installing Extensions
      1. Compiling Extensions by Hand
    5. Creating Packages
    6. Package Versioning
    7. Creating a Channel
    8. Now What?
  15. Appendix B: SPL: The Standard PHP Library
    1. ArrayAccess and ArrayObject
    2. Autoloading
    3. Working with Directories and Files
    4. Countable
    5. Data Structures
      1. Fixed-size Arrays
      2. Lists
      3. Stacks and Queues
      4. Heaps
      5. Priority Queues
      6. Functions
  16. Appendix C: Next Steps
    1. Keep Reading
    2. Attending Events
    3. User Groups
    4. Online Communities
    5. Open Source Projects
  17. Index (1/4)
  18. Index (2/4)
  19. Index (3/4)
  20. Index (4/4)

Product Information

  • Title: PHP Master
  • Author(s): Matthew Turland, Lorna Mitchell, Davey Shafik
  • Release date: October 2011
  • Publisher(s): SitePoint
  • ISBN: 9780987090874