Advanced PHP Programming (Paperback)
暫譯: 進階 PHP 程式設計 (平裝本)

George Schlossnagle

  • 出版商: SAMS
  • 出版日期: 2004-02-20
  • 售價: $2,220
  • 貴賓價: 9.5$2,109
  • 語言: 英文
  • 頁數: 672
  • 裝訂: Paperback
  • ISBN: 0672325616
  • ISBN-13: 9780672325618
  • 相關分類: PHP
  • 已絕版

買這商品的人也買了...

商品描述

 

Over the past three years PHP has evolved from being a niche language used to add dynamic functionality to small sites to a powerful tool making strong inroads into large-scale, business-critical Web systems.

The rapid maturation of PHP has created a skeptical population of users from more traditional "enterprise" languages who question the readiness and ability of PHP to scale, as well as a large population of PHP developers without formal computer science backgrounds who have learned through the hands-on experimentation while developing small and midsize applications in PHP.

While there are many books on learning PHP and developing small applications with it, there is a serious lack of information on "scaling" PHP for large-scale, business-critical systems. Schlossnagle¿s Advanced PHP Programming fills that void, demonstrating that PHP is ready for enterprise Web applications by showing the reader how to develop PHP-based applications for maximum performance, stability, and extensibility.

Table of Contents:

Introduction.

I. IMPLEMENTATION AND DEVELOPMENT METHODOLOGIES.

1. Coding Styles.

 

Choosing a Style That Is Right for You. Naming Symbols. Avoiding Confusing Code. Documentation. Further Reading.

 

2. Object-Oriented Programming through Design Patterns.

 

Introduction to OO Programming. A Brief Introduction to Design Patterns. Overloading. Further Reading.

 

3. Error Handling.

 

Handling Errors. Handling External Errors. Exceptions. When to Use Exceptions. Further Reading.

 

4. Implementing with PHP: Templates and the Web.

 

Smarty. Writing Your Own Template Solution. Further Reading.

 

5. Implementing with PHP: Standalone Scripts.

 

Introduction to the PHP Command-Line Interface (CLI). Handling Input/Output (I/O). Parsing Command-Line Arguments. Creating and Managing Child Processes. Writing Daemons. Combining What You've Learned: Monitoring. Services Further Reading.

 

6. Unit Testing.

 

An Introduction to Unit Testing. Writing Inline and Out-of-Line Unit Tests. Additional Features in PHPUnit. Test-Driven Design. Unit Testing in a Web Environment. Further Reading.

 

7. Managing the Development Environment.

 

Change Control. Managing Packaging. Further Reading.

 

8. Designing a Good API.

 

Design for Refactoring and Extensibility. Defensive Coding. Further Reading.

 

II. CACHING.

9. External Performance Tunings.

 

Language-Level Tunings. Cache-Friendly PHP Applications. Content Compression. Further Reading.

 

10. Data Component Caching.

 

Caching Issues. Recognizing Cacheable Data Components. Choosing the Right Strategy: Hand-Made or Prefab Classes. Output Buffering. In-Memory Caching. DBM-Based Caching. Shared Memory Caching. Cookie-Based Caching. Integrating Caching into Application Code. Further Reading.

 

11. Computational Reuse.

 

Introduction by Example: Fibonacci Sequences. Caching Reused Data Inside a Request. Caching Reused Data Between Requests. Computational Reuse Inside PHP. Further Reading.

 

III. DISTRIBUTED APPLICATIONS.

12. Interacting with Databases.

 

Understanding How Databases and Queries Work. Database Access Patterns. Tuning Database Access. Further Reading.

 

13. User Authentication and Session Security.

 

Simple Authentication Schemes. Registering Users. Maintaining Authentication: Ensuring That You Are Still Talking to the Same Person. Single Signon. Further Reading.

 

14. Session Handling.

 

Client-Side Sessions. Server-Side Sessions.

 

15. Building a Distributed Environment.

 

What Is a Cluster? Clustering Design Essentials. Caching in a Distributed Environment. Scaling Databases. Further Reading.

 

16. RPC: Interacting with Remote Services.

 

XML-RPC. SOAP. SOAP and XML-RPC Compared. Further Reading.

 

IV. PERFORMANCE.

17. Application Benchmarks: Testing an Entire Application.

 

Passive Identification of Bottlenecks. Load Generators. Further Reading.

 

18. Profiling.

 

What Is Needed in a PHP Profiler. A Smorgasbord of Profilers. Installing and Using APD. A Tracing Example. Profiling a Larger Application. Spotting General Inefficiencies. Removing Superfluous Functionality. Further Reading.

 

19. Synthetic Benchmarks: Evaluating Code Blocks and Functions.

 

Benchmarking Basics. Building a Benchmarking Harness. Benchmarking Examples.

 

V. EXTENSIBILITY.

20. PHP and Zend Engine Internals.

 

How the Zend Engine Works: Opcodes and Op Arrays. Variables. Functions. Classes. The PHP Request Life Cycle. Further Reading.

 

21. Extending PHP: Part I.

 

