Skip to content

Commit 357d0bf

Browse files
authored
Merge pull request #262 from asgrim/docs-improvements
Documentation improvements
2 parents 6b7bbdd + d041cb5 commit 357d0bf

File tree

2 files changed

+82
-0
lines changed

2 files changed

+82
-0
lines changed

README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,31 @@
11
# 🥧 PIE (PHP Installer for Extensions)
22

3+
## What is PIE?
4+
5+
PIE is a new installer for PHP extensions, intended to eventually replace PECL.
6+
It is distributed as a [PHAR](https://www.php.net/manual/en/intro.phar.php),
7+
just like Composer, and works in a similar way to Composer, but it installs PHP
8+
extensions (PHP Modules or Zend Extensions) to your PHP installation, rather
9+
than pulling PHP packages into your project or library.
10+
11+
## What do I need to get started?
12+
313
You will need PHP 8.1 or newer to run PIE, but PIE can install an extension to
414
any installed PHP version.
515

16+
On Linux, you will need a build toolchain installed. On Debian/Ubuntu type
17+
systems, you could run something like:
18+
19+
```shell
20+
sudo apt install gcc make autoconf libtool bison re2c pkg-config
21+
```
22+
23+
On Windows, you do not need any build toolchain installed, since PHP extensions
24+
for Windows are distributed as pre-compiled packages containing the extension
25+
DLL.
26+
27+
## I'm an extension maintainer
28+
629
If you are an extension maintainer wanting to add PIE support to your extension,
730
please read [extension-maintainers](./docs/extension-maintainers.md).
831

docs/extension-maintainers.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,65 @@ Cannot use myvendor/myextension's latest version 1.2.3 as it requires
240240
ext-something * which is missing from your platform.
241241
```
242242

243+
#### Checking the extension will work
244+
245+
First up, you can use `composer validate` to check your `composer.json` is
246+
formatted correctly, e.g.:
247+
248+
```shelle
249+
$ composer validate
250+
./composer.json is valid
251+
```
252+
253+
You may then use `pie install` to install your extension while in its directory:
254+
255+
```shell
256+
$ cd /path/to/my/extension
257+
$ pie install
258+
🥧 PHP Installer for Extensions (PIE) 1.0.0, from The PHP Foundation
259+
Installing PIE extension from /home/james/workspace/phpf/example-pie-extension
260+
This command may need elevated privileges, and may prompt you for your password.
261+
You are running PHP 8.4.8
262+
Target PHP installation: 8.4.8 nts, on Linux/OSX/etc x86_64 (from /usr/bin/php8.4)
263+
Found package: asgrim/example-pie-extension:dev-main which provides ext-example_pie_extension
264+
Extracted asgrim/example-pie-extension:dev-main source to: /home/james/.config/pie/php8.4_572ee73609adb95bf0b8539fecdc5c0e/vendor/asgrim/example-pie-extension
265+
Build files cleaned up.
266+
phpize complete.
267+
Configure complete.
268+
Build complete: /home/james/.config/pie/php8.4_572ee73609adb95bf0b8539fecdc5c0e/vendor/asgrim/example-pie-extension/modules/example_pie_extension.so
269+
Cannot write to /usr/lib/php/20240924, so using sudo to elevate privileges.
270+
Install complete: /usr/lib/php/20240924/example_pie_extension.so
271+
✅ Extension is enabled and loaded in /usr/bin/php8.4
272+
```
273+
274+
##### Building without installing
275+
276+
If you want to just test the build of your application, without installling it
277+
to your target PHP version, you will first need to your extension directory as
278+
a "path" type repository:
279+
280+
```shell
281+
$ cd /path/to/my/extension
282+
$ pie repository:add path .
283+
🥧 PHP Installer for Extensions (PIE) 1.0.0, from The PHP Foundation
284+
You are running PHP 8.4.8
285+
Target PHP installation: 8.4.8 nts, on Linux/OSX/etc x86_64 (from /usr/bin/php8.4)
286+
The following repositories are in use for this Target PHP:
287+
- Path Repository (/home/james/workspace/phpf/example-pie-extension)
288+
- Packagist
289+
```
290+
291+
Then you may test that it builds with:
292+
293+
```shell
294+
$ pie build asgrim/example-pie-extension:*@dev
295+
```
296+
297+
> [!TIP]
298+
> Since your extension is not yet published to Packagist, you should specify
299+
> `*@dev` as the version constraint, otherwise PIE will not find your extension
300+
> as the default stability is `stable`.
301+
243302
### Submit the extension to Packagist
244303

245304
Once you have committed your `composer.json` to your repository, you may then

0 commit comments

Comments
 (0)