Skip to content

Commit 6b7bbdd

Browse files
authored
Merge pull request #258 from asgrim/docs-updates
Review and update of docs wording
2 parents 5f56ee8 + 034a1b2 commit 6b7bbdd

File tree

3 files changed

+41
-27
lines changed

3 files changed

+41
-27
lines changed

README.md

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
# 🥧 PIE (PHP Installer for Extensions)
22

3-
> [!WARNING]
4-
> PIE is still in early development. We welcome you to try this out, but please
5-
> exercise caution when using PIE, as things may go wrong! If you do encounter
6-
> issues, please do report an issue!
7-
83
You will need PHP 8.1 or newer to run PIE, but PIE can install an extension to
94
any installed PHP version.
105

@@ -18,7 +13,7 @@ please read [extension-maintainers](./docs/extension-maintainers.md).
1813
- Download `pie.phar` either:
1914
- [latest stable release](https://github.com/php/pie/releases)
2015
- [latest unstable nightly](https://php.github.io/pie/pie-nightly.phar)
21-
- Verify the PHAR's source with `gh attestation verify pie.phar --repo php/pie`
16+
- Verify the PHAR's source with `gh attestation verify --owner php pie.phar`
2217
- You may then invoke PIE with `php pie.phar <command>`
2318

2419
Further installation details can be found in the [usage](./docs/usage.md) docs.

docs/extension-maintainers.md

Lines changed: 34 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -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

4444
The 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
6263
name regular expression, which is defined in
6364
[\Php\Pie\ExtensionName::VALID_PACKAGE_NAME_REGEX](../src/ExtensionName.php).
6465
If the `extension-name` is not specified, the `extension-name` will be derived
@@ -74,6 +75,13 @@ given a `composer.json` with:
7475
The extension name would be derived as `myextension`. The `myvendor/` vendor
7576
prefix 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+
7785
The `extension-name` SHOULD NOT be prefixed with `ext-` as is a convention in
7886
Composer 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

98106
Indicates whether the extension supports Zend Thread-Safe (ZTS) and non-Thread-
99107
Safe (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
101109
mean the extension will not be installable on the target platform.
102110

103111
Theoretically, 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
161169
result in an error `The "--something-else" option does not exist.`.
162170

163171
If 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

217228
Extension 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

223234
It 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

230245
Once you have committed your `composer.json` to your repository, you may then
231246
submit 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

docs/usage.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ order: 2
99
### Manual installation
1010

1111
- Download `pie.phar` from the [latest releases](https://github.com/php/pie/releases)
12-
- Verify the PHAR's source with `gh attestation verify pie.phar --repo php/pie`
12+
- Verify the PHAR's source with `gh attestation verify --owner php pie.phar`
13+
- Note that this step requires the [`gh` CLI command](https://github.com/cli/cli/).
1314
- You may then invoke PIE with `php pie.phar <command>`
1415
- Optionally, copy `pie.phar` into your `$PATH`, e.g. `cp pie.phar /usr/local/bin/pie`
1516
- If you copy PIE into your `$PATH`, you may then invoke PIE with `pie <command>`
@@ -24,7 +25,10 @@ running this, but this will put PIE into `/usr/local/bin/pie` on a non-Windows
2425
system:
2526

2627
```shell
27-
sudo curl -L --output /usr/local/bin/pie https://github.com/php/pie/releases/latest/download/pie.phar && sudo chmod +x /usr/local/bin/pie
28+
curl -fL --output /tmp/pie.phar https://github.com/php/pie/releases/latest/download/pie.phar \
29+
&& gh attestation verify --owner php /tmp/pie.phar \
30+
&& sudo mv /tmp/pie.phar /usr/local/bin/pie \
31+
&& sudo chmod +x /usr/local/bin/pie
2832
```
2933

3034
### Docker installation

0 commit comments

Comments
 (0)