AS YOU'VE NO DOUBT NOTICED, EVERY PHP extension contains a few very commonand frankly boringstructures and files. When starting a new extension, it would make sense to begin with these common structures already in place and only have to worry about filling in the functional bits. To that end, there's a very simple, very practical shell script included with the standard PHP distribution.
The PHP Life Cycle
Variables from the Inside Out
Memory Management
Setting Up a Build Environment
Your First Extension
Returning Values
Accepting Parameters
Working with Arrays and HashTables
The Resource Data Type
PHP4 Objects
PHP5 Objects
Startup, Shutdown, and a Few Points in Between
INI Settings
Accessing Streams
Implementing Streams
Diverting the Stream
Configuration and Linking
Extension Generators
Setting Up a Host Environment
Advanced Embedding
Appendix A. A Zend API Reference
Appendix B. PHPAPI
Appendix C. Extending and Embedding Cookbook
Appendix D. Additional Resources