diff --git a/composer.json b/composer.json index 7a8a882..f5cca48 100644 --- a/composer.json +++ b/composer.json @@ -28,7 +28,6 @@ ], "require": { "php": "8.1.*||8.2.*||8.3.*||8.4.*", - "ext-zip": "*", "composer/composer": "^2.8.4", "composer/pcre": "^3.3.2", "composer/semver": "^3.4.3", diff --git a/composer.lock b/composer.lock index b685757..3a753ae 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "28cc01a87d653a0bd163e94899b6afc1", + "content-hash": "d71a5173586deb071e3d24d7c761e9c2", "packages": [ { "name": "composer/ca-bundle", @@ -5945,8 +5945,7 @@ "prefer-stable": false, "prefer-lowest": false, "platform": { - "php": "8.1.*||8.2.*||8.3.*||8.4.*", - "ext-zip": "*" + "php": "8.1.*||8.2.*||8.3.*||8.4.*" }, "platform-dev": {}, "platform-overrides": { diff --git a/docs/usage.md b/docs/usage.md index 0eac8bc..095a086 100644 --- a/docs/usage.md +++ b/docs/usage.md @@ -40,6 +40,31 @@ Instead of `bin` tag (which represents latest binary-only image) you can also us > [!IMPORTANT] > Binary-only images don't include PHP runtime so you can't use them for _running_ PIE. This is just an alternative way of distributing PHAR file, you still need to satisfy PIE's runtime requirements on your own. +#### Example of PIE working in a Dockerfile + +This is an example of how PIE could be used to install an extension inside a +Docker image. Note that, like Composer, you need something like `unzip`, the +[Zip](https://www.php.net/manual/en/book.zip.php) extension, or `git` to be +installed. + +```Dockerfile +FROM php:8.4-cli + +# Add the `unzip` package which PIE uses to extract .zip files +RUN apt-get -y update \ + && apt-get install -y --no-install-recommends unzip \ + && rm -rf /var/lib/apt/lists/* + +# Copy the pie.phar from the latest `:bin` release +COPY --from=ghcr.io/php/pie:bin /pie /usr/bin/pie + +# Use PIE to install an extension... +RUN pie install asgrim/example-pie-extension +``` + +If the extension you would like to install needs additional libraries or other +dependencies, then these must be installed beforehand too. + ## Prerequisites for PIE Running PIE requires PHP 8.1 or newer. However, you may still use PIE to install