diff --git a/internals2/intro.xml b/internals2/intro.xml index f92a73926f..5c2eb31583 100644 --- a/internals2/intro.xml +++ b/internals2/intro.xml @@ -1,5 +1,23 @@ - + + + + The Zend API has evolved considerably over time, as PHP has become a more diff --git a/internals2/structure/files.xml b/internals2/structure/files.xml new file mode 100644 index 0000000000..36fb1c1bce --- /dev/null +++ b/internals2/structure/files.xml @@ -0,0 +1,153 @@ + + + + Files which make up an extension + + Whether created by hand, using ext_skel, or by an + alternate extension generator, such as + CodeGen, + all extensions will have at least four files: + + + + + config.m4 + + + UNIX build system configuration (see + ) + + + + + + config.w32 + + + Windows buildsystem configuration (see + ) + + + + + + php_example.h + + + Main extension header file. By convention, the name of this file is + php_ prepended to the extension name, but this is not + a requirement. This file contains macros, prototypes, and globals, just + like any header. + + + + + + example.c + + + Main extension source file. Again by convention, this name of this file + is the extension name, but again this is not a requirement. This file + contains the module structure declaration, INI entries, management + functions, userspace functions, and other requirements of an extension. + + + + + + + The buildsystem files are discussed elsewhere; this section concentrates on + the rest. These four files make up the bare minimum for an extension, which + may also contain any number of headers, source files, unit tests, and other + support files. The list of files in a realistic extension might look like + this: + + + + Files in an example "real" extension, in no particular order + + + + + + + Non-source files + + The .cvsignore file is used for extensions which are + checked into one of the PHP CVS repositories (usually + &link.pecl;); the one generated by ext_skel contains: + + + + + + + + + + These lines tell CVS to ignore interim files generated + by the PHP buildsystem. This is only a convenience, and can be omitted + completely without ill effect. + + + + The CREDITS file lists the contributors and/or + maintainers of the extension in plain text format, preferably including + contact information, and sometimes a website for the extension. This file + is only one way to document this information. In a &link.pecl; package, + this information is already maintained in package.xml, + for example. This is another file which can be omitted without ill effect. + + + + The package.xml file is specific to &link.pecl;-based + extensions; it is a metainformation file which gives details about an + extension's dependencies, authors, installation requirements, and other + tidbits. In an extension not being hosted in &link.pecl;, this file is + extraneous. + + + + + + diff --git a/internals2/structure/globals.xml b/internals2/structure/globals.xml new file mode 100644 index 0000000000..1de903aba4 --- /dev/null +++ b/internals2/structure/globals.xml @@ -0,0 +1,27 @@ + + + + Extension globals + + + + diff --git a/internals2/structure/index.xml b/internals2/structure/index.xml index 4aa653393d..d9d0843883 100644 --- a/internals2/structure/index.xml +++ b/internals2/structure/index.xml @@ -1,9 +1,24 @@ - - + + + Extension structure + Many extension-writing guides focus on simple examples first and ignore the + requirements of more complex implementations until later. Often such guides + must repeat themselves over and over in order to describe these new + features. This section describes extension structure from the perspective of + a mature, practical implementation, in order to prepare users for needs and + issues they will almost always encounter in the process of extension + development. + + &internals2.structure.files; + &internals2.structure.modstruct; + &internals2.structure.globals; + &internals2.structure.lifecycle; + &internals2.structure.tests; + + + Life cycle of an extension + + + + diff --git a/internals2/structure/modstruct.xml b/internals2/structure/modstruct.xml new file mode 100644 index 0000000000..77f4857085 --- /dev/null +++ b/internals2/structure/modstruct.xml @@ -0,0 +1,27 @@ + + + + The zend_module structure + + + + diff --git a/internals2/structure/tests.xml b/internals2/structure/tests.xml new file mode 100644 index 0000000000..659969843e --- /dev/null +++ b/internals2/structure/tests.xml @@ -0,0 +1,27 @@ + + + + Testing an extension + + + +