PHP Master Write Cutting-Edge Code
Curious to see what we’ve got in store for you?
Good, because there’s plenty of meaty technique to get your teeth into along with lots of tips and tricks. Have a look through the table of contents to see what’s covered.
Table of Contents
Preface
- Who Should Read This Book
- What's in This Book
- Where to Find Help
- The SitePoint Forums
- The Book's Website
- The SitePoint Newsletters
- The SitePoint Podcast
- Your Feedback
- Acknowledgments
- Lorna Mitchell
- Davey Shafik
- Matthew Turland
- Conventions Used in This Book
- Code Samples
- Tips, Notes, and Warnings
1. Object Oriented Programming
- Why OOP?
- Vocabulary of OOP
- Introduction to OOP
- Declaring a Class
- Class Constructors
- Instantiating an Object
- Autoloading
- Using Objects
- Using Static Properties and Methods
- Objects and Namespaces
- Object Inheritance
- Objects and Functions
- Type Hinting
- Polymorphism
- Objects and References
- Passing Objects as Function Parameters
- Fluent Interfaces
public,private, andprotectedpublicprivateprotected- Choosing the Right Visibility
- Using Getters and Setters to Control Visibility
- Using Magic
__getand__setMethods
- Interfaces
- SPL Countable Interface Example
- Counting Objects
- Declaring and Using an Interface
- Identifying Objects and Interfaces
- Exceptions
- Handling Exceptions
- Why Exceptions?
- Throwing Exceptions
- Extending Exceptions
- Catching Specific Types of Exception
- Setting a Global Exception Handler
- Working with Callbacks
- More Magic Methods
- Using
__call()and __callStatic() - Printing Objects with
__toString() - Serializing Objects
- Using
- Objective Achieved
- Why OOP?
2. Databases
- Persistent Data and Web Applications
- Choosing How to Store Data
- Building a Recipe Website with MySQL
- Creating the Tables
- PHP Database Objects
- Connecting to MySQL with
PDO - Selecting Data from a Table
- Data Fetching Modes
- Parameters and Prepared Statements
- Binding Values and Variables to Prepared Statements
- Inserting a Row and Getting Its ID
- How many rows were inserted, updated, or deleted?
- Deleting Data
- Connecting to MySQL with
- Dealing with Errors in
PDO- Handling Problems When Preparing
- Handling Problems When Executing
- Handling Problems When Fetching
- Advanced PDO Features
- Transactions and PDO
- Stored Procedures and PDO
- Designing Databases
- Primary Keys and Indexes
- MySQL Explain
- Inner Joins
- Outer Joins
- Aggregate Functions and Group By
- Normalizing Data
- Databases—sorted!
3. APIs
- Before You Begin
- Tools for Working with APIs
- Adding APIs into Your System
- Service-oriented Architecture
- Data Formats
- Working with JSON
- Working with XML
- HTTP: HyperText Transfer Protocol
- The HTTP Envelope
- Making HTTP Requests
- HTTP Status Codes
- HTTP Headers
- HTTP Verbs
- Understanding and Choosing Service Types
- PHP and SOAP
- Describing a SOAP Service with a WSDL
- Debugging HTTP
- Using Logging to Gather Information
- Inspecting HTTP Traffic
- RPC Services
- Consuming an RPC Service: Flickr Example
- Building an RPC Service
- Ajax and Web Services
- Cross-domain Requests
- Developing and Consuming RESTful Services
- Beyond Pretty URLs
- RESTful Principles
- Building a RESTful Service
- Designing a Web Service
- Service Provided
- Before You Begin
4. Design Patterns
- What Are Design Patterns?
- Choosing the Right One
- Singleton
- Traits
- Registry
- Factory
- Iterator
- Observer
- Dependency Injection
- Model-View-Controller
- Pattern Formation
- What Are Design Patterns?
5. Security
- Be Paranoid
- Filter Input, Escape Output
- Filtering and Validation
- Cross-site Scripting
- The Attack
- The Fix
- Online Resources
- Cross-site Request Forgery
- The Attack
- The Fix
- Online Resources
- Session Fixation
- The Attack
- The Fix
- Online Resources
- Session Hijacking
- The Attack
- The Fix
- Online Resources
- SQL Injection
- The Attack
- The Fix
- Online Resources
- Storing Passwords
- The Attack
- The Fix
- Online Resources
- Brute Force Attacks
- The Attack
- The Fix
- Online Resources
- SSL
- The Attack
- The Fix
- Online Resources
- Resources
6. Performance
- Benchmarking
- System Tweaks
- Code Caching
- INI Settings
- Databases
- File System
- Caching
- Profiling
- Installing XHProf
- Installing XHGui
- Summary
7. Automated Testing
- Unit Testing
- Installing PHPUnit
- Writing Test Cases
- Running Tests
- Test Doubles
- Writing Testable Code
- Testing for Views and Controllers
- Database Testing
- Database Test Cases
- Connections
- Data Sets
- Assertions
- Systems Testing
- Initial Setup
- Commands
- Locators
- Assertions
- Database Integration
- Debugging
- Automating Writing Tests
- Load Testing
ab- Siege
- Tried and Tested
- Unit Testing
8. Quality Assurance
- Measuring Quality with Static Analysis Tools
- phploc
- phpcpd
- phpmd
- Coding Standards
- Checking Coding Standards with PHP Code Sniffer
- Viewing Coding Standards Violations
- PHP Code Sniffer Standards
- Documentation and Code
- Using phpDocumentor
- Other Documentation Tools
- Source Control
- Working with Centralized Version Control
- Using Subversion for Source Control
- Designing Repository Structure
- Distributed Version Control
- Social Tools for Coding
- Using Git for Source Control
- The Repository as the Root of the Build Process
- Automated Deployment
- Instantly Switching to a New Version
- Managing Database Changes
- Automated Deployment and Phing
- Ready to Deploy
- Measuring Quality with Static Analysis Tools
A. PEAR and PECL
- What is PEAR?
- What is PECL?
- Installing Packages
- PEAR Channels
- Using PEAR Code
- Installing Extensions
- Compiling Extensions by Hand
- Creating Packages
- Package Versioning
- Creating a Channel
- Now What?
B. SPL: The Standard PHP Library
ArrayAccessandArrayObject- Autoloading
- Working with Directories and Files
- Countable
- Data Structures
- Fixed-size Arrays
- Lists
- Stacks and Queues
- Heaps
- Priority Queues
- Functions
C. Next Steps
- Keep Reading
- Attending Events
- User Groups
- Online Communities
- Open Source Projects
- Index
More Information
More Details
Author Notes
This book is everything I wish I'd had when making that step from “can hack code” to “software engineer”…
Lorna Mitchell
Author
LornaJane.net
Customer Reviews
Live, unmoderated reviews from our customers, typos and all.
A good introduction to Object Oriented Programming, for those who have only using a procedural style. The appendix also covers PEAR and PECL.
Shane Goodman, USA 
22 Mar 2013
The book is so fast in some chapters and slow in others.
For OOP need first UML diagram in any exmaple like cahpter 1 (interface,inheritance)
Hector J. Sosa Treviño, USA 
could not say I still have not received my book
Nicholas Hall, USA 
