@@ -42,23 +42,24 @@ flow is quite similar to adding a regular PHP package into Packagist.
4242### Add a ` composer.json ` to your extension
4343
4444The first step to adding PIE support is adding a ` composer.json ` to your
45- extension repository. Most of the typical fields are the same, with a few
46- notable exceptions:
45+ extension repository. Most of the typical fields are the same as a regular
46+ Composer package, with a few notable exceptions:
4747
4848 * The ` type ` MUST be either ` php-ext ` for a PHP Module (this will be most
4949 extensions), or ` php-ext-zend ` for a Zend Extension.
50- * An additional ` php-ext ` section MAY exist.
51- * The Composer package name (i.e. the top level ` name ` field) should follow
50+ * An additional ` php-ext ` section MAY exist (see below for the directives
51+ that can be within ` php-ext ` )
52+ * The Composer package name (i.e. the top level ` name ` field) MUST follow
5253 the usual Composer package name format, i.e. ` <vendor>/<package> ` .
5354 * However, please note that the Composer package name for a PIE extension
54- cannot share the same Composer package name as a regular PHP package, even
55+ MUST NOT share the same Composer package name as a regular PHP package, even
5556 if they have different ` type ` fields.
5657
5758#### The ` php-ext ` definition
5859
5960##### ` extension-name `
6061
61- The ` extension-name ` SHOULD be specified, and must conform to the usual extension
62+ The ` extension-name ` MAY be specified, and MUST conform to the usual extension
6263name regular expression, which is defined in
6364[ \Php\Pie\ExtensionName::VALID_PACKAGE_NAME_REGEX] ( ../src/ExtensionName.php ) .
6465If the ` extension-name ` is not specified, the ` extension-name ` will be derived
@@ -74,6 +75,13 @@ given a `composer.json` with:
7475The extension name would be derived as ` myextension ` . The ` myvendor/ ` vendor
7576prefix is removed.
7677
78+ > [ !WARNING]
79+ > If your Composer package name would result in an invalid PHP extension name,
80+ > you MUST specify the ` extension-name ` directive. For example a Composer
81+ > package name ` myvendor/my-extension ` would result in an invalid PHP extension
82+ > name, since hypens are not allowed, so you MUST specify a valid
83+ > ` extension-name ` for this Composer package name.
84+
7785The ` extension-name ` SHOULD NOT be prefixed with ` ext- ` as is a convention in
7886Composer when using ` require ` .
7987
@@ -90,14 +98,14 @@ An example of `extension-name` being used:
9098
9199##### ` priority `
92100
93- ` priority ` is currently not used, but will form part of the ` ini ` filename to
94- control ordering of extensions, if the target platform uses it .
101+ ` priority ` forms part of the ` ini ` filename to control ordering of extensions,
102+ if the target platform uses the multiple INI files in a directory .
95103
96104##### ` support-zts ` and ` support-nts `
97105
98106Indicates whether the extension supports Zend Thread-Safe (ZTS) and non-Thread-
99107Safe (NTS) modes. Both these flags default to ` true ` if not specified, but if
100- your extension does not support either mode, it should be specified, and will
108+ your extension does not support either mode, it MUST be specified, and will
101109mean the extension will not be installable on the target platform.
102110
103111Theoretically, it is possible to specify ` false ` for both ` support-zts ` and
@@ -161,8 +169,9 @@ an invalid option, such as `pie install myvendor/myext --something-else` will
161169result in an error ` The "--something-else" option does not exist. ` .
162170
163171If an end user does not specify a flag defined in the ` configure-options `
164- definition, it will simply not be passed to ` ./configure ` . There is no way to
165- specify a default value in the ` configure-options ` definition.
172+ definition, it will not be passed to ` ./configure ` . There is no way to specify
173+ a default value in the ` configure-options ` definition. Your ` config.m4 ` should
174+ handle this accordingly.
166175
167176##### ` build-path `
168177
@@ -211,27 +220,33 @@ change the behaviour of downloading the source package.
211220 assets list based matching one of the following naming conventions:
212221 * ` php_{ExtensionName}-{Version}-src.tgz ` (e.g. ` php_myext-1.20.1-src.tgz ` )
213222 * ` php_{ExtensionName}-{Version}-src.zip ` (e.g. ` php_myext-1.20.1-src.zip ` )
223+ * ` {ExtensionName}-{Version}.tgz ` (this is intended for backwards
224+ compatibility with PECL packages)
214225
215226#### Extension dependencies
216227
217228Extension authors may define some dependencies in ` require ` , but practically,
218- most extensions would not need to define dependencies. Dependencies on other
219- extensions may be defined, for example ` ext-json ` . However, dependencies on
220- a regular PHP package (such as ` monolog/monolog ` ) are ignored when requesting
221- an installation of an extension with PIE .
229+ most extensions would not need to define dependencies, except for the PHP
230+ versions supported by the extension. Dependencies on other extensions may be
231+ defined, for example ` ext-json ` . However, dependencies on a regular PHP package
232+ (such as ` monolog/monolog ` ) SHOULD NOT be specified in your ` require ` section .
222233
223234It is worth noting that if your extension does define a dependency on another
224- dependency, this would prevent installation of the extension, and at the moment
225- the messaging around this is
226- [ not particularly clear] ( https://github.com/php/pie/issues/15 ) .
235+ dependency, and this is not available, someone installing your extension would
236+ receive a message such as:
237+
238+ ```
239+ Cannot use myvendor/myextension's latest version 1.2.3 as it requires
240+ ext-something * which is missing from your platform.
241+ ```
227242
228243### Submit the extension to Packagist
229244
230245Once you have committed your ` composer.json ` to your repository, you may then
231246submit it to Packagist in the same way as any other package.
232247
233248 * Head to [ https://packagist.org/packages/submit ] ( https://packagist.org/packages/submit )
234- * Enter the URL of your repository, and follow the instructions.
249+ * Enter the URL of your repository and follow the instructions.
235250
236251### Windows Support
237252
0 commit comments