Extension Basics. An Example: The Spread Client Wrapper. Further Reading.

 

22. Extending PHP: Part II.

 

Implementing Classes. Writing Custom Session Handlers. The Streams API. Further Reading.

 

23. Writing SAPIs and Extending the Zend Engine.

 

SAPIs. Modifying and Introspecting the Zend Engine. Homework.

 

Index.

商品描述(中文翻譯)

 

在過去三年中,PHP 從一種用於為小型網站添加動態功能的利基語言,演變為一種強大的工具,正在大規模、業務關鍵的網絡系統中取得顯著進展。

PHP 的快速成熟使得來自更傳統的「企業」語言的用戶產生了懷疑,他們質疑 PHP 的可擴展性和能力,以及一大批沒有正式計算機科學背景的 PHP 開發者,他們在開發小型和中型應用程序的過程中通過實踐學習。

雖然有許多書籍介紹如何學習 PHP 及其小型應用程序的開發,但在「擴展」PHP 以適應大規模、業務關鍵系統方面卻缺乏重要資訊。Schlossnagle 的 Advanced PHP Programming 填補了這一空白,通過展示如何開發基於 PHP 的應用程序以實現最佳性能、穩定性和可擴展性,證明了 PHP 已經準備好用於企業網絡應用程序。

目錄:

導言。

I. 實施與開發方法論。

1. 編碼風格。

 

選擇適合您的風格。命名符號。避免混淆的代碼。文檔。進一步閱讀。

 

2. 通過設計模式進行面向對象編程。

 

面向對象編程簡介。設計模式簡介。重載。進一步閱讀。

 

3. 錯誤處理。

 

處理錯誤。處理外部錯誤。異常。何時使用異常。進一步閱讀。

 

4. 使用 PHP 實施:模板與網絡。

 

Smarty。編寫自己的模板解決方案。進一步閱讀。

 

5. 使用 PHP 實施:獨立腳本。

 

PHP 命令行介面 (CLI) 簡介。處理輸入/輸出 (I/O)。解析命令行參數。創建和管理子進程。編寫守護進程。結合您所學的:監控。服務進一步閱讀。

 

6. 單元測試。

 

單元測試簡介。編寫內聯和外聯單元測試。PHPUnit 中的附加功能。測試驅動設計。網絡環境中的單元測試。進一步閱讀。

 

7. 管理開發環境。

 

變更控制。管理包裝。進一步閱讀。

 

8. 設計良好的 API。

 

為重構和可擴展性設計。防禦性編碼。進一步閱讀。

 

II. 緩存。

9. 外部性能調整。

 

語言級調整。緩存友好的 PHP 應用程序。內容壓縮。進一步閱讀。

 

10. 數據組件緩存。

 

緩存問題。識別可緩存的數據組件。選擇正確的策略:手工製作或預製類。輸出緩衝。內存緩存。基於 DBM 的緩存。共享內存緩存。基於 Cookie 的緩存。將緩存集成到應用程序代碼中。進一步閱讀。

 

11. 計算重用。

 

通過示例介紹:斐波那契數列。在請求內緩存重用數據。在請求之間緩存重用數據。在 PHP 內部的計算重用。進一步閱讀。

 

III. 分佈式應用程序。

12. 與數據庫互動。

 

理解數據庫和查詢的工作原理。數據庫訪問模式。調整數據庫訪問。進一步閱讀。

 

13. 用戶身份驗證和會話安全。

 

簡單的身份驗證方案。註冊用戶。維護身份驗證:確保您仍在與同一人交談。單一登錄。進一步閱讀。

 

14. 會話處理。

 

客戶端會話。服務器端會話。

 

15. 建立分佈式環境。

 

什麼是集群?集群設計要素。在分佈式環境中緩存。擴展數據庫。進一步閱讀。

 

16. RPC:與遠程服務互動。

 

XML-RPC。SOAP。SOAP 與 XML-RPC 的比較。進一步閱讀。

 

IV. 性能。

17. 應用基準測試:測試整個應用程序。

 

被動識別瓶頸。負載生成器。進一步閱讀。

 

18. 性能分析。

 

PHP 性能分析器需要什麼。一系列性能分析器。安裝和使用 APD。一個追蹤示例。分析較大應用程序的性能。發現一般低效。去除多餘功能。進一步閱讀。

 

19. 合成基準測試:評估代碼塊和函數。

 

基準測試基礎。構建基準測試工具。基準測試示例。

 

V. 可擴展性。

20. PHP 和 Zend Engine 內部。

 

Zend Engine 的工作原理:操作碼和操作數組。變量。函數。類。PHP 請求生命週期。進一步閱讀。

 

21. 擴展 PHP:第一部分。

 

擴展基礎。一個示例:Spread 客戶端包裝器。進一步閱讀。

 

22. 擴展 PHP:第二部分。

 

實現類。編寫自定義會話處理器。Streams API。進一步閱讀。

 

23. 編寫 SAPI 和擴展 Zend Engine。

 

SAPI。修改和檢查 Zend Engine。作業。

 

索引。