Streams Overview

Often a direct file descriptor will be less CPU- and memory-intensive than calling through the streams layer; however, it places all the work of implementing a particular protocol on you as the extension writer. By hooking into the streams layer, your extension code can transparently use any of the built-in stream wrappers such as HTTP, FTP, and their SSL-enabled counterparts, as well as the gzip and bzip2 compression wrappers. By including certain PEAR or PECL modules, your code also has access to other protocols such as SSH2, WebDav, and even Gopher!

This chapter will introduce the basic API for working with streams from the internals. Later on, in Chapter 16, "Diverting the Stream," you'll take a look at more advanced concepts like applying filters and using context options and parameters.

Категории