PIE is the official installer for PHP extensions, which replaces PECL (which is now deprecated). PIE is distributed as a PHAR, just like Composer, and works in a similar way to Composer, but it installs PHP extensions (PHP Modules or Zend Extensions) to your PHP installation, rather than pulling PHP packages into your project or library.
You will need PHP 8.1 or newer to run PIE, but PIE can install an extension to any other installed PHP version.
On Linux/OSX, if any build tools needed are missing, PIE will ask if you would like to automatically install them first (as of PIE 1.4.0).
On Windows, you do not need any build toolchain installed, since PHP extensions for Windows are distributed as pre-compiled packages containing the extension DLL.
pie.phar either:
gh attestation verify --owner php pie.pharphp pie.phar <command>Further installation details can be found in the usage docs.
This documentation assumes you have moved pie.phar into your $PATH, e.g.
/usr/local/bin/pie on non-Windows systems or created an alias in your shell RC file.
This will install PIE into /usr/local/bin/pie on a non-Windows system:
curl -fL --output /tmp/pie.phar https://github.com/php/pie/releases/latest/download/pie.phar \
&& gh attestation verify --owner php /tmp/pie.phar \
&& sudo mv /tmp/pie.phar /usr/local/bin/pie \
&& sudo chmod +x /usr/local/bin/pie
You can install an extension using the install command. For example, to
install the example_pie_extension extension, you would run:
$ pie install asgrim/example-pie-extension
𥧠PHP Installer for Extensions (PIE) 1.4.0, from The PHP Foundation
This command may need elevated privileges, and may prompt you for your password.
You are running PHP 8.5.3
Target PHP installation: 8.5.3 nts, on Linux/OSX/etc x86_64 (from /usr/bin/php8.5)
Found package: asgrim/example-pie-extension:2.0.9 which provides ext-example_pie_extension
Extracted asgrim/example-pie-extension:2.0.9 source to: /path/to/example-pie-extension
phpize complete.
Configure complete with options: --with-php-config=/usr/bin/php-config8.5
Build complete: /path/to/example-pie-extension/modules/example_pie_extension.so
Install complete: /usr/lib/php/20250925/example_pie_extension.so
â
Extension is enabled and loaded in /usr/bin/php8.5
$
As of PIE 1.5 you can install multiple extensions at the same time. Note that if multiple extensions share the same configure options, this command will fail.
pie install foo/great-extension bar/another-extension
When in your PHP project, you can install any missing top-level extensions:
$ pie install
𥧠PHP Installer for Extensions (PIE) 1.4.0, from The PHP Foundation
You are running PHP 8.5.0
Target PHP installation: 8.5.0 nts, on Linux/OSX/etc x86_64 (from /usr/local/bin/php)
Checking extensions for your project asgrim/demo-php-project (path: /demos/demo-php-project)
requires: ext-curl:* â
Already installed
requires: ext-example_pie_extension:^2.0 ð« Missing
The following packages may be suitable, which would you like to install:
[0] None
[1] asgrim/example-pie-extension: Example PIE extension
> 1
example_pie_extension> You are running PHP 8.5.0
example_pie_extension> Target PHP installation: 8.5.0 nts, on Linux/OSX/etc x86_64 (from /usr/local/bin/php)
example_pie_extension> Found package: asgrim/example-pie-extension:2.0.9 which provides ext-example_pie_extension
example_pie_extension> Extracted asgrim/example-pie-extension:2.0.9 source to: /path/to/example-pie-extension
example_pie_extension> phpize complete.
example_pie_extension> Configure complete with options: --with-php-config=/usr/local/bin/php-config
example_pie_extension> Build complete: /path/to/example-pie-extension/modules/example_pie_extension.so
example_pie_extension> Install complete: /usr/local/lib/php/extensions/no-debug-non-zts-20250925/example_pie_extension.so
example_pie_extension> â
Extension is enabled and loaded in /usr/local/bin/php
Finished checking extensions.
âïž Important
If you are running PIE in a non-interactive shell (for example, CI, a container), the
--allow-non-interactive-project-installis no longer functional. You must specify--selectflags for each missing package, e.g.:pie install \ --select example_pie_extension=asgrim/example-pie-extension \ --select redis=phpredis/phpredis
A list of extensions that support PIE can be found on https://packagist.org/extensions.
If you are an extension maintainer wanting to add PIE support to your extension, please read extension-maintainers.
The full documentation for PIE can be found in usage docs.
â ïž Warning
This translation may not be based on the latest version, please ensure you check the original English version for discrepancies.
pie.phar ãããŠã³ããŒãgh attestation verify --owner php pie.phar ã§ PHAR ã®ãœãŒã¹ãæ€èšŒ
gh CLI ã³ãã³ããå¿
èŠã§ããphp pie.phar <command> ã§ PIE ãåŒã³åºãããšãã§ããŸãpie.phar ã $PATH ã«ã³ããŒãäŸïŒcp pie.phar /usr/local/bin/pie
$PATH ã«ã³ããŒããå Žåãpie <command> ã§ PIE ãåŒã³åºãããšãã§ããŸããã®ããã¥ã¡ã³ãã§ã¯ãpie.phar ã $PATH ã«ç§»åãããšä»®å®ããŠããŸããäŸãã°ãé Windows ã·ã¹ãã ã§ã¯ /usr/local/bin/pie ã§ãã
ããã¯çœ²åãæ€èšŒããªããããå®è¡ãããªã¹ã¯ã¯ãèªèº«ã§è² æ
ããããšã«ãªããŸãããé Windows ã·ã¹ãã ã§ PIE ã /usr/local/bin/pie ã«é
眮ããŸãïŒ
curl -fL --output /tmp/pie.phar https://github.com/php/pie/releases/latest/download/pie.phar \
&& gh attestation verify --owner php /tmp/pie.phar \
&& sudo mv /tmp/pie.phar /usr/local/bin/pie \
&& sudo chmod +x /usr/local/bin/pie
PIE ã¯ãã€ããªã®ã¿ã® Docker ã€ã¡ãŒãžãšããŠå ¬éãããŠãããããDocker ãã«ãäžã«ç°¡åã«ã€ã³ã¹ããŒã«ã§ããŸãïŒ
COPY --from=ghcr.io/php/pie:bin /pie /usr/bin/pie
bin ã¿ã°ïŒææ°ã®ãã€ããªã®ã¿ã®ã€ã¡ãŒãžã衚ãïŒã®ä»£ããã«ãæç€ºçãªããŒãžã§ã³ïŒx.y.z-bin 圢åŒïŒã䜿çšããããšãã§ããŸããå©çšå¯èœãªã¿ã°ãèŠã€ããã«ã¯ GitHub registry ã䜿çšããŠãã ããã
âïž Important
ãã€ããªã®ã¿ã®ã€ã¡ãŒãžã«ã¯ PHP ã©ã³ã¿ã€ã ãå«ãŸããŠããªããããPIE ãå®è¡ããããšã¯ã§ããŸããããã㯠PHAR ãã¡ã€ã«ãé åžããå¥ã®æ¹æ³ã«éãããPIE ã®ã©ã³ã¿ã€ã èŠä»¶ã¯èªåã§æºããå¿ èŠããããŸãã
ãã㯠Docker ã€ã¡ãŒãžå
ã§ PIE ã䜿çšããŠæ¡åŒµæ©èœãã€ã³ã¹ããŒã«ããæ¹æ³ã®äŸã§ããComposer ãšåæ§ã«ãunzipãZip æ¡åŒµæ©èœããŸã㯠git ã®ãããªãã®ãå¿
èŠã§ãã
FROM php:8.4-cli
# PIE ã .zip ãã¡ã€ã«ãå±éããããã«äœ¿çšãã `unzip` ããã±ãŒãžã远å
RUN export DEBIAN_FRONTEND="noninteractive"; \
set -eux; \
apt-get update; apt-get install -y --no-install-recommends unzip; \
rm -rf /var/lib/apt/lists/*
# ææ°ã® `:bin` ãªãªãŒã¹ãã pie.phar ãã³ããŒ
COPY --from=ghcr.io/php/pie:bin /pie /usr/bin/pie
# PIE ã䜿çšããŠæ¡åŒµæ©èœãã€ã³ã¹ããŒã«...
RUN pie install asgrim/example-pie-extension
ã€ã³ã¹ããŒã«ãããæ¡åŒµæ©èœã«è¿œå ã®ã©ã€ãã©ãªãä»ã®äŸåé¢ä¿ãå¿ èŠãªå Žåã¯ãããããäºåã«ã€ã³ã¹ããŒã«ããå¿ èŠããããŸãã
PIE ã®å®è¡ã«ã¯ PHP 8.1 以éãå¿ èŠã§ãããã ããå€ãããŒãžã§ã³ã® PHP çšã®æ¡åŒµæ©èœãã€ã³ã¹ããŒã«ããããã« PIE ã䜿çšããããšã¯ã§ããŸãã
PHP ã«å ããŠãPIE ã¯æ¡åŒµæ©èœãããŠã³ããŒãããã«ããã€ã³ã¹ããŒã«ããããã«ãã·ã¹ãã ã«ä»¥äžã®ããŒã«ãå¿ èŠã§ãïŒ
zip æ¡åŒµæ©èœããŸãã¯æ¡åŒµæ©èœã®ãœãŒã¹ã³ãŒããããŠã³ããŒãããããã® gitautoconfãautomakeãlibtoolãm4ãmakeãgccphp-config ã phpize ãªã©ïŒãŸããåæ¡åŒµæ©èœã«ã¯ç¬èªã®èŠä»¶ïŒè¿œå ã®ã©ã€ãã©ãªãªã©ïŒãããå ŽåããããŸãã
ð¡ Tip
æ£ããåææ¡ä»¶ãã€ã³ã¹ããŒã«ãããŠããªãç¶æ ã§ PIE ãå®è¡ãããšãBox Requirements Checker ãããšã©ãŒã衚瀺ãããå ŽåããããŸãããšã«ããå®è¡ã詊ã¿ããå Žåã¯ãç°å¢å€æ°
BOX_REQUIREMENT_CHECKER=0ãæå®ããŠãã ãããLinux ã§ã®äŸïŒ
$ BOX_REQUIREMENT_CHECKER=0 pie install foo/bar
Debian ããŒã¹ã®ã·ã¹ãã ã§ã¯ã以äžã®ã³ãã³ãã§å¿ èŠãªããŒã«ãã€ã³ã¹ããŒã«ã§ããŸãïŒ
sudo apt-get install git autoconf automake libtool m4 make gcc
Red Hat ããŒã¹ã®ã·ã¹ãã ã§ã¯ã以äžã®ã³ãã³ãã§å¿ èŠãªããŒã«ãã€ã³ã¹ããŒã«ã§ããŸãïŒ
sudo yum install git autoconf automake libtool m4 make gcc
macOS ã§ã¯ãHomebrew ã䜿çšããŠå¿ èŠãªããŒã«ãã€ã³ã¹ããŒã«ã§ããŸãïŒ
brew install git autoconf automake libtool m4 make gcc
Windows ã§ã¯ãæ¡åŒµæ©èœã¯éåžžãããªã³ã³ãã€ã«æžã¿ã®ãã€ããªãšããŠé åžãããŸããæ¡åŒµæ©èœãèªåã§ãã«ããã代ããã«ãDLL ãã¡ã€ã«ãšããŠããŠã³ããŒããããPHP æ¡åŒµæ©èœãã£ã¬ã¯ããªã«é 眮ãããŸãã
PIE ã«ã¯ä»¥äžã®æ©èœããããŸãïŒ
pie download ... ã§æ¡åŒµæ©èœã®ã¿ãããŠã³ããŒãpie build ... ã§æ¡åŒµæ©èœãããŠã³ããŒãããŠãã«ãpie install ... ã§æ¡åŒµæ©èœãããŠã³ããŒãããã«ããã€ã³ã¹ããŒã«PIE ã§æ¡åŒµæ©èœãã€ã³ã¹ããŒã«ããå Žåããã® Composer ããã±ãŒãžåã䜿çšããå¿ èŠããããŸããPIE äºæããã±ãŒãžã®ãªã¹ã㯠https://packagist.org/extensions ã§ç¢ºèªã§ããŸãã
æ¡åŒµæ©èœåãããã£ããã以äžã®ããã«ã€ã³ã¹ããŒã«ã§ããŸãïŒ
pie install <vendor>/<package>
# äŸïŒ
pie install xdebug/xdebug
ããã«ãããPIE ãåŒã³åºãããã«äœ¿çšããã PHP ããŒãžã§ã³ã« Xdebug æ¡åŒµæ©èœãã€ã³ã¹ããŒã«ããããã® PHP ããŒãžã§ã³ãšäºææ§ã®ãã Xdebug ã®ææ°å®å®çã䜿çšãããŸãã
ç°ãªãããŒãžã§ã³ã® PHP çšã®æ¡åŒµæ©èœãã€ã³ã¹ããŒã«ããããšããŠããå Žåãé Windows ã·ã¹ãã ã§ã¯ --with-php-config ãªãã·ã§ã³ã§æå®ã§ããŸãïŒ
pie install --with-php-config=/usr/bin/php-config7.2 my/extension
Windows ã§ã¯ã--with-php-path ãªãã·ã§ã³ã䜿çšã㊠php å®è¡å¯èœãã¡ã€ã«èªäœã®ãã¹ãæå®ã§ããŸãããã㯠Windows ã§ã®äŸã§ãPHP 8.1 ã䜿çšã㊠PIE ãå®è¡ããŠããŸãããPHP 8.3 çšã®æ¡åŒµæ©èœãããŠã³ããŒããããå Žåã§ãïŒ
> C:\php-8.1.7\php.exe C:\pie.phar install --with-php-path=C:\php-8.3.6\php.exe example/example-pie-extension
ã¿ãŒã²ãã PHP ããŒãžã§ã³ã«å¯Ÿå¿ãã phpize ã³ãã³ãã䜿çšããå¿
èŠãããå ŽåããããŸãããã㯠--with-phpize-path ãªãã·ã§ã³ã§æå®ã§ããŸãïŒ
pie install --with-phpize-path=/usr/bin/phpize7.2 my/extension
PIE ã§æ¡åŒµæ©èœãã€ã³ã¹ããŒã«ããéã«ããªãã·ã§ã³ã§ããŒãžã§ã³å¶çŽãæå®ã§ããŸãïŒ
pie install <vendor>/<package>:<version-constraint>
version-constraint ãæå®ãããå Žåãèš±å¯ãããããŒãžã§ã³ãšäžèŽããå Žåããã®ããŒãžã§ã³ãã€ã³ã¹ããŒã«ããããšããŸããããŒãžã§ã³å¶çŽã¯ Composer ãšåã圢åŒã§è§£æ±ºãããæå°å®å®æ§ãèæ
®ãããŸãã
^1.0 ã¯ãã»ãã³ãã£ãã¯ããŒãžã§ãã³ã°ã«åŸã£ãŠã1.0.0 以äžã§åŸæ¹äºææ§ã®ããææ°ã®å®å®çãã€ã³ã¹ããŒã«ããŸãã
詳现㯠Composer ããã¥ã¡ã³ããåç
§ã^2.3@beta ã¯ã2.3.0 以äžã§åŸæ¹äºææ§ã®ããææ°ã®ããŒã¿çãã€ã³ã¹ããŒã«ããŸãïŒäŸïŒ2.3.0-beta.3ïŒãdev-main ã¯ãã³ãã³ãå®è¡æã® main ãã©ã³ãã®ææ°ã³ããããã€ã³ã¹ããŒã«ããŸãããã㯠Windows ãã€ããªãå«ããªãªãŒã¹ããªããããWindows ã§ã¯æ©èœããŸãããdev-main#07f454ad797c30651be8356466685b15331f72ff ã¯ã# ã®åŸã®ã³ããã sha ã§ç€ºãããç¹å®ã®ã³ããããã€ã³ã¹ããŒã«ããŸãããã®å Žåãã³ããã 07f454ad797c30651be8356466685b15331f72ff ãã€ã³ã¹ããŒã«ãããŸãããã㯠Windows ãã€ããªãå«ããªãªãŒã¹ããªããããWindows ã§ã¯æ©èœããŸãããversion-constraint ãæå®ããããšããã§ãã¯ãããã¿ãŒã²ãã PHP ããŒãžã§ã³ã® pie.json ã«çŽæ¥è¿œå ãããŸããäŸïŒ
$ pie install "xdebug/xdebug:^3.4.3 || 3.4.1"
ããã«ãããpie.json ã«ä»¥äžãèšå®ãããŸãïŒ
{
"require": {
"xdebug/xdebug": "^3.4.3 || 3.4.1"
}
}
version-constraint ãæå®ãããŠããªãå Žåãäºææ§ã®ããææ°ã®å®å®çãã€ã³ã¹ããŒã«ããããšããŸããPIE ã¯åžžã«å®å®çãåªå
ããŸãã
æ¡åŒµæ©èœãã³ã³ãã€ã«ããéãäžéšã®æ¡åŒµæ©èœã§ã¯ ./configure ã³ãã³ãã«è¿œå ã®ãã©ã¡ãŒã¿ãæž¡ãå¿
èŠããããŸãããããã¯éåžžãç¹å®ã®æ©èœãæå¹åãŸãã¯ç¡å¹åããããããŸãã¯èªåæ€åºãããªãã©ã€ãã©ãªã®ãã¹ãæäŸããããã«äœ¿çšãããŸãã
æ¡åŒµæ©èœã§å©çšå¯èœãªèšå®ãªãã·ã§ã³ã確èªããã«ã¯ãpie info <vendor>/<package> ã䜿çšããŸããããã«ãããæ¬¡ã®ãããªãªã¹ããè¿ãããŸãïŒ
Configure options:
--enable-some-functionality (whether to enable some additional functionality provided)
--with-some-library-name=? (Path for some-library)
äžèšã®äŸã®æ¡åŒµæ©èœã¯ãæå®ãããèšå®ãªãã·ã§ã³ãªããäžéšããŸãã¯ãã¹ãŠã䜿çšããŠã€ã³ã¹ããŒã«ã§ããŸããããã€ãã®äŸïŒ
pie install example/some-extension
pie install example/some-extension --enable-some-functionality
pie install example/some-extension --with-some-library-name=/path/to/the/lib
pie install example/some-extension --with-some-library-name=/path/to/the/lib --enable-some-functionality
PIE ã¯ãé©å㪠INI ãã¡ã€ã«ã« extension=... ãŸã㯠zend_extension=... ã远å ããããšã§ãæ¡åŒµæ©èœãèªåçã«æå¹åããããšããŸãããã®åäœãç¡å¹ã«ãããå Žåã¯ãpie install ã³ãã³ãã« --skip-enable-extension ãã©ã°ãæž¡ããŠãã ãããæ¡åŒµæ©èœãæå¹åããããšããéã«ã¯ã以äžã®æè¡ã䜿çšãããŸãïŒ
phpenmoddocker-php-ext-enableãããã®æè¡ãããããæ©èœããªãå ŽåããŸã㯠--skip-enable-extension ãã©ã°ã䜿çšããå ŽåãPIE ã¯æ¡åŒµæ©èœãæå¹åãããªãã£ãããšãèŠåããæ¡åŒµæ©èœãèªåã§æå¹åããå¿
èŠãããããšãéç¥ããŸãã
Packagist.org 以å€ã®ããã±ãŒãžãªããžããªïŒPrivate Packagist ãªã©ïŒããæ¡åŒµæ©èœãã€ã³ã¹ããŒã«ãããå ŽåããããŒã«ã«ãã£ã¬ã¯ããªããã€ã³ã¹ããŒã«ãããå ŽåããããŸããPIE 㯠Composer ãããŒã¹ã«ããŠãããããä»ã®ãªããžããªã¿ã€ãã䜿çšã§ããŸãïŒ
pie repository:add [--with-php-config=...] path /path/to/your/local/extensionpie repository:add [--with-php-config=...] vcs https://github.com/youruser/yourextensionpie repository:add [--with-php-config=...] composer https://repo.packagist.com/your-private-packagist/pie repository:add [--with-php-config=...] composer packagist.orgrepository:* ã³ãã³ãã¯ãã¹ãŠããªãã·ã§ã³ã® --with-php-config ãã©ã°ããµããŒãããŠããã䜿çšãã PHP ã€ã³ã¹ããŒã«ãæå®ã§ããŸãïŒäŸãã°ã1 å°ã®ãã·ã³ã«è€æ°ã® PHP ã€ã³ã¹ããŒã«ãããå ŽåïŒã远å ããããªããžããªã¯ãéã® repository:remove ã³ãã³ãã䜿çšããŠåé€ããããšãã§ããŸãïŒ
pie repository:remove [--with-php-config=...] /path/to/your/local/extensionpie repository:remove [--with-php-config=...] https://github.com/youruser/yourextensionpie repository:remove [--with-php-config=...] https://repo.packagist.com/your-private-packagist/pie repository:remove [--with-php-config=...] packagist.orgrepository:remove ã§ã¯ãªããžããªã¿ã€ããæå®ããå¿
èŠã¯ãªããURL ã ããæå®ããŸãã
ã¿ãŒã²ãã PHP ã€ã³ã¹ããŒã«ã®ãªããžããªããªã¹ãããã«ã¯ïŒ
pie repository:list [--with-php-config=...]PHP ãããžã§ã¯ãã®äœæ¥ãã£ã¬ã¯ããªã«ããå Žåãpie install ã䜿çšããŠãããžã§ã¯ããå¿
èŠãšããæ¡åŒµæ©èœãååšãããã©ããã確èªã§ããŸããæ¡åŒµæ©èœãäžè¶³ããŠããå ŽåãPIE ã¯ã€ã³ã¹ããŒã«åè£ãèŠã€ããŠãã€ã³ã¹ããŒã«ãããã©ãããã€ã³ã¿ã©ã¯ãã£ãã«å°ããŸããäŸïŒ
$ pie install
𥧠PHP Installer for Extensions (PIE), 0.9.0, from The PHP Foundation
You are running PHP 8.3.19
Target PHP installation: 8.3.19 nts, on Linux/OSX/etc x86_64 (from /usr/bin/php8.3)
Checking extensions for your project your-vendor/your-project
requires: curl â
Already installed
requires: intl â
Already installed
requires: json â
Already installed
requires: example_pie_extension â ïž Missing
The following packages may be suitable, which would you like to install:
[0] None
[1] asgrim/example-pie-extension: Example PIE extension
> 1
> 𥧠PHP Installer for Extensions (PIE), 0.9.0, from The PHP Foundation
> This command may need elevated privileges, and may prompt you for your password.
> You are running PHP 8.3.19
> Target PHP installation: 8.3.19 nts, on Linux/OSX/etc x86_64 (from /usr/bin/php8.3)
> Found package: asgrim/example-pie-extension:2.0.2 which provides ext-example_pie_extension
... (snip) ...
> â
Extension is enabled and loaded in /usr/bin/php8.3
Finished checking extensions.
PIE 㯠PECL ã®ä»£æ¿åã§ãããããPECL ã§ããç¥ãããŠããã³ãã³ããš PIE ã§ã®åçã®ã³ãã³ãã®æ¯èŒã以äžã«ç€ºããŸããäžéšã®æŠå¿µã¯ PIE ã§ã¯ç°ãªããçç¥ãããŠããå ŽåããããŸããããã¯æ°ããããŒã«ã«ã¯é©çšãããªãå¯èœæ§ãããããã§ãã
| PECL | PIE |
|---|---|
pecl build xdebug |
pie build xdebug/xdebug |
pecl bundle xdebug |
pie download xdebug/xdebug |
pecl channel-add channel.xml |
pie repository:add vcs https://github.com/my/extension |
pecl channel-alias |
|
pecl channel-delete channel |
pie repository:remove https://github.com/my/extension |
pecl channel-discover |
|
pecl channel-login |
|
pecl channel-logout |
|
pecl channel-update |
|
pecl clear-cache |
|
pecl config-create |
|
pecl config-get |
|
pecl config-help |
|
pecl config-set |
|
pecl config-show |
|
pecl convert |
|
pecl cvsdiff |
|
pecl cvstag |
|
pecl download xdebug |
pie download xdebug/xdebug |
pecl download-all |
|
pecl info xdebug |
pie info xdebug/xdebug |
pecl install xdebug |
pie install xdebug/xdebug |
pecl list |
pie show |
pecl list-all |
Packagist æ¡åŒµæ©èœãªã¹ããåç § |
pecl list-channels |
pie repository:list |
pecl list-files |
|
pecl list-upgrades |
|
pecl login |
|
pecl logout |
|
pecl makerpm |
|
pecl package |
Linux - ãªãªãŒã¹ãã¿ã°ä»ãããã ããWindows - php/php-windows-builder action ãäœ¿çš |
pecl package-dependencies |
|
pecl package-validate |
æ¡åŒµæ©èœã®ãã§ãã¯ã¢ãŠãã§ïŒcomposer validate |
pecl pickle |
|
pecl remote-info xdebug |
pie info xdebug/xdebug |
pecl remote-list |
Packagist æ¡åŒµæ©èœãªã¹ããåç § |
pecl run-scripts |
|
pecl run-tests |
|
pecl search |
Packagist æ¡åŒµæ©èœãªã¹ããåç § |
pecl shell-test |
|
pecl sign |
|
pecl svntag |
|
pecl uninstall |
|
pecl update-channels |
|
pecl upgrade xdebug |
pie install xdebug/xdebug |
pecl upgrade-all |
pie.phar from the latest releasesgh attestation verify --owner php pie.phar
gh CLI command.php pie.phar <command>pie.phar into your $PATH, e.g. cp pie.phar /usr/local/bin/pie
$PATH, you may then invoke PIE with pie <command>This documentation assumes you have moved pie.phar into your $PATH, e.g.
/usr/local/bin/pie on non-Windows systems.
â ïž Warning
Distribution packages are not maintained by PIE, so may not have the latest version, may have patches applied, or the instructions here may be out of date. You should verify the distribution packages before using them.
On Enterprise Linux (CentOS, RHEL, AlmaLinux, RockyLinux, and other clones) you need to enable the EPEL repository.
sudo dnf install pie
Package information: pie
PIE can be installed with Homebrew with:
brew install pie
# If you have `gh`, you can verify PIE is authentic:
gh attestation verify --owner=php $(which pie)
PIE is published as binary-only Docker image, so you can use it easily during your Docker build:
RUN --mount=type=bind,from=ghcr.io/php/pie:bin,source=/pie,target=/usr/local/bin/pie \
pie -V
The following tag styles (replace them with the real version you want!): are published from 1.5+:
bin (latest stable, recommended)nightly-bin (latest unstable)x.y.z-bin (e.g. 1.5.0-bin)x.y-bin (e.g. 1.5-bin)x-bin (e.g. 1-bin)Use GitHub registry to find available tags.
âïž 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.
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 extension, or git to be
installed.
FROM php:8.4-cli
RUN --mount=type=bind,from=ghcr.io/php/pie:bin,source=/pie,target=/usr/local/bin/pie \
export DEBIAN_FRONTEND="noninteractive"; \
set -eux; \
# Add the `unzip` package which PIE uses to extract .zip files.
apt-get update; \
apt-get install -y --no-install-recommends unzip; \
# Use PIE to install an extension...
pie install --no-cache \
asgrim/example-pie-extension; \
# Clean up `unzip`.
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false unzip; \
rm -rf /var/lib/apt/lists/*;
CMD ["php", "-r", "example_pie_extension_test();"]
If the extension you would like to install needs additional libraries or other dependencies, then these must be installed beforehand too.
As of 1.4.0 an experimental executable (binary) version of PIE is included. The PIE is built using Static PHP, which builds a self-contained PHP executable with the extensions that PIE needs to run, and bundles the PHAR as a single distributable executable. Please keep in mind that this is experimental, and we do not recommend this for production use for the time being. Please also note there are some limitations:
pie self-update feature disabled for now.If you find the binary releases useful, please leave feedback or upvote on the relevant discussions, so we can gauge interest in improving this functionality.
The stable versions of the executables can be found by navigating to the relevant release, and finding the appropriate executable for your platform. For your convenience, the "latest" stable releases can be downloaded from these links:
| Operating System | Architecture | Download URL |
|---|---|---|
| Linux | amd64 / x86_64 | https://github.com/php/pie/releases/latest/download/pie-Linux-X64 |
| OS X | ARM 64 / aarch64 | https://github.com/php/pie/releases/latest/download/pie-macOS-ARM64 |
| Linux | ARM 64 / aarch64 | https://github.com/php/pie/releases/latest/download/pie-Linux-ARM64 |
| OS X | Intel / x86_64 | https://github.com/php/pie/releases/latest/download/pie-macOS-X64 |
The "nightly" versions of these can be found here:
| Operating System | Architecture | Download URL |
|---|---|---|
| Linux | amd64 / x86_64 | https://php.github.io/pie/pie-Linux-X64 |
| OS X | ARM 64 / aarch64 | https://php.github.io/pie/pie-macOS-ARM64 |
| Linux | ARM 64 / aarch64 | https://php.github.io/pie/pie-Linux-ARM64 |
| OS X | Intel / x86_64 | https://php.github.io/pie/pie-macOS-X64 |
We highly recommend you verify the file came from the PHP GitHub repository before running it, for example:
$ gh attestation verify --owner php pie-Linux-X64
$ chmod +x pie-Linux-X64
$ ./pie-Linux-X64 --version
Running PIE requires PHP 8.1 or newer. However, you may still use PIE to install
an extension for an older version of PHP. You also need the zip extension
enabled for the PHP version running PIE, or git to download the extension
source code.
Additionally to PHP, PIE requires the following build tools to be available on your system in order to download, build and install extensions. Note that as of PIE 1.4.0, PIE will attempt to detect and install the missing build tools:
autoconf, automake, libtool, m4, make, and gcc to build the extensionphp-config and phpize) to prepare the
extension for building.Also, each extension may have its own requirements, such as additional libraries. As of PIE 1.4.0, for some extensions, PIE will attempt to detect and install the missing system libraries.
ð¡ Tip
If you run PIE without the correct prerequisites installed, you may receive an error from the Box Requirements Checker. If you want to try running anyway, specify the environment variable
BOX_REQUIREMENT_CHECKER=0.Example on Linux:
$ BOX_REQUIREMENT_CHECKER=0 pie install foo/bar
On a Debian-based system, you may install the required tools with:
sudo apt-get install git autoconf automake libtool m4 make gcc
On a Red Hat-based system, you may install the required tools with:
sudo yum install git autoconf automake libtool m4 make gcc
On macOS, you may install the required tools with Homebrew:
brew install git autoconf automake libtool m4 make gcc
On Windows, extensions are typically distributed as precompiled binaries. Instead of building the extension yourself, it will be downloaded as DLL files and placed in the PHP extensions directory.
PIE has the ability to:
pie download ...,pie build ...,pie install ...When installing an extension with PIE, you must use its Composer package name. You can find a list of PIE-compatible packages on https://packagist.org/extensions.
Once you know the extension name, you can install it with:
pie install <vendor>/<package>
# for example:
pie install xdebug/xdebug
This will install the Xdebug extension into the version of PHP that is used to invoke PIE, using whichever is the latest stable version of Xdebug compatible with that version of PHP.
ð¡ Tip
If PIE detects the extension of the same version with the same configure flags is already installed, as of PIE 1.5, it will no longer be re-installed.
If you are trying to install an extension for a different version of PHP, you
may specify this on non-Windows systems with the --with-php-config option:
pie install --with-php-config=/usr/bin/php-config7.2 my/extension
On Windows, you may provide a path to the php executable itself using the
--with-php-path option. This is an example on Windows where PHP 8.1 is used
to run PIE, but we want to download the extension for PHP 8.3:
> C:\php-8.1.7\php.exe C:\pie.phar install --with-php-path=C:\php-8.3.6\php.exe example/example-pie-extension
You may also need to use the corresponding phpize command for the target PHP
version, which can be specified with the --with-phpize-path option:
pie install --with-phpize-path=/usr/bin/phpize7.2 my/extension
You may optionally specify a version constraint when using PIE to install an extension:
pie install <vendor>/<package>:<version-constraint>
If version-constraint is given, try to install that version if it matches the
allowed versions. Version constraints are resolved using the same format as
Composer, along with the minimum stability.
^1.0 will install the latest stable and backwards-compatible version with
1.0.0 and above, according to semantic versioning.
See Composer docs for details.^2.3@beta will install the latest beta and backwards-compatible version
with 2.3.0 and above (for example, 2.3.0-beta.3).dev-main will install the latest commit on the main branch at the time
of command execution. This would not work with Windows, as there is no
release with Windows binaries.dev-main#07f454ad797c30651be8356466685b15331f72ff will install the specific
commit denoted by the commit sha after #, in this case the commit
07f454ad797c30651be8356466685b15331f72ff would be installed. This would
not work with Windows, as there is no release with Windows binaries.When a version-constraint is given, it is checked, and added directly to the
pie.json for the target PHP version, e.g.:
$ pie install "xdebug/xdebug:^3.4.3 || 3.4.1"
will set the following in pie.json:
{
"require": {
"xdebug/xdebug": "^3.4.3 || 3.4.1"
}
}
If no version-constraint is given, try to install any compatible latest and
stable version. PIE will always prefer stable versions.
When compiling extensions, some will need additional parameters passed to the
./configure command. These would typically be to enable or disable certain
functionality, or to provide paths to libraries not automatically detected.
In order to determine what configure options are available for an extension,
you may use pie info <vendor>/<package> which will return a list, such as:
Configure options:
--enable-some-functionality (whether to enable some additional functionality provided)
--with-some-library-name=? (Path for some-library)
The above example extension could then be installed with none, some, or all of the specified configure options, some examples:
pie install example/some-extension
pie install example/some-extension --enable-some-functionality
pie install example/some-extension --with-some-library-name=/path/to/the/lib
pie install example/some-extension --with-some-library-name=/path/to/the/lib --enable-some-functionality
ð¡ Tip
If you specify configure options for a package that uses the
pre-packaged-binarydownload method, PIE will fall back to compiling the extension using the configure options you have specified.
PIE will attempt to check the presence of build tools (such as gcc, make, etc.)
before running. If any are missing, an interactive prompt will ask if you would
like to install the missing tools. If you are running in non-interactive mode
(for example, in a CI pipeline, container build, etc), PIE will not
install these tools automatically. If you would like to install the build tools
in a non-interactive terminal, pass the --auto-install-build-tools and the
prompt will be skipped.
To skip the build tools check entirely, pass the --no-build-tools-check flag.
PIE will attempt to check the presence of system library dependencies before
installing an extension. If any are missing, an interactive prompt will ask if
you would like to install the missing tools. If you are running in
non-interactive mode (for example, in a CI pipeline, container build, etc), PIE
will not install these dependencies automatically. If you would like to
install the system dependencies in a non-interactive terminal, pass the
--auto-install-system-dependencies and the prompt will be skipped.
To skip the dependencies check entirely, pass the
--no-system-dependencies-check flag.
PIE will automatically try to enable the extension by adding extension=... or
zend_extension=... in the appropriate INI file. If you want to disable this
behaviour, pass the --skip-enable-extension flag to your pie install
command. The following techniques are used to attempt to enable the extension:
phpenmod, if using the deb.sury.org distributiondocker-php-ext-enable if using Docker's PHP imageIf none of these techniques work, or you used the --skip-enable-extension
flag, PIE will warn you that the extension was not enabled, and will note that
you must enable the extension yourself.
Sometimes you may want to install an extension from a package repository other than Packagist.org (such as Private Packagist), or from a local directory. Since PIE is based heavily on Composer, it is possible to use some other repository types:
pie repository:add [--with-php-config=...] path /path/to/your/local/extensionpie repository:add [--with-php-config=...] vcs https://github.com/youruser/yourextensionpie repository:add [--with-php-config=...] composer https://repo.packagist.com/your-private-packagist/pie repository:add [--with-php-config=...] composer packagist.orgThe repository:* commands all support the optional --with-php-config flag
to allow you to specify which PHP installation to use (for example, if you have
multiple PHP installations on one machine). The above added repositories can be
removed too, using the inverse repository:remove commands:
pie repository:remove [--with-php-config=...] /path/to/your/local/extensionpie repository:remove [--with-php-config=...] https://github.com/youruser/yourextensionpie repository:remove [--with-php-config=...] https://repo.packagist.com/your-private-packagist/pie repository:remove [--with-php-config=...] packagist.orgNote you do not need to specify the repository type in repository:remove,
just the URL.
You can list the repositories for the target PHP installation with:
pie repository:list [--with-php-config=...]You can use pie install when in a PHP project working directory to check the
extensions the project requires are present. If an extension is missing, PIE
will try to find an installation candidate and interactively ask if you would
like to install one. For example:
$ pie install
𥧠PHP Installer for Extensions (PIE) 1.4.0, from The PHP Foundation
You are running PHP 8.5.0
Target PHP installation: 8.5.0 nts, on Linux/OSX/etc x86_64 (from /usr/local/bin/php)
Checking extensions for your project asgrim/demo-php-project (path: /demos/demo-php-project)
requires: ext-curl:* â
Already installed
requires: ext-example_pie_extension:^2.0 ð« Missing
The following packages may be suitable, which would you like to install:
[0] None
[1] asgrim/example-pie-extension: Example PIE extension
> 1
example_pie_extension> You are running PHP 8.5.0
example_pie_extension> Target PHP installation: 8.5.0 nts, on Linux/OSX/etc x86_64 (from /usr/local/bin/php)
example_pie_extension> Found package: asgrim/example-pie-extension:2.0.9 which provides ext-example_pie_extension
example_pie_extension> Extracted asgrim/example-pie-extension:2.0.9 source to: /path/to/example-pie-extension
example_pie_extension> phpize complete.
example_pie_extension> Configure complete with options: --with-php-config=/usr/local/bin/php-config
example_pie_extension> Build complete: /path/to/example-pie-extension/modules/example_pie_extension.so
example_pie_extension> Install complete: /usr/local/lib/php/extensions/no-debug-non-zts-20250925/example_pie_extension.so
example_pie_extension> â
Extension is enabled and loaded in /usr/local/bin/php
Finished checking extensions.
You can provide PIE a map of which packages to use for each missing extension
using the new --select option in PIE 1.5+. For example, if your PHP project
has dependencies:
{
"require": {
"ext-curl": "*",
"ext-example_pie_extension": "^2.0",
"ext-redis": "^6.3"
}
}
You can specify the missing extensions with:
pie install \
--select example_pie_extension=asgrim/example-pie-extension \
--select redis=phpredis/phpredis
âïž Important
The
--allow-non-interactive-project-installwill no longer work. You must provide package selections from PIE 1.5 onwards.
If you have an existing pie.json and pie.lock for a given PHP install,
place these files in the directory indicated by the pie show -v path for
Using pie.json, e.g.:
$ php8.2 /usr/local/bin/pie show -v
𥧠PHP Installer for Extensions (PIE) 1.5.0, from The PHP Foundation
You are running PHP 8.2.31
Target PHP installation: 8.2.31 nts, on Linux/OSX/etc x86_64 (from /usr/bin/php8.2)
Using pie.json: /home/blah/.config/pie/php8.2_7cfa96d5dfc1df10afeb65851159197b/pie.json
...
Move your pie.json and pie.lock into this path, then you can run
pie install --from-lock which will install the locked extension dependencies
specified in that pie.lock.
Since PIE is a replacement for PECL, here is a comparison of the commands that you may be familiar with in PECL, with an approximate equivalent in PIE. Note that some concepts are different or omitted from PIE as they may simply be not applicable to the new tooling.
| PECL | PIE |
|---|---|
pecl build xdebug |
pie build xdebug/xdebug |
pecl bundle xdebug |
pie download xdebug/xdebug |
pecl channel-add channel.xml |
pie repository:add vcs https://github.com/my/extension |
pecl channel-alias |
|
pecl channel-delete channel |
pie repository:remove https://github.com/my/extension |
pecl channel-discover |
|
pecl channel-login |
|
pecl channel-logout |
|
pecl channel-update |
|
pecl clear-cache |
|
pecl config-create |
|
pecl config-get |
|
pecl config-help |
|
pecl config-set |
|
pecl config-show |
|
pecl convert |
|
pecl cvsdiff |
|
pecl cvstag |
|
pecl download xdebug |
pie download xdebug/xdebug |
pecl download-all |
|
pecl info xdebug |
pie info xdebug/xdebug |
pecl install xdebug |
pie install xdebug/xdebug |
pecl list |
pie show |
pecl list-all |
Visit Packagist Extension list |
pecl list-channels |
pie repository:list |
pecl list-files |
|
pecl list-upgrades |
|
pecl login |
|
pecl logout |
|
pecl makerpm |
|
pecl package |
Linux - just tag a release. Windows - use php/php-windows-builder action |
pecl package-dependencies |
|
pecl package-validate |
In your extension checkout: composer validate |
pecl pickle |
|
pecl remote-info xdebug |
pie info xdebug/xdebug |
pecl remote-list |
Visit Packagist Extension list |
pecl run-scripts |
|
pecl run-tests |
|
pecl search |
Visit Packagist Extension list |
pecl shell-test |
|
pecl sign |
|
pecl svntag |
|
pecl uninstall |
|
pecl update-channels |
|
pecl upgrade xdebug |
pie install xdebug/xdebug |
pecl upgrade-all |
â ïž Warning
This translation may not be based on the latest version, please ensure you check the original English version for discrepancies.
pie.phargh attestation verify --owner php pie.phar éªè¯ PHAR çæ¥æº
gh CLI åœä»€ãphp pie.phar <command> è°çš PIEpie.phar å€å¶å°æšç $PATHïŒäŸåŠ cp pie.phar /usr/local/bin/pie
$PATHïŒåå¯ä»¥äœ¿çš pie <command> è°çš PIEæ¬ææ¡£å讟æšå·²å° pie.phar ç§»åšå° $PATHïŒäŸåŠé Windows ç³»ç»äžç /usr/local/bin/pieã
泚æè¿äžäŒéªè¯ä»»äœçŸåïŒæšéèŠèªè¡æ¿æ
è¿è¡é£é©ïŒäœè¿äŒå° PIE æŸå
¥é Windows ç³»ç»ç /usr/local/bin/pieïŒ
curl -fL --output /tmp/pie.phar https://github.com/php/pie/releases/latest/download/pie.phar \
&& gh attestation verify --owner php /tmp/pie.phar \
&& sudo mv /tmp/pie.phar /usr/local/bin/pie \
&& sudo chmod +x /usr/local/bin/pie
PIE 以纯äºè¿å¶ Docker éåååžïŒå æ€æšå¯ä»¥åš Docker æå»ºæéŽèœ»æŸå®è£ ïŒ
COPY --from=ghcr.io/php/pie:bin /pie /usr/bin/pie
é€äº bin æ çŸïŒä»£è¡šææ°ç纯äºè¿å¶éåïŒå€ïŒæšè¿å¯ä»¥äœ¿çšæç¡®ççæ¬ïŒæ ŒåŒäžº x.y.z-binïŒãäœ¿çš GitHub registry æ¥æŸå¯çšæ çŸã
âïž Important
纯äºè¿å¶éåäžå å« PHP è¿è¡æ¶ïŒå æ€æšäžèœäœ¿çšå®ä»¬æ¥è¿è¡ PIEãè¿åªæ¯åå PHAR æä»¶çåŠäžç§æ¹åŒïŒæšä»ç¶éèŠèªå·±æ»¡è¶³ PIE çè¿è¡æ¶èŠæ±ã
è¿æ¯åŠäœåš Docker éåäžäœ¿çš PIE å®è£
æ©å±ç瀺äŸã泚æïŒäž Composer ç±»äŒŒïŒæšéèŠå®è£
unzipãZip æ©å±æ gitã
FROM php:8.4-cli
# æ·»å PIE çšäºè§£å .zip æä»¶ç `unzip` å
RUN export DEBIAN_FRONTEND="noninteractive"; \
set -eux; \
apt-get update; apt-get install -y --no-install-recommends unzip; \
rm -rf /var/lib/apt/lists/*
# 仿æ°ç `:bin` ååžçæ¬å€å¶ pie.phar
COPY --from=ghcr.io/php/pie:bin /pie /usr/bin/pie
# äœ¿çš PIE å®è£
æ©å±...
RUN pie install asgrim/example-pie-extension
åŠææšæ³å®è£ çæ©å±éèŠé¢å€çåºæå ¶ä»äŸèµé¡¹ïŒåå¿ é¡»äºå å®è£ è¿äºäŸèµé¡¹ã
è¿è¡ PIE éèŠ PHP 8.1 ææŽé«çæ¬ãäœæ¯ïŒæšä»ç¶å¯ä»¥äœ¿çš PIE äžºèŸæ§çæ¬ç PHP å®è£ æ©å±ã
é€äº PHPïŒPIE è¿éèŠç³»ç»äžæä»¥äžå·¥å ·æèœäžèœœãæå»ºåå®è£ æ©å±ïŒ
zip æ©å±ïŒæäœ¿çš git äžèœœæ©å±æºä»£ç autoconfãautomakeãlibtoolãm4ãmake å gcc æ¥æå»ºæ©å±php-config å phpizeïŒä»¥åå€æå»ºæ©å±ãæ€å€ïŒæ¯äžªæ©å±å¯èœæèªå·±çèŠæ±ïŒäŸåŠé¢å€çåºã
ð¡ Tip
åŠæåšæªå®è£ æ£ç¡®å 峿¡ä»¶çæ åµäžè¿è¡ PIEïŒæšå¯èœäŒæ¶å°æ¥èª Box Requirements Checker çé误ãåŠææšæ³å°è¯è¿è¡ïŒè¯·æå®ç¯å¢åé
BOX_REQUIREMENT_CHECKER=0ãLinux äžç瀺äŸïŒ
$ BOX_REQUIREMENT_CHECKER=0 pie install foo/bar
åšåºäº Debian çç³»ç»äžïŒæšå¯ä»¥äœ¿çšä»¥äžåœä»€å®è£ æéå·¥å ·ïŒ
sudo apt-get install git autoconf automake libtool m4 make gcc
åšåºäº Red Hat çç³»ç»äžïŒæšå¯ä»¥äœ¿çšä»¥äžåœä»€å®è£ æéå·¥å ·ïŒ
sudo yum install git autoconf automake libtool m4 make gcc
åš macOS äžïŒæšå¯ä»¥äœ¿çš Homebrew å®è£ æéå·¥å ·ïŒ
brew install git autoconf automake libtool m4 make gcc
åš Windows äžïŒæ©å±éåžžäœäžºé¢çŒè¯çäºè¿å¶æä»¶ååãæšæ éèªå·±æå»ºæ©å±ïŒèæ¯å°å ¶äœäžº DLL æä»¶äžèœœå¹¶æŸçœ®åš PHP æ©å±ç®åœäžã
PIE èœå€ïŒ
pie download ...ïŒpie build ...ïŒpie install ...äœ¿çš PIE å®è£ æ©å±æ¶ïŒå¿ 须䜿çšå ¶ Composer å åç§°ãæšå¯ä»¥åš https://packagist.org/extensions äžæŸå° PIE å Œå®¹å çå衚ã
ç¥éæ©å±åç§°åïŒæšå¯ä»¥äœ¿çšä»¥äžåœä»€å®è£ ïŒ
pie install <vendor>/<package>
# äŸåŠïŒ
pie install xdebug/xdebug
è¿å°æ Xdebug æ©å±å®è£ å°çšäºè°çš PIE ç PHP çæ¬äžïŒäœ¿çšäžè¯¥ PHP çæ¬å Œå®¹çææ°çš³å®çæ¬ç Xdebugã
åŠææšè¯åŸäžºäžåçæ¬ç PHP å®è£
æ©å±ïŒåšé Windows ç³»ç»äžå¯ä»¥äœ¿çš --with-php-config é项æå®ïŒ
pie install --with-php-config=/usr/bin/php-config7.2 my/extension
åš Windows äžïŒæšå¯ä»¥äœ¿çš --with-php-path é项æäŸ php 坿§è¡æä»¶æ¬èº«çè·¯åŸãè¿æ¯ Windows äžçäžäžªç€ºäŸïŒå
¶äžäœ¿çš PHP 8.1 è¿è¡ PIEïŒäœæä»¬æ³äžº PHP 8.3 äžèœœæ©å±ïŒ
> C:\php-8.1.7\php.exe C:\pie.phar install --with-php-path=C:\php-8.3.6\php.exe example/example-pie-extension
æšå¯èœè¿éèŠäžºç®æ PHP çæ¬äœ¿çšçžåºç phpize åœä»€ïŒå¯ä»¥äœ¿çš --with-phpize-path é项æå®ïŒ
pie install --with-phpize-path=/usr/bin/phpize7.2 my/extension
äœ¿çš PIE å®è£ æ©å±æ¶ïŒå¯ä»¥éæ©æå®çæ¬çºŠæïŒ
pie install <vendor>/<package>:<version-constraint>
åŠæç»åº version-constraintïŒåå°è¯å®è£
äžå
è®žçæ¬å¹é
çè¯¥çæ¬ãçæ¬çºŠæäœ¿çšäž Composer çžåçæ ŒåŒè§£æïŒä»¥åæå°çš³å®æ§ã
^1.0 å°å®è£
äž 1.0.0 å以äžçæ¬ååå
Œå®¹çææ°çš³å®çæ¬ïŒæ ¹æ®è¯ä¹åçæ¬ã
è¯Šè§ Composer ææ¡£ã^2.3@beta å°å®è£
äž 2.3.0 å以äžçæ¬ååå
Œå®¹çææ° beta çæ¬ïŒäŸåŠ 2.3.0-beta.3ïŒãdev-main å°å®è£
åœä»€æ§è¡æ¶ main 忝äžçææ°æäº€ãè¿äžéçšäº WindowsïŒå 䞺没æåžŠ Windows äºè¿å¶æä»¶çååžçæ¬ãdev-main#07f454ad797c30651be8356466685b15331f72ff å°å®è£
# åçæäº€ sha 衚瀺çç¹å®æäº€ïŒåšè¿ç§æ
åµäžå°å®è£
æäº€ 07f454ad797c30651be8356466685b15331f72ffãè¿äžéçšäº WindowsïŒå 䞺没æåžŠ Windows äºè¿å¶æä»¶çååžçæ¬ãåœç»åº version-constraint æ¶ïŒå®äŒè¢«æ£æ¥å¹¶çŽæ¥æ·»å å°ç®æ PHP çæ¬ç pie.json äžïŒäŸåŠïŒ
$ pie install "xdebug/xdebug:^3.4.3 || 3.4.1"
å°åš pie.json äžè®Ÿçœ®ä»¥äžå
容ïŒ
{
"require": {
"xdebug/xdebug": "^3.4.3 || 3.4.1"
}
}
åŠææªç»åº version-constraintïŒåå°è¯å®è£
ä»»äœå
Œå®¹çææ°çš³å®çæ¬ãPIE å§ç»äŒå
éæ©çš³å®çæ¬ã
çŒè¯æ©å±æ¶ïŒæäºæ©å±éèŠå ./configure åœä»€äŒ éé¢å€åæ°ãè¿äºåæ°éåžžçšäºå¯çšæçŠçšæäºåèœïŒææäŸæªèªå𿣿µå°çåºè·¯åŸã
èŠç¡®å®æ©å±å¯çšçé
眮é项ïŒå¯ä»¥äœ¿çš pie info <vendor>/<package>ïŒå®å°è¿åäžäžªå衚ïŒäŸåŠïŒ
Configure options:
--enable-some-functionality (whether to enable some additional functionality provided)
--with-some-library-name=? (Path for some-library)
ç¶åå¯ä»¥äœ¿çšæ ãéšåæå šéšæå®çé 眮é项å®è£ äžè¿°ç€ºäŸæ©å±ïŒäžäºç€ºäŸïŒ
pie install example/some-extension
pie install example/some-extension --enable-some-functionality
pie install example/some-extension --with-some-library-name=/path/to/the/lib
pie install example/some-extension --with-some-library-name=/path/to/the/lib --enable-some-functionality
PIE äŒèªåšå°è¯éè¿åšéåœç INI æä»¶äžæ·»å extension=... æ zend_extension=... æ¥å¯çšæ©å±ãåŠææšæ³çŠçšæ€è¡äžºïŒè¯·åš pie install åœä»€äžäŒ é --skip-enable-extension æ å¿ãå°è¯å¯çšæ©å±æ¶äœ¿çšä»¥äžææ¯ïŒ
phpenmoddocker-php-ext-enableåŠæè¿äºææ¯éœäžèµ·äœçšïŒæè
æšäœ¿çšäº --skip-enable-extension æ å¿ïŒPIE å°èŠåæšæ©å±æªå¯çšïŒå¹¶æ³šææšå¿
é¡»èªå·±å¯çšæ©å±ã
ææ¶æšå¯èœæ³ä» Packagist.org 以å€çå ä»åºïŒåŠ Private PackagistïŒå®è£ æ©å±ïŒæä»æ¬å°ç®åœå®è£ ãç±äº PIE åŸå€§çšåºŠäžåºäº ComposerïŒå¯ä»¥äœ¿çšå ¶ä»äžäºä»åºç±»åïŒ
pie repository:add [--with-php-config=...] path /path/to/your/local/extensionpie repository:add [--with-php-config=...] vcs https://github.com/youruser/yourextensionpie repository:add [--with-php-config=...] composer https://repo.packagist.com/your-private-packagist/pie repository:add [--with-php-config=...] composer packagist.orgrepository:* åœä»€éœæ¯æå¯éç --with-php-config æ å¿ïŒå
è®žæšæå®èŠäœ¿çšç PHP å®è£
ïŒäŸåŠïŒåŠæäžå°æºåšäžæå€äžª PHP å®è£
ïŒãäžè¿°æ·»å çä»åºä¹å¯ä»¥äœ¿çšçžåç repository:remove åœä»€å é€ïŒ
pie repository:remove [--with-php-config=...] /path/to/your/local/extensionpie repository:remove [--with-php-config=...] https://github.com/youruser/yourextensionpie repository:remove [--with-php-config=...] https://repo.packagist.com/your-private-packagist/pie repository:remove [--with-php-config=...] packagist.org泚æïŒåš repository:remove äžäžéèŠæå®ä»åºç±»åïŒåªéæäŸ URLã
æšå¯ä»¥äœ¿çšä»¥äžåœä»€ååºç®æ PHP å®è£ çä»åºïŒ
pie repository:list [--with-php-config=...]åœåš PHP 项ç®å·¥äœç®åœäžæ¶ïŒå¯ä»¥äœ¿çš pie install æ¥æ£æ¥é¡¹ç®æéçæ©å±æ¯åŠååšãåŠæçŒºå°æ©å±ïŒPIE å°å°è¯æŸå°å®è£
åéå¹¶ä»¥äº€äºæ¹åŒè¯¢é®æšæ¯åŠèŠå®è£
ãäŸåŠïŒ
$ pie install
𥧠PHP Installer for Extensions (PIE), 0.9.0, from The PHP Foundation
You are running PHP 8.3.19
Target PHP installation: 8.3.19 nts, on Linux/OSX/etc x86_64 (from /usr/bin/php8.3)
Checking extensions for your project your-vendor/your-project
requires: curl â
Already installed
requires: intl â
Already installed
requires: json â
Already installed
requires: example_pie_extension â ïž Missing
The following packages may be suitable, which would you like to install:
[0] None
[1] asgrim/example-pie-extension: Example PIE extension
> 1
> 𥧠PHP Installer for Extensions (PIE), 0.9.0, from The PHP Foundation
> This command may need elevated privileges, and may prompt you for your password.
> You are running PHP 8.3.19
> Target PHP installation: 8.3.19 nts, on Linux/OSX/etc x86_64 (from /usr/bin/php8.3)
> Found package: asgrim/example-pie-extension:2.0.2 which provides ext-example_pie_extension
... (snip) ...
> â
Extension is enabled and loaded in /usr/bin/php8.3
Finished checking extensions.
ç±äº PIE æ¯ PECL çæ¿ä»£åïŒè¿éæ¯æšå¯èœçæç PECL åœä»€äž PIE äžè¿äŒŒçæåœä»€çæ¯èŸã请泚æïŒæäºæŠå¿µåš PIE äžææäžåæè¢«çç¥ïŒå 䞺å®ä»¬å¯èœäžéçšäºæ°å·¥å ·ã
| PECL | PIE |
|---|---|
pecl build xdebug |
pie build xdebug/xdebug |
pecl bundle xdebug |
pie download xdebug/xdebug |
pecl channel-add channel.xml |
pie repository:add vcs https://github.com/my/extension |
pecl channel-alias |
|
pecl channel-delete channel |
pie repository:remove https://github.com/my/extension |
pecl channel-discover |
|
pecl channel-login |
|
pecl channel-logout |
|
pecl channel-update |
|
pecl clear-cache |
|
pecl config-create |
|
pecl config-get |
|
pecl config-help |
|
pecl config-set |
|
pecl config-show |
|
pecl convert |
|
pecl cvsdiff |
|
pecl cvstag |
|
pecl download xdebug |
pie download xdebug/xdebug |
pecl download-all |
|
pecl info xdebug |
pie info xdebug/xdebug |
pecl install xdebug |
pie install xdebug/xdebug |
pecl list |
pie show |
pecl list-all |
è®¿é® Packagist æ©å±å衚 |
pecl list-channels |
pie repository:list |
pecl list-files |
|
pecl list-upgrades |
|
pecl login |
|
pecl logout |
|
pecl makerpm |
|
pecl package |
Linux - ä»
æ è®°ååžçæ¬ãWindows - äœ¿çš php/php-windows-builder action |
pecl package-dependencies |
|
pecl package-validate |
åšæšçæ©å±æ£åºäžïŒcomposer validate |
pecl pickle |
|
pecl remote-info xdebug |
pie info xdebug/xdebug |
pecl remote-list |
è®¿é® Packagist æ©å±å衚 |
pecl run-scripts |
|
pecl run-tests |
|
pecl search |
è®¿é® Packagist æ©å±å衚 |
pecl shell-test |
|
pecl sign |
|
pecl svntag |
|
pecl uninstall |
|
pecl update-channels |
|
pecl upgrade xdebug |
pie install xdebug/xdebug |
pecl upgrade-all |
PIE follows the usual PHP extension build and install process, namely:
phpize to set up the PHP API parameters. The person installing the
extension may specify --with-phpize-path if phpize is not in the path../configure to configure the build parameters and libraries for the
specific system. The person installing the extension may specify the
configure options that you have specified in composer.json. See the
Configure Options documentation for how to do this.make to actually build the extension. This will try to detect the number
of parallel processes to run automatically, but the person installing may
override this with --make-parallel-jobs N or -jN options.make install to install the extension to the configured PHP installation.
If PIE does not have permissions to write to the installation location, it
will attempt to elevate privileges with sudo.Note that this does mean the systems you are running PIE on need to have the appropriate build tools installed. A useful resource for building extensions and how PHP's internal works is the PHP Internals Book.
For Windows systems, extension maintainers must provide pre-built binaries. See the Windows Support section below for details on how to do this in the right way for PIE.
Adding PIE support for your extension is relatively straightforward, and the flow is quite similar to adding a regular PHP package into Packagist.
If you are a maintainer of an existing PECL extension, here are a few helpful pieces of information for some context:
package.xml is no longer needed if
you no longer want to publish to PECL. If you want to keep publishing to
PECL for now, then you can keep package.xml maintained.package.xml lists each release explicitly. With PIE, this is no longer
necessary, as Packagist will pick up tags or branch aliases in the same
way that regular Composer packages do. This means that to release your
package, you need to push a tag and release.composer.json to your extensionThe first step to adding PIE support is adding a composer.json to your
extension repository. Most of the typical fields are the same as a regular
Composer package, with a few notable exceptions:
type MUST be either php-ext for a PHP Module (this will be most
extensions), or php-ext-zend for a Zend Extension.php-ext section MAY exist (see below for the directives
that can be within php-ext)name field) MUST follow
the usual Composer package name format, i.e. <vendor>/<package>.type fields.php-ext definitionextension-nameThe extension-name MAY be specified, and MUST conform to the usual extension
name regular expression, which is defined in
\Php\Pie\ExtensionName::VALID_PACKAGE_NAME_REGEX.
If the extension-name is not specified, the extension-name will be derived
from the Composer package name, with the vendor prefix removed. For example,
given a composer.json with:
{
"name": "myvendor/myextension"
}
The extension name would be derived as myextension. The myvendor/ vendor
prefix is removed.
â ïž Warning
If your Composer package name would result in an invalid PHP extension name, you MUST specify the
extension-namedirective. For example a Composer package namemyvendor/my-extensionwould result in an invalid PHP extension name, since hypens are not allowed, so you MUST specify a validextension-namefor this Composer package name.
The extension-name SHOULD NOT be prefixed with ext- as is a convention in
Composer when using require.
An example of extension-name being used:
{
"name": "xdebug/xdebug",
"php-ext": {
"extension-name": "xdebug"
}
}
prioritypriority forms part of the ini filename to control ordering of extensions,
if the target platform uses the multiple INI files in a directory.
support-zts and support-ntsIndicates whether the extension supports Zend Thread-Safe (ZTS) and non-Thread-
Safe (NTS) modes. Both these flags default to true if not specified, but if
your extension does not support either mode, it MUST be specified, and will
mean the extension will not be installable on the target platform.
Theoretically, it is possible to specify false for both support-zts and
support-nts, but this will mean your package cannot be installed anywhere, so
is not advisable.
configure-optionsThis is a list of parameters that may be passed to the ./configure command.
Each item of the list is a JSON object with:
name, the parameter name itselfdescription, a helpful description of what the parameter doesneeds-value, a boolean to tell PIE whether the parameter is a
simple flag (typically used for --enable-this-flag type parameters), or if
the parameter should have a value specified (typically used for
--with-library-path=... type parameters, where a value must be given by
the end user)When an end user is installing an extension with PIE, they may specify any
defined configure-options that are passed to ./configure. For example, if
an extension defines the following composer.json:
{
"name": "myvendor/myext",
"php-ext": {
"extension-name": "myext",
"configure-options": [
{
"name": "enable-my-flag",
"description": "Should my flag be enabled",
"needs-value": false
},
{
"name": "with-some-lib",
"description": "Specify the path to some-lib",
"needs-value": true
}
]
}
}
Then the pie build or pie install commands may be invoked in the following
ways to achieve the desired configuration:
pie install myvendor/myext
./configure without any parameterspie install myvendor/myext --enable-my-flag
./configure --enable-my-flagpie install myvendor/myext --with-some-lib=/path/to/somelib
./configure --with-some-lib=/path/to/somelibpie install myvendor/myext --enable-my-flag --with-some-lib=/path/to/somelib
./configure --enable-my-flag --with-some-lib=/path/to/somelibNote that it is not possible for end users of PIE to specify configuration
options that have not been defined in your extension's configure-options
definition. Using the same example above composer.json, invoking PIE with
an invalid option, such as pie install myvendor/myext --something-else will
result in an error The "--something-else" option does not exist..
If an end user does not specify a flag defined in the configure-options
definition, it will not be passed to ./configure. There is no way to specify
a default value in the configure-options definition. Your config.m4 should
handle this accordingly.
build-pathThe build-path setting may be used if your source code is not in the root
of your repository. For example, if your repository structure is like:
/
docs/
src/
config.m4
config.w32
myext.c
...etc
In this case, the actual extension source code would be built in src/, so you
should specify this path in build-path, for example:
{
"name": "myvendor/myext",
"php-ext": {
"extension-name": "myext",
"build-path": "src"
}
}
The build-path may contain some templated values which are replaced:
{version} to be replaced with the package version. For example a package
with version 1.2.3 with a build-path of myext-{version} the actual build
path would become myext-1.2.3.download-url-methodThe download-url-method directive allows extension maintainers to
change the behaviour of downloading the source package. This should be defined
as a list of supported methods, but for backwards compatibility a single
string may be used.
The possible values are:
composer-defaultpre-packaged-sourcepre-packaged-binaryThe default value, if nothing is specified is ["composer-default"].
Setting this to composer-default, which is the default value if nothing is
specified, will use the default behaviour implemented by Composer, which is
to use the standard ZIP archive from the GitHub API (or other source control
system). PIE will then build and install the extension from source.
Using pre-packaged-source will locate a source code package in the release
assets list based matching one of the following naming conventions:
php_{ExtensionName}-{Version}-src.tgz (e.g. php_myext-1.20.1-src.tgz)php_{ExtensionName}-{Version}-src.zip (e.g. php_myext-1.20.1-src.zip){ExtensionName}-{Version}.tgz (this is intended for backwards
compatibility with PECL packages)This is useful for scenarios where you might need additional dependencies pulled into the source build, which would not be available if you downloaded the ZIP archive from your repository. For example, if your extension uses Git Submodules to include third party libraries statically in the build.
ðš Caution
If your extension depends on dynamically linked libraries, it is not recommended to use
pre-packaged-binaryoption, as the correct version, or at least compatible linked libraries may not be available on the end user's system. Use with caution!
Using pre-packaged-binary will attempt to locate a Zip (or TGZ) archive in
the release assets list based on matching one of the following naming
conventions:
php_{ExtensionName}-{Version}_php{PhpVersion}-{Arch}-{OS}-{Libc}-{Debug}-{TSMode}.{Format}The replacements are:
{ExtensionName} the name of your extension, e.g. yourext (hint: this
is not your Composer package name!){PhpVersion} the major and minor version of PHP, e.g. 8.5{Version} the version of your extension, e.g. 1.20.1{Arch} the architecture of the binary, one of x86, x86_64, arm64{OS} the operating system, one of windows, darwin, linux, bsd, solaris, unknown{Libc} the libc flavour, one of glibc, musl, bsdlibc{Debug} the debug mode, one of debug, nodebug (or omitted){TSMode} the thread safety mode, one of zts, nts (or omitted){Format} the archive format, one of zip, tgz - note that ZIP is
preferred as it means there are fewer dependencies for the end userð¡ Tip
In order to generate pre-built binaries for PIE, you could use the php/pie-ext-binary-builder GitHub Action. This will build and name the assets correctly for you.
Some examples of valid asset names:
php_yourext-4.1_php8.4-x86_64-linux-glibc.zip (or php_yourext-4.1_php8.4-x86_64-glibc-nts.zip)php_yourext-4.1_php8.4-x86_64-linux-musl.zip (or php_yourext-4.1_php8.4-x86_64-musl-nts.zip)php_yourext-4.1_php8.4-arm64-linux-glibc.zip (or php_yourext-4.1_php8.4-arm64-glibc-nts.zip)php_yourext-4.1_php8.4-arm64-linux-musl.zip (or php_yourext-4.1_php8.4-arm64-musl-nts.zip)php_yourext-4.1_php8.4-x86_64-linux-glibc-zts.zipphp_yourext-4.1_php8.4-x86_64-linux-musl-zts.zipphp_yourext-4.1_php8.4-arm64-linux-glibc-zts.zipphp_yourext-4.1_php8.4-arm64-linux-musl-zts.zipphp_yourext-4.1_php8.4-x86_64-linux-glibc-debug.zipphp_yourext-4.1_php8.4-x86_64-linux-musl-debug.zipphp_yourext-4.1_php8.4-arm64-linux-glibc-debug.zipphp_yourext-4.1_php8.4-arm64-linux-musl-debug.zipIt is recommended that pre-packaged-binary is combined with composer-default
as a fallback mechanism, if a particular combination is supported, but not
pre-packaged on the release, e.g. "download-url-method": ["pre-packaged-binary", "composer-default"].
PIE will try to find a pre-packaged binary asset first, but if it cannot
find an appropriate binary, it will download the source code and build it
in the traditional manner.
{
"name": "myvendor/myext",
"php-ext": {
"download-url-method": ["pre-packaged-binary", "composer-default"]
}
}
os-families restrictionsThe os-families and os-families-exclude directive allow extention maintainers
to restrict the Operating System compatibility.
os-families An array of OS families to mark as compatible with the extension.
(e.g. "os-families": ["windows"] for an extension only available on Windows)os-families-exclude An array of OS families to mark as incompatible with the
extension. (e.g. "os-families-exclude": ["windows"] for an extension that
cannot be installed available on Windows)The list of accepted OS families: "windows", "bsd", "darwin", "solaris", "linux", "unknown"
â ïž Warning
Only one of
os-familiesandos-families-excludecan be defined.
Extension authors may define some dependencies in require, but typically,
most extensions would not need to define dependencies, except for the PHP
versions supported by the extension, and system libraries.
Dependencies on a regular PHP package (such as monolog/monolog) SHOULD NOT be
specified in your extension's require section.
Dependencies on other extensions may be defined, for example ext-json.
It is worth noting that if your extension does define a dependency on another dependency, and this is not available, someone installing your extension would receive a message such as:
Cannot use myvendor/myextension's latest version 1.2.3 as it requires
ext-something * which is missing from your platform.
In PIE 1.4.0, the ability for extension authors to define system library dependencies was added, and in some cases, automatically install them.
The following libraries are supported at the moment. If you would like to add a library, please open a discussion in the first instance. Don't just open a PR without discussing first please!
We are adding libraries and improving this feature over time. If the automatic install of a system dependency that is supported below in your package manager is NOT working, then please report a bug.
| Library | Checked by PIE | Auto-installs in |
|---|---|---|
| lib-curl | â | apt, apk, dnf, yum |
| lib-enchant | â | â |
| lib-enchant-2 | â | â |
| lib-sodium | â | apt, apk, dnf, yum |
| lib-ffi | â | apt, apk, dnf, yum |
| lib-xslt | â | apt, apk, dnf, yum |
| lib-zip | â | apt, apk, dnf, yum |
| lib-png | â | â |
| lib-avif | â | â |
| lib-webp | â | â |
| lib-jpeg | â | apt, apk, dnf, yum |
| lib-xpm | â | â |
| lib-freetype2 | â | â |
| lib-gdlib | â | â |
| lib-gmp | â | â |
| lib-sasl | â | â |
| lib-onig | â | â |
| lib-odbc | â | â |
| lib-capstone | â | â |
| lib-pcre | â | â |
| lib-edit | â | â |
| lib-snmp | â | â |
| lib-argon2 | â | â |
| lib-uriparser | â | â |
| lib-exslt | â | â |
First up, you can use composer validate to check your composer.json is
formatted correctly, e.g.:
$ composer validate
./composer.json is valid
You may then use pie install to install your extension while in its directory:
$ cd /path/to/my/extension
$ pie install
𥧠PHP Installer for Extensions (PIE) 1.0.0, from The PHP Foundation
Installing PIE extension from /home/james/workspace/phpf/example-pie-extension
This command may need elevated privileges, and may prompt you for your password.
You are running PHP 8.4.8
Target PHP installation: 8.4.8 nts, on Linux/OSX/etc x86_64 (from /usr/bin/php8.4)
Found package: asgrim/example-pie-extension:dev-main which provides ext-example_pie_extension
Extracted asgrim/example-pie-extension:dev-main source to: /home/james/.config/pie/php8.4_572ee73609adb95bf0b8539fecdc5c0e/vendor/asgrim/example-pie-extension
Build files cleaned up.
phpize complete.
Configure complete.
Build complete: /home/james/.config/pie/php8.4_572ee73609adb95bf0b8539fecdc5c0e/vendor/asgrim/example-pie-extension/modules/example_pie_extension.so
Cannot write to /usr/lib/php/20240924, so using sudo to elevate privileges.
Install complete: /usr/lib/php/20240924/example_pie_extension.so
â
Extension is enabled and loaded in /usr/bin/php8.4
If you want to just test the build of your application, without installling it to your target PHP version, you will first need to your extension directory as a "path" type repository:
$ cd /path/to/my/extension
$ pie repository:add path .
𥧠PHP Installer for Extensions (PIE) 1.0.0, from The PHP Foundation
You are running PHP 8.4.8
Target PHP installation: 8.4.8 nts, on Linux/OSX/etc x86_64 (from /usr/bin/php8.4)
The following repositories are in use for this Target PHP:
- Path Repository (/home/james/workspace/phpf/example-pie-extension)
- Packagist
Then you may test that it builds with:
$ pie build asgrim/example-pie-extension:*@dev
ð¡ Tip
Since your extension is not yet published to Packagist, you should specify
*@devas the version constraint, otherwise PIE will not find your extension as the default stability isstable.
Once you have committed your composer.json to your repository, you may then
submit it to Packagist in the same way as any other package.
In order to support Windows users, you must publish pre-built DLLs, as PIE does not currently support building DLLs on the fly. The expected workflow for Windows-compatible releases is:
The name of the ZIP file, and the DLL contained within must be:
php_{extension-name}-{tag}-{php-maj/min}-{ts|nts}-{compiler}-{arch}.zipphp_xdebug-3.3.2-8.3-ts-vs16-x86_64.zipThe descriptions of these items:
extension-name the name of the extension, e.g. xdebugtag for example 3.3.0alpha3 - defined by the tag/release you have madephp-maj/min - for example 8.3 for PHP 8.3.*compiler - usually something like vc6, vs16 - fetch from
'PHP Extension Build' flags in php -its|nts - Thread-safe or non-thread safe.arch - for example x86_64.
Architecture from php -i (see below)PHP_INT_SIZE - 4 for 32-bit, 8 for 64-bit.Note the architecture name will likely need normalising, since different platforms name architectures differently. PIE expects the following normalised architectures:
x86_64 (normalised from x64, x86_64, AMD64)arm64 (normalised from arm64)x86 (any other value)For the latest map (in case documentation is not up to date), check out
\Php\Pie\Platform\Architecture::parseArchitecture.
The pre-built ZIP should contain at minimum a DLL named in the same way as the
ZIP itself, for example
php_{extension-name}-{tag}-{php-maj/min}-{ts|nts}-{compiler}-{arch}.dll.
The .dll will be moved into the PHP extensions path, and renamed, e.g.
to C:\path\to\php\ext\php_{extension-name}.dll. The ZIP file may include
additional resources, such as:
php_{extension-name}-{tag}-{php-maj/min}-{ts|nts}-{compiler}-{arch}.pdb -
this will be moved alongside the C:\path\to\php\ext\php_{extension-name}.dll*.dll - any other .dll would be moved alongside C:\path\to\php\php.exeC:\path\to\php\extras\{extension-name}\.PHP provides a set of GitHub Actions that enable extension maintainers to build and release the Windows compatible assets. An example workflow that uses these actions:
name: Publish Windows Releases
on:
release:
types: [published]
permissions:
contents: write
jobs:
get-extension-matrix:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.extension-matrix.outputs.matrix }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Get the extension matrix
id: extension-matrix
uses: php/php-windows-builder/extension-matrix@v1
build:
needs: get-extension-matrix
runs-on: ${{ matrix.os }}
strategy:
matrix: ${{fromJson(needs.get-extension-matrix.outputs.matrix)}}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Build the extension
uses: php/php-windows-builder/extension@v1
with:
php-version: ${{ matrix.php-version }}
arch: ${{ matrix.arch }}
ts: ${{ matrix.ts }}
release:
runs-on: ubuntu-latest
needs: build
if: ${{ github.event_name == 'release' }}
steps:
- name: Upload artifact to the release
uses: php/php-windows-builder/release@v1
with:
release: ${{ github.event.release.tag_name }}
token: ${{ secrets.GITHUB_TOKEN }}
Source: https://github.com/php/php-windows-builder?tab=readme-ov-file#examples
To help backwards compatibility with PECL extensions, PIE supports some automatic placeholder replacements within
all .c and .h files found within the downloaded source directory. These placeholders are replaced after the
download step, and before the build step. PIE will automatically replace the following placeholders:
| Placeholder | Description | Example |
|---|---|---|
@name@, @package_name@, @package-name@ |
The short, internal name of the PHP extension (e.g., xdebug). Note: this is not the Packagist package name (e.g. xdebug/xdebug). |
xdebug |
@version@, @package_version@, @package-version@ |
The "pretty" version of the package defined in composer.json. |
3.3.2 |
@release_date@, @release-date@ |
The formatted release date according to Composer package metadata. | 2024-01-15T10:00:00+00:00 |
@php_bin@, @php-bin@ |
The full path to the PHP binary executable used during the build. | /usr/bin/php8.4 |
â ïž Warning
This translation may not be based on the latest version, please ensure you check the original English version for discrepancies.
PIE ã¯éåžžã® PHP æ¡åŒµæ©èœã®ãã«ããšã€ã³ã¹ããŒã«ããã»ã¹ã«åŸããŸãïŒ
phpize ã§ PHP API ãã©ã¡ãŒã¿ãèšå®ããŸããæ¡åŒµæ©èœãã€ã³ã¹ããŒã«ãã人ã¯ãphpize ããã¹ã«ãªãå Žå --with-phpize-path ãæå®ã§ããŸãã./configure ã§ç¹å®ã®ã·ã¹ãã ã®ãã«ããã©ã¡ãŒã¿ãšã©ã€ãã©ãªãèšå®ããŸããæ¡åŒµæ©èœãã€ã³ã¹ããŒã«ãã人ã¯ãcomposer.json ã§æå®ããèšå®ãªãã·ã§ã³ãæå®ã§ããŸãããããè¡ãæ¹æ³ã«ã€ããŠã¯ãèšå®ãªãã·ã§ã³ããã¥ã¡ã³ããåç
§ããŠãã ãããmake ã§å®éã«æ¡åŒµæ©èœããã«ãããŸããããã¯å®è¡ãã䞊åããã»ã¹ã®æ°ãèªåçã«æ€åºããããšããŸãããã€ã³ã¹ããŒã«ãã人㯠--make-parallel-jobs N ãŸã㯠-jN ãªãã·ã§ã³ã§ããããªãŒããŒã©ã€ãã§ããŸããmake install ã§èšå®ããã PHP ã€ã³ã¹ããŒã«ã«æ¡åŒµæ©èœãã€ã³ã¹ããŒã«ããŸããPIE ãã€ã³ã¹ããŒã«å Žæãžã®æžãèŸŒã¿æš©éãæã£ãŠããªãå Žåãsudo ã§æš©éãææ ŒããããšããŸããããã¯ãPIE ãå®è¡ããŠããã·ã¹ãã ã«é©åãªãã«ãããŒã«ãã€ã³ã¹ããŒã«ãããŠããå¿ èŠãããããšãæå³ããŸããæ¡åŒµæ©èœã®ãã«ããš PHP ã®å éšåäœã«é¢ããæçšãªãªãœãŒã¹ã¯ PHP Internals Book ã§ãã
Windows ã·ã¹ãã ã®å Žåãæ¡åŒµæ©èœã¡ã³ãããŒã¯ããªãã«ãããããã€ããªãæäŸããå¿ èŠããããŸããPIE çšã«æ£ããæ¹æ³ã§ãããè¡ãæ¹æ³ã®è©³çްã«ã€ããŠã¯ã以äžã® Windows ãµããŒãã»ã¯ã·ã§ã³ãåç §ããŠãã ããã
æ¡åŒµæ©èœã« PIE ãµããŒãã远å ããããšã¯æ¯èŒçç°¡åã§ãéåžžã® PHP ããã±ãŒãžã Packagist ã«è¿œå ããã®ãšéåžžã«äŒŒãŠããŸãã
æ¢åã® PECL æ¡åŒµæ©èœã®ã¡ã³ãããŒã®å Žåã以äžã¯ã³ã³ããã¹ãã®ããã®æçšãªæ å ±ã§ãïŒ
package.xml ã¯äžèŠã§ããä»ãã PECL ãžã®å
¬éãç¶ãããå Žåã¯ãpackage.xml ãç¶æãç¶ããããšãã§ããŸããpackage.xml ã¯åãªãªãŒã¹ãæç€ºçã«ãªã¹ãããŸããPIE ã§ã¯ãPackagist ãéåžžã® Composer ããã±ãŒãžãšåãæ¹æ³ã§ã¿ã°ãŸãã¯ãã©ã³ããšã€ãªã¢ã¹ãååŸãããããããã¯äžèŠã«ãªããŸãããããã¯ãããã±ãŒãžããªãªãŒã¹ããã«ã¯ãã¿ã°ãšãªãªãŒã¹ãããã·ã¥ããå¿
èŠãããããšãæå³ããŸããcomposer.json ã远å PIE ãµããŒãã远å ããæåã®ã¹ãããã¯ãæ¡åŒµæ©èœãªããžããªã« composer.json ã远å ããããšã§ããã»ãšãã©ã®å
žåçãªãã£ãŒã«ãã¯éåžžã® Composer ããã±ãŒãžãšåãã§ãããããã€ãã®æ³šç®ãã¹ãäŸå€ããããŸãïŒ
type 㯠PHP ã¢ãžã¥ãŒã«ã®å Žå㯠php-extïŒãããã»ãšãã©ã®æ¡åŒµæ©èœã«ãªããŸãïŒããŸã㯠Zend æ¡åŒµæ©èœã®å Žå㯠php-ext-zend ã§ããå¿
èŠããããŸããphp-ext ã»ã¯ã·ã§ã³ãååšããå¯èœæ§ããããŸãïŒphp-ext å
ã«å«ããããšãã§ãããã£ã¬ã¯ãã£ãã«ã€ããŠã¯ä»¥äžãåç
§ïŒname ãã£ãŒã«ãïŒã¯ãéåžžã® Composer ããã±ãŒãžå圢åŒã«åŸãå¿
èŠããããŸããã€ãŸã <vendor>/<package> ã§ããtype ãã£ãŒã«ããç°ãªãå Žåã§ããéåžžã® PHP ããã±ãŒãžãšåã Composer ããã±ãŒãžåãå
±æããŠã¯ãªããŸãããphp-ext å®çŸ©extension-nameextension-name ãæå®ããããšãã§ãã\Php\Pie\ExtensionName::VALID_PACKAGE_NAME_REGEX ã§å®çŸ©ãããŠããéåžžã®æ¡åŒµæ©èœåæ£èŠè¡šçŸã«æºæ ããå¿
èŠããããŸããextension-name ãæå®ãããŠããªãå Žåãextension-name 㯠Composer ããã±ãŒãžåããæŽŸçãããã³ããŒãã¬ãã£ãã¯ã¹ãåé€ãããŸããäŸãã°ã次㮠composer.json ã®å ŽåïŒ
{
"name": "myvendor/myextension"
}
æ¡åŒµæ©èœå㯠myextension ãšããŠæŽŸçãããŸããmyvendor/ ãã³ããŒãã¬ãã£ãã¯ã¹ã¯åé€ãããŸãã
â ïž Warning
Composer ããã±ãŒãžåãç¡å¹ãª PHP æ¡åŒµæ©èœåã«ãªãå Žåã
extension-nameãã£ã¬ã¯ãã£ããæå®ããå¿ èŠããããŸããäŸãã°ãComposer ããã±ãŒãžåmyvendor/my-extensionã¯ãã€ãã³ãèš±å¯ãããŠããªãããç¡å¹ãª PHP æ¡åŒµæ©èœåã«ãªãããããã® Composer ããã±ãŒãžåã«ã¯æå¹ãªextension-nameãæå®ããå¿ èŠããããŸãã
extension-name ã¯ãComposer ã§ require ã䜿çšããéã®æ
£äŸã§ãã ext- ã§ãã¬ãã£ãã¯ã¹ãä»ããã¹ãã§ã¯ãããŸããã
extension-name ã®äœ¿çšäŸïŒ
{
"name": "xdebug/xdebug",
"php-ext": {
"extension-name": "xdebug"
}
}
prioritypriority 㯠ini ãã¡ã€ã«åã®äžéšã圢æããã¿ãŒã²ãããã©ãããã©ãŒã ããã£ã¬ã¯ããªå
ã®è€æ°ã® INI ãã¡ã€ã«ã䜿çšããå Žåãæ¡åŒµæ©èœã®é åºãå¶åŸ¡ããŸãã
support-zts ãš support-ntsæ¡åŒµæ©èœã Zend Thread-SafeïŒZTSïŒããã³éã¹ã¬ããã»ãŒãïŒNTSïŒã¢ãŒãããµããŒããããã©ããã瀺ããŸãããããã®ãã©ã°ã¯æå®ãããŠããªãå Žåãäž¡æ¹ãšãããã©ã«ãã§ true ã§ãããæ¡åŒµæ©èœãããããã®ã¢ãŒãããµããŒãããŠããªãå Žåã¯æå®ããå¿
èŠããããã¿ãŒã²ãããã©ãããã©ãŒã ã«æ¡åŒµæ©èœãã€ã³ã¹ããŒã«ã§ããªãããšãæå³ããŸãã
çè«çã«ã¯ãsupport-zts ãš support-nts ã®äž¡æ¹ã« false ãæå®ããããšã¯å¯èœã§ãããããã¯ããã±ãŒãžãã©ãã«ãã€ã³ã¹ããŒã«ã§ããªãããšãæå³ãããããæšå¥šãããŸããã
configure-optionsãã㯠./configure ã³ãã³ãã«æž¡ãããšãã§ãããã©ã¡ãŒã¿ã®ãªã¹ãã§ãããªã¹ãã®åé
ç®ã¯æ¬¡ã® JSON ãªããžã§ã¯ãã§ãïŒ
nameããã©ã¡ãŒã¿åèªäœdescriptionããã©ã¡ãŒã¿ãäœããããã®åœ¹ç«ã€èª¬æneeds-valueãPIE ã«ãã©ã¡ãŒã¿ãåçŽãªãã©ã°ïŒéåžž --enable-this-flag ã¿ã€ãã®ãã©ã¡ãŒã¿ã«äœ¿çšïŒãããã©ã¡ãŒã¿ã«å€ãæå®ããå¿
èŠããããïŒéåžž --with-library-path=... ã¿ã€ãã®ãã©ã¡ãŒã¿ã«äœ¿çšããããšã³ããŠãŒã¶ãŒãå€ãæå®ããå¿
èŠãããïŒãäŒããããŒã«å€ãšã³ããŠãŒã¶ãŒã PIE ã§æ¡åŒµæ©èœãã€ã³ã¹ããŒã«ããå Žåã./configure ã«æž¡ãããå®çŸ©æžã¿ã® configure-options ãæå®ã§ããŸããäŸãã°ãæ¡åŒµæ©èœã次㮠composer.json ãå®çŸ©ããŠããå ŽåïŒ
{
"name": "myvendor/myext",
"php-ext": {
"extension-name": "myext",
"configure-options": [
{
"name": "enable-my-flag",
"description": "Should my flag be enabled",
"needs-value": false
},
{
"name": "with-some-lib",
"description": "Specify the path to some-lib",
"needs-value": true
}
]
}
}
次ã®ããã« pie build ãŸã㯠pie install ã³ãã³ããåŒã³åºããŠãç®çã®èšå®ãå®çŸã§ããŸãïŒ
pie install myvendor/myext
./configure ãåŒã³åºããŸãpie install myvendor/myext --enable-my-flag
./configure --enable-my-flag ãåŒã³åºããŸãpie install myvendor/myext --with-some-lib=/path/to/somelib
./configure --with-some-lib=/path/to/somelib ãåŒã³åºããŸãpie install myvendor/myext --enable-my-flag --with-some-lib=/path/to/somelib
./configure --enable-my-flag --with-some-lib=/path/to/somelib ãåŒã³åºããŸãPIE ã®ãšã³ããŠãŒã¶ãŒã¯ãæ¡åŒµæ©èœã® configure-options å®çŸ©ã§å®çŸ©ãããŠããªãèšå®ãªãã·ã§ã³ãæå®ããããšã¯ã§ããŸãããäžèšãšåã composer.json ã®äŸã䜿çšããŠãç¡å¹ãªãªãã·ã§ã³ã§ PIE ãåŒã³åºãå ŽåãäŸãã° pie install myvendor/myext --something-else ã¯ãšã©ãŒ The "--something-else" option does not exist. ã«ãªããŸãã
ãšã³ããŠãŒã¶ãŒã configure-options å®çŸ©ã§å®çŸ©ããããã©ã°ãæå®ããªãå Žåããã㯠./configure ã«æž¡ãããŸãããconfigure-options å®çŸ©ã§ããã©ã«ãå€ãæå®ããæ¹æ³ã¯ãããŸãããconfig.m4 ã§ããã«å¿ããŠåŠçããå¿
èŠããããŸãã
build-pathãœãŒã¹ã³ãŒãããªããžããªã®ã«ãŒãã«ãªãå Žåãbuild-path èšå®ã䜿çšã§ããŸããäŸãã°ããªããžããªæ§é ãæ¬¡ã®ãããªå ŽåïŒ
/
docs/
src/
config.m4
config.w32
myext.c
...etc
ãã®å Žåãå®éã®æ¡åŒµæ©èœãœãŒã¹ã³ãŒã㯠src/ ã§ãã«ãããããããbuild-path ã§ãã®ãã¹ãæå®ããå¿
èŠããããŸãïŒ
{
"name": "myvendor/myext",
"php-ext": {
"extension-name": "myext",
"build-path": "src"
}
}
build-path ã«ã¯ã眮ãæãããããã³ãã¬ãŒãå€ãå«ããããšãã§ããŸãïŒ
{version} ã¯ããã±ãŒãžããŒãžã§ã³ã«çœ®ãæããããŸããäŸãã°ãããŒãžã§ã³ 1.2.3 ã®ããã±ãŒãžã§ build-path ã myext-{version} ã®å Žåãå®éã®ãã«ããã¹ã¯ myext-1.2.3 ã«ãªããŸããdownload-url-methoddownload-url-method ãã£ã¬ã¯ãã£ãã«ãããæ¡åŒµæ©èœã¡ã³ãããŒã¯ãœãŒã¹ããã±ãŒãžã®ããŠã³ããŒãåäœã倿Žã§ããŸãã
composer-default ã«èšå®ãããšïŒæå®ãããŠããªãå Žåã®ããã©ã«ãå€ïŒãComposer ã«ãã£ãŠå®è£
ãããããã©ã«ãã®åäœã䜿çšãããŸããããã¯ãGitHub APIïŒãŸãã¯ä»ã®ãœãŒã¹ã³ã³ãããŒã«ã·ã¹ãã ïŒããã®æšæº ZIP ã¢ãŒã«ã€ãã䜿çšããããšã§ããpre-packaged-source ã䜿çšãããšã次ã®åœåèŠåã®ããããã«äžèŽãããªãªãŒã¹ã¢ã»ãããªã¹ãã§ãœãŒã¹ã³ãŒãããã±ãŒãžãèŠã€ããŸãïŒ
php_{ExtensionName}-{Version}-src.tgzïŒäŸïŒphp_myext-1.20.1-src.tgzïŒphp_{ExtensionName}-{Version}-src.zipïŒäŸïŒphp_myext-1.20.1-src.zipïŒ{ExtensionName}-{Version}.tgzïŒãã㯠PECL ããã±ãŒãžãšã®åŸæ¹äºææ§ã®ããïŒos-families å¶éos-families ããã³ os-families-exclude ãã£ã¬ã¯ãã£ãã«ãããæ¡åŒµæ©èœã¡ã³ãããŒã¯ãªãã¬ãŒãã£ã³ã°ã·ã¹ãã ã®äºææ§ãå¶éã§ããŸãã
os-families æ¡åŒµæ©èœãšäºææ§ããããšããŒã¯ãã OS ãã¡ããªãŒã®é
åãïŒäŸïŒ"os-families": ["windows"] 㯠Windows ã§ã®ã¿å©çšå¯èœãªæ¡åŒµæ©èœïŒos-families-exclude æ¡åŒµæ©èœãšäºææ§ããªããšããŒã¯ãã OS ãã¡ããªãŒã®é
åãïŒäŸïŒ"os-families-exclude": ["windows"] 㯠Windows ã«ã€ã³ã¹ããŒã«ã§ããªãæ¡åŒµæ©èœïŒåãå ¥ãããã OS ãã¡ããªãŒã®ãªã¹ãïŒ"windows"ã"bsd"ã"darwin"ã"solaris"ã"linux"ã"unknown"
â ïž Warning
os-familiesãšos-families-excludeã®ãã¡ 1 ã€ã ããå®çŸ©ã§ããŸãã
æ¡åŒµæ©èœäœæè
㯠require ã§ããã€ãã®äŸåé¢ä¿ãå®çŸ©ã§ããŸãããå®éã«ã¯ãã»ãšãã©ã®æ¡åŒµæ©èœã¯ãæ¡åŒµæ©èœããµããŒããã PHP ããŒãžã§ã³ãé€ããŠãäŸåé¢ä¿ãå®çŸ©ããå¿
èŠã¯ãããŸãããä»ã®æ¡åŒµæ©èœãžã®äŸåé¢ä¿ïŒäŸïŒext-jsonïŒãå®çŸ©ã§ããŸãããã ããéåžžã® PHP ããã±ãŒãžïŒäŸïŒmonolog/monologïŒãžã®äŸåé¢ä¿ã¯ require ã»ã¯ã·ã§ã³ã§æå®ãã¹ãã§ã¯ãããŸããã
æ¡åŒµæ©èœãå¥ã®äŸåé¢ä¿ãžã®äŸåé¢ä¿ãå®çŸ©ãããããå©çšã§ããªãå Žåãæ¡åŒµæ©èœãã€ã³ã¹ããŒã«ããäººã¯æ¬¡ã®ãããªã¡ãã»ãŒãžãåãåããŸãïŒ
Cannot use myvendor/myextension's latest version 1.2.3 as it requires
ext-something * which is missing from your platform.
ãŸããcomposer validate ã䜿çšã㊠composer.json ãæ£ãããã©ãŒããããããŠããã確èªã§ããŸãïŒ
$ composer validate
./composer.json is valid
次ã«ãæ¡åŒµæ©èœã®ãã£ã¬ã¯ããªã§ pie install ã䜿çšããŠæ¡åŒµæ©èœãã€ã³ã¹ããŒã«ã§ããŸãïŒ
$ cd /path/to/my/extension
$ pie install
𥧠PHP Installer for Extensions (PIE) 1.0.0, from The PHP Foundation
Installing PIE extension from /home/james/workspace/phpf/example-pie-extension
This command may need elevated privileges, and may prompt you for your password.
You are running PHP 8.4.8
Target PHP installation: 8.4.8 nts, on Linux/OSX/etc x86_64 (from /usr/bin/php8.4)
Found package: asgrim/example-pie-extension:dev-main which provides ext-example_pie_extension
Extracted asgrim/example-pie-extension:dev-main source to: /home/james/.config/pie/php8.4_572ee73609adb95bf0b8539fecdc5c0e/vendor/asgrim/example-pie-extension
Build files cleaned up.
phpize complete.
Configure complete.
Build complete: /home/james/.config/pie/php8.4_572ee73609adb95bf0b8539fecdc5c0e/vendor/asgrim/example-pie-extension/modules/example_pie_extension.so
Cannot write to /usr/lib/php/20240924, so using sudo to elevate privileges.
Install complete: /usr/lib/php/20240924/example_pie_extension.so
â
Extension is enabled and loaded in /usr/bin/php8.4
ã¢ããªã±ãŒã·ã§ã³ã®ãã«ãããã¹ãããã ãã§ãã¿ãŒã²ãã PHP ããŒãžã§ã³ã«ã€ã³ã¹ããŒã«ããªãå ŽåããŸãæ¡åŒµæ©èœãã£ã¬ã¯ããªããpathãã¿ã€ãã®ãªããžããªãšããŠè¿œå ããå¿ èŠããããŸãïŒ
$ cd /path/to/my/extension
$ pie repository:add path .
𥧠PHP Installer for Extensions (PIE) 1.0.0, from The PHP Foundation
You are running PHP 8.4.8
Target PHP installation: 8.4.8 nts, on Linux/OSX/etc x86_64 (from /usr/bin/php8.4)
The following repositories are in use for this Target PHP:
- Path Repository (/home/james/workspace/phpf/example-pie-extension)
- Packagist
次ã«ããã«ãããã¹ãã§ããŸãïŒ
$ pie build asgrim/example-pie-extension:*@dev
ð¡ Tip
æ¡åŒµæ©èœããŸã Packagist ã«å ¬éãããŠããªããããããŒãžã§ã³å¶çŽãšããŠ
*@devãæå®ããå¿ èŠããããŸããããããªããšãããã©ã«ãã®å®å®æ§ãstableã§ãããããPIE ã¯æ¡åŒµæ©èœãèŠã€ããããŸããã
composer.json ããªããžããªã«ã³ãããããããä»ã®ããã±ãŒãžãšåãããã« Packagist ã«æåºã§ããŸãã
Windows ãŠãŒã¶ãŒããµããŒãããã«ã¯ãPIE ã¯çŸåš DLL ããªã³ã¶ãã©ã€ã§ãã«ãããããšããµããŒãããŠããªããããããªãã«ãããã DLL ãå ¬éããå¿ èŠããããŸããWindows äºæãªãªãŒã¹ã®äºæ³ãããã¯ãŒã¯ãããŒã¯æ¬¡ã®ãšããã§ãïŒ
ZIP ãã¡ã€ã«ã®ååãšãã®äžã«å«ãŸãã DLL ã¯æ¬¡ã®ããã«ããå¿ èŠããããŸãïŒ
php_{extension-name}-{tag}-{php-maj/min}-{ts|nts}-{compiler}-{arch}.zipphp_xdebug-3.3.2-8.3-ts-vs16-x86_64.zipãããã®é ç®ã®èª¬æïŒ
extension-name æ¡åŒµæ©èœåãäŸïŒxdebugtag äŸïŒ3.3.0alpha3 - äœæããã¿ã°/ãªãªãŒã¹ã§å®çŸ©php-maj/min - äŸïŒPHP 8.3.* ã®å Žå㯠8.3compiler - éåžž vc6ãvs16 ã®ãããªãã® - php -i ã® 'PHP Extension Build' ãã©ã°ããååŸts|nts - ã¹ã¬ããã»ãŒããŸãã¯éã¹ã¬ããã»ãŒãarch - äŸïŒx86_64
php -i ã® Architecture ãããã³ãã䜿çšïŒäžèšåç
§ïŒPHP_INT_SIZE ãç¢ºèª - 32 ãããã®å Žå㯠4ã64 ãããã®å Žå㯠8ã¢ãŒããã¯ãã£åã¯æ£èŠåãå¿ èŠãªå ŽåããããŸããç°ãªããã©ãããã©ãŒã ã§ã¢ãŒããã¯ãã£ã®ååãç°ãªãããã§ããPIE ã¯æ¬¡ã®æ£èŠåãããã¢ãŒããã¯ãã£ãæåŸ ããŸãïŒ
x86_64ïŒx64ãx86_64ãAMD64 ããæ£èŠåïŒarm64ïŒarm64 ããæ£èŠåïŒx86ïŒãã®ä»ã®å€ïŒææ°ã®ãããïŒããã¥ã¡ã³ããææ°ã§ãªãå ŽåïŒã«ã€ããŠã¯ã\Php\Pie\Platform\Architecture::parseArchitecture ã確èªããŠãã ããã
ããªãã«ãããã ZIP ã«ã¯ãZIP èªäœãšåãååã® DLL ãå°ãªããšãå«ãŸããŠããå¿
èŠããããŸããäŸïŒphp_{extension-name}-{tag}-{php-maj/min}-{ts|nts}-{compiler}-{arch}.dllã.dll 㯠PHP æ¡åŒµæ©èœãã¹ã«ç§»åãããååã倿ŽãããŸããäŸïŒC:\path\to\php\ext\php_{extension-name}.dll ã«ç§»åãããŸããZIP ãã¡ã€ã«ã«ã¯æ¬¡ã®ãããªè¿œå ã®ãªãœãŒã¹ãå«ãŸããå ŽåããããŸãïŒ
php_{extension-name}-{tag}-{php-maj/min}-{ts|nts}-{compiler}-{arch}.pdb - ãã㯠C:\path\to\php\ext\php_{extension-name}.dll ã®é£ã«ç§»åãããŸã*.dll - ä»ã® .dll 㯠C:\path\to\php\php.exe ã®é£ã«ç§»åãããŸãC:\path\to\php\extras\{extension-name}\. ã«ç§»åãããŸãPHP ã¯ãæ¡åŒµæ©èœã¡ã³ãããŒã Windows äºæã¢ã»ããããã«ãããã³ãªãªãŒã¹ã§ããããã«ãã äžé£ã® GitHub Actions ãæäŸããŠããŸãããããã®ã¢ã¯ã·ã§ã³ã䜿çšããã¯ãŒã¯ãããŒã®äŸïŒ
name: Publish Windows Releases
on:
release:
types: [published]
permissions:
contents: write
jobs:
get-extension-matrix:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.extension-matrix.outputs.matrix }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Get the extension matrix
id: extension-matrix
uses: php/php-windows-builder/extension-matrix@v1
build:
needs: get-extension-matrix
runs-on: ${{ matrix.os }}
strategy:
matrix: ${{fromJson(needs.get-extension-matrix.outputs.matrix)}}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Build the extension
uses: php/php-windows-builder/extension@v1
with:
php-version: ${{ matrix.php-version }}
arch: ${{ matrix.arch }}
ts: ${{ matrix.ts }}
release:
runs-on: ubuntu-latest
needs: build
if: ${{ github.event_name == 'release' }}
steps:
- name: Upload artifact to the release
uses: php/php-windows-builder/release@v1
with:
release: ${{ github.event.release.tag_name }}
token: ${{ secrets.GITHUB_TOKEN }}
â ïž Warning
This translation may not be based on the latest version, please ensure you check the original English version for discrepancies.
çŸåšãåäžã® main ãã©ã³ããšæ©èœãã©ã³ããéçšããŠããŸããå°æ¥ããããããŒãžã§ã³ãããé©åã«ãµããŒãããããã«ãããŒãžã§ã³ç®¡çããããã©ã³ãæŠç¥ã«åãæ¿ããå¯èœæ§ããããŸãã
ãªãªãŒã¹ããææ°ããŒãžã§ã³ãæã£ãŠããããšã確èªããŠãã ãããäŸïŒ
# git reset ã䜿çšïŒæ³šæïŒ`main` äžã®ããŒã«ã«ã³ãããã¯ç Žæ£ãããŸãïŒ
git checkout main && git fetch upstream && git reset --hard upstream/main
# ãŸãã¯ãgit pull ã䜿çšïŒããŒãžã³ããããé¿ããããã« `--ff-only` ã䜿çšïŒ
git checkout main && git pull --ff-only upstream main
倿Žå±¥æŽãæºåãããªãªãŒã¹ããããŒãžã§ã³ãšãã€ã«ã¹ããŒã³ãèšå®ããŸããäŸïŒ
PIE_VERSION=1.3.0
PIE_MILESTONE=$PIE_VERSION
ð¡ Tip
ãã¬ãªãªãŒã¹ã®å ŽåãããŒãžã§ã³/ãã€ã«ã¹ããŒã³ãç°ãªãå€ã«èšå®ã§ããŸããäŸïŒ
PIE_VERSION=1.3.0-alpha.2 PIE_MILESTONE=1.3.0ããã«ããã
1.3.0-alpha.2ããŒãžã§ã³ã§ã¿ã°ä»ã/ãªãªãŒã¹ãããŸããã倿Žå±¥æŽã¯ GitHub ã®1.3.0ãã€ã«ã¹ããŒã³ã«åºã¥ããŠçæãããŸãã
次ã«ã倿Žå±¥æŽãã¡ã€ã«ãçæããŸãïŒ
composer require --dev -W jwage/changelog-generator --no-interaction
vendor/bin/changelog-generator generate --user=php --repository=pie --milestone=$PIE_MILESTONE > CHANGELOG-$PIE_VERSION.md
git checkout -- composer.*
composer install
倿Žå±¥æŽã®å å®¹ã«æºè¶³ããŠããã確èªããŠãã ããã眲åä»ãã¿ã°ãäœæããŸãïŒ
git tag -s $PIE_VERSION -F CHANGELOG-$PIE_VERSION.md
git push upstream $PIE_VERSION
ãªãªãŒã¹ãã€ãã©ã€ã³ãå®è¡ããããã©ãããªãªãŒã¹ãäœæãããPHAR ãã¡ã€ã«ããã«ããããŠæ·»ä»ãããŸãããã®åŸãGitHub ã®ãã©ãããªãªãŒã¹ã«ç§»åãããã¹ãŠãæ£ããããšã確èªããŠããããªãªãŒã¹ãå ¬éããå¿ èŠããããŸãã
rm CHANGELOG-$PIE_VERSION.md
â ïž Warning
This translation may not be based on the latest version, please ensure you check the original English version for discrepancies.
PIE éµåŸªéåžžç PHP æ©å±æå»ºåå®è£ è¿çšïŒå³ïŒ
phpize çšäºè®Ÿçœ® PHP API åæ°ãåŠæ phpize äžåšè·¯åŸäžïŒå®è£
æ©å±ç人å¯ä»¥æå® --with-phpize-pathã./configure çšäºäžºç¹å®ç³»ç»é
眮æå»ºåæ°ååºãå®è£
æ©å±ç人å¯ä»¥æå®æšåš composer.json äžæå®çé
眮é项ãæå
³åŠäœæ§è¡æ€æäœïŒè¯·åé
é
眮éé¡¹ææ¡£ãmake å®é
æå»ºæ©å±ãè¿å°å°è¯èªå𿣿µèŠè¿è¡çå¹¶è¡è¿çšæ°ïŒäœå®è£
ç人å¯ä»¥äœ¿çš --make-parallel-jobs N æ -jN é项èŠçæ€è®Ÿçœ®ãmake install å°æ©å±å®è£
å°é
眮ç PHP å®è£
äžãåŠæ PIE 没æåå
¥å®è£
äœçœ®çæéïŒå®å°å°è¯äœ¿çš sudo æåæéã请泚æïŒè¿æå³çè¿è¡ PIE çç³»ç»éèŠå®è£ éåœçæå»ºå·¥å ·ãæå ³æå»ºæ©å±å PHP å éšå·¥äœåççæçšèµæºæ¯ PHP Internals Bookã
å¯¹äº Windows ç³»ç»ïŒæ©å±ç»Žæ€è å¿ é¡»æäŸé¢æå»ºçäºè¿å¶æä»¶ãæå ³åŠäœä»¥æ£ç¡®çæ¹åŒäžº PIE æ§è¡æ€æäœç诊ç»ä¿¡æ¯ïŒè¯·åé äžé¢ç Windows æ¯æéšåã
䞺æšçæ©å±æ·»å PIE æ¯æçžå¯¹ç®åïŒæµçšäžå°åžžè§ PHP å æ·»å å° Packagist éåžžçžäŒŒã
åŠææšæ¯ç°æ PECL æ©å±ç绎æ€è ïŒä»¥äžæ¯äžäºæçšçäžäžæä¿¡æ¯ïŒ
package.xmlãåŠææšç°åšæ³ç»§ç»ååžå° PECLïŒåå¯ä»¥ç»§ç»ç»Žæ€ package.xmlãpackage.xml æç¡®ååºæ¯äžªçæ¬ãäœ¿çš PIEïŒè¿äžåéèŠïŒå 䞺 Packagist äŒååžžè§ Composer å
äžæ ·è·åæ çŸæåæ¯å«åãè¿æå³çèŠååžæšçå
ïŒæšéèŠæšéæ çŸåååžçæ¬ãcomposer.jsonæ·»å PIE æ¯æçç¬¬äžæ¥æ¯åæ©å±ä»åºæ·»å composer.jsonã倧倿°å
žååæ®µäžåžžè§ Composer å
çžåïŒäœæå 䞪åŒåŸæ³šæçäŸå€ïŒ
type å¿
é¡»æ¯ php-extïŒçšäº PHP æš¡åïŒè¿å°æ¯å€§å€æ°æ©å±ïŒæ php-ext-zendïŒçšäº Zend æ©å±ïŒãphp-ext éšåïŒè¯·åé
äžé¢æå
³ php-ext äžå¯ä»¥å
å«çæä»€ïŒname åæ®µïŒå¿
é¡»éµåŸªéåžžç Composer å
åç§°æ ŒåŒïŒå³ <vendor>/<package>ãtype åæ®µãphp-ext å®ä¹extension-nameå¯ä»¥æå® extension-nameïŒå¹¶äžå¿
须笊åéåžžçæ©å±åç§°æ£å衚蟟åŒïŒè¯¥è¡šèŸŸåŒåš \Php\Pie\ExtensionName::VALID_PACKAGE_NAME_REGEX äžå®ä¹ãåŠææªæå® extension-nameïŒå extension-name å°ä» Composer å
å称掟çïŒå é€äŸåºååçŒãäŸåŠïŒç»å®äžäžª composer.jsonïŒ
{
"name": "myvendor/myextension"
}
æ©å±åç§°å°æŽŸç䞺 myextensionãmyvendor/ äŸåºååçŒè¢«å é€ã
â ïž Warning
åŠææšç Composer å åç§°äŒå¯ŒèŽæ æç PHP æ©å±åç§°ïŒæšå¿ é¡»æå®
extension-nameæä»€ãäŸåŠïŒComposer å åç§°myvendor/my-extensionäŒå¯ŒèŽæ æç PHP æ©å±åç§°ïŒå 䞺äžå 讞䜿çšè¿å笊ïŒå æ€æšå¿ é¡»äžºæ€ Composer å åç§°æå®ææçextension-nameã
extension-name äžåºä»¥ ext- 䞺åçŒïŒè¿æ¯ Composer åšäœ¿çš require æ¶ç纊å®ã
äœ¿çš extension-name ç瀺äŸïŒ
{
"name": "xdebug/xdebug",
"php-ext": {
"extension-name": "xdebug"
}
}
prioritypriority ææ ini æä»¶åçäžéšåïŒçšäºæ§å¶æ©å±ç顺åºïŒåŠæç®æ å¹³å°äœ¿çšç®åœäžçå€äžª INI æä»¶ã
support-zts å support-ntsæç€ºæ©å±æ¯åŠæ¯æ Zend Thread-SafeïŒZTSïŒåé线çšå®å
šïŒNTSïŒæš¡åŒãåŠææªæå®ïŒè¿äž€äžªæ å¿éœé»è®€äžº trueïŒäœåŠææšçæ©å±äžæ¯æä»»äžæš¡åŒïŒåå¿
é¡»æå®ïŒè¿å°æå³çæ©å±æ æ³åšç®æ å¹³å°äžå®è£
ã
ç论äžïŒå¯ä»¥äžº support-zts å support-nts éœæå® falseïŒäœè¿å°æå³çæšçå
æ æ³åšä»»äœå°æ¹å®è£
ïŒå æ€äžå»ºè®®è¿æ ·åã
configure-optionsè¿æ¯å¯ä»¥äŒ éç» ./configure åœä»€çåæ°å衚ãåè¡šçæ¯äžªé¡¹ç®éœæ¯äžäžª JSON 对象ïŒå
å«ïŒ
nameïŒåæ°åç§°æ¬èº«descriptionïŒåæ°äœçšçæçšæè¿°needs-valueïŒäžäžªåžå°åŒïŒåè¯ PIE åæ°æ¯ç®åæ å¿ïŒéåžžçšäº --enable-this-flag ç±»ååæ°ïŒïŒè¿æ¯åæ°åºè¯¥æäžäžªæå®çåŒïŒéåžžçšäº --with-library-path=... ç±»ååæ°ïŒå
¶äžæç»çšæ·å¿
é¡»æäŸäžäžªåŒïŒåœæç»çšæ·äœ¿çš PIE å®è£
æ©å±æ¶ïŒä»ä»¬å¯ä»¥æå®äŒ éç» ./configure çä»»äœå·²å®ä¹ç configure-optionsãäŸåŠïŒåŠææ©å±å®ä¹äºä»¥äž composer.jsonïŒ
{
"name": "myvendor/myext",
"php-ext": {
"extension-name": "myext",
"configure-options": [
{
"name": "enable-my-flag",
"description": "Should my flag be enabled",
"needs-value": false
},
{
"name": "with-some-lib",
"description": "Specify the path to some-lib",
"needs-value": true
}
]
}
}
ç¶åå¯ä»¥ä»¥ä»¥äžæ¹åŒè°çš pie build æ pie install åœä»€ä»¥å®ç°æéçé
眮ïŒ
pie install myvendor/myext
./configure èäžåžŠä»»äœåæ°pie install myvendor/myext --enable-my-flag
./configure --enable-my-flagpie install myvendor/myext --with-some-lib=/path/to/somelib
./configure --with-some-lib=/path/to/somelibpie install myvendor/myext --enable-my-flag --with-some-lib=/path/to/somelib
./configure --enable-my-flag --with-some-lib=/path/to/somelib请泚æïŒPIE çæç»çšæ·æ æ³æå®æªåšæšçæ©å±ç configure-options å®ä¹äžå®ä¹çé
眮é项ã䜿çšäžé¢çžåç composer.json 瀺äŸïŒäœ¿çšæ æé项è°çš PIEïŒäŸåŠ pie install myvendor/myext --something-else å°å¯ŒèŽé误 The "--something-else" option does not exist.ã
åŠææç»çšæ·æªæå® configure-options å®ä¹äžå®ä¹çæ å¿ïŒåäžäŒå°å
¶äŒ éç» ./configureãæ æ³åš configure-options å®ä¹äžæå®é»è®€åŒãæšç config.m4 åºçžåºå°å€çæ€é®é¢ã
build-pathåŠææºä»£ç äžåšä»åºçæ ¹ç®åœäžïŒå¯ä»¥äœ¿çš build-path 讟眮ãäŸåŠïŒåŠææšçä»åºç»æåŠäžïŒ
/
docs/
src/
config.m4
config.w32
myext.c
...etc
åšè¿ç§æ
åµäžïŒå®é
çæ©å±æºä»£ç å°åš src/ äžæå»ºïŒå æ€æšåºè¯¥åš build-path äžæå®æ€è·¯åŸïŒäŸåŠïŒ
{
"name": "myvendor/myext",
"php-ext": {
"extension-name": "myext",
"build-path": "src"
}
}
build-path å¯ä»¥å
å«äžäºè¢«æ¿æ¢çæš¡æ¿åŒïŒ
{version} å°è¢«æ¿æ¢äžºå
çæ¬ãäŸåŠïŒçæ¬äžº 1.2.3 çå
ïŒbuild-path 䞺 myext-{version}ïŒå®é
æå»ºè·¯åŸå°å䞺 myext-1.2.3ãdownload-url-methoddownload-url-method æä»€å
讞æ©å±ç»Žæ€è
æŽæ¹äžèœœæºå
çè¡äžºã
composer-defaultïŒåŠææªæå®å䞺é»è®€åŒïŒïŒå°äœ¿çš Composer å®ç°çé»è®€è¡äžºïŒå³äœ¿çšæ¥èª GitHub APIïŒæå
¶ä»æºä»£ç æ§å¶ç³»ç»ïŒçæ å ZIP åæ¡£ãpre-packaged-source å°åšååžèµæºå衚äžå®äœæºä»£ç å
ïŒè¯¥å
åºäºä»¥äžåœå纊å®ä¹äžïŒ
php_{ExtensionName}-{Version}-src.tgzïŒäŸåŠ php_myext-1.20.1-src.tgzïŒphp_{ExtensionName}-{Version}-src.zipïŒäŸåŠ php_myext-1.20.1-src.zipïŒ{ExtensionName}-{Version}.tgzïŒè¿æ¯äžºäºäž PECL å
ååå
Œå®¹ïŒos-families éå¶os-families å os-families-exclude æä»€å
讞æ©å±ç»Žæ€è
éå¶æäœç³»ç»å
Œå®¹æ§ã
os-families äžäžªæäœç³»ç»å®¶æçæ°ç»ïŒçšäºæ è®°äžæ©å±å
Œå®¹ãïŒäŸåŠ "os-families": ["windows"] 衚瀺ä»
åš Windows äžå¯çšçæ©å±ïŒos-families-exclude äžäžªæäœç³»ç»å®¶æçæ°ç»ïŒçšäºæ è®°äžæ©å±äžå
Œå®¹ãïŒäŸåŠ "os-families-exclude": ["windows"] è¡šç€ºæ æ³åš Windows äžå®è£
çæ©å±ïŒæ¥åçæäœç³»ç»å®¶æå衚ïŒ"windows"ã"bsd"ã"darwin"ã"solaris"ã"linux"ã"unknown"
â ïž Warning
åªèœå®ä¹
os-familiesåos-families-excludeä¹äžã
æ©å±äœè
å¯ä»¥åš require äžå®ä¹äžäºäŸèµé¡¹ïŒäœå®é
äžïŒå€§å€æ°æ©å±äžéèŠå®ä¹äŸèµé¡¹ïŒé€äºæ©å±æ¯æç PHP çæ¬ãå¯ä»¥å®ä¹å¯¹å
¶ä»æ©å±çäŸèµé¡¹ïŒäŸåŠ ext-jsonãäœæ¯ïŒäžåºåš require éšåæå®å¯¹åžžè§ PHP å
ïŒåŠ monolog/monologïŒçäŸèµé¡¹ã
åŒåŸæ³šæçæ¯ïŒåŠææšçæ©å±ç¡®å®å®ä¹äºå¯¹åŠäžäžªäŸèµé¡¹çäŸèµïŒå¹¶äžæ€äŸèµé¡¹äžå¯çšïŒåå®è£ æšçæ©å±çäººå°æ¶å°åŠäžæ¶æ¯ïŒ
Cannot use myvendor/myextension's latest version 1.2.3 as it requires
ext-something * which is missing from your platform.
éŠå
ïŒæšå¯ä»¥äœ¿çš composer validate æ£æ¥æšç composer.json æ ŒåŒæ¯åŠæ£ç¡®ïŒäŸåŠïŒ
$ composer validate
./composer.json is valid
ç¶åïŒæšå¯ä»¥åšæ©å±ç®åœäžäœ¿çš pie install å®è£
æ©å±ïŒ
$ cd /path/to/my/extension
$ pie install
𥧠PHP Installer for Extensions (PIE) 1.0.0, from The PHP Foundation
Installing PIE extension from /home/james/workspace/phpf/example-pie-extension
This command may need elevated privileges, and may prompt you for your password.
You are running PHP 8.4.8
Target PHP installation: 8.4.8 nts, on Linux/OSX/etc x86_64 (from /usr/bin/php8.4)
Found package: asgrim/example-pie-extension:dev-main which provides ext-example_pie_extension
Extracted asgrim/example-pie-extension:dev-main source to: /home/james/.config/pie/php8.4_572ee73609adb95bf0b8539fecdc5c0e/vendor/asgrim/example-pie-extension
Build files cleaned up.
phpize complete.
Configure complete.
Build complete: /home/james/.config/pie/php8.4_572ee73609adb95bf0b8539fecdc5c0e/vendor/asgrim/example-pie-extension/modules/example_pie_extension.so
Cannot write to /usr/lib/php/20240924, so using sudo to elevate privileges.
Install complete: /usr/lib/php/20240924/example_pie_extension.so
â
Extension is enabled and loaded in /usr/bin/php8.4
åŠææšåªæ³æµè¯åºçšçšåºçæå»ºèäžå°å ¶å®è£ å°ç®æ PHP çæ¬ïŒæšéŠå éèŠå°æ©å±ç®åœæ·»å 䞺"path"ç±»åä»åºïŒ
$ cd /path/to/my/extension
$ pie repository:add path .
𥧠PHP Installer for Extensions (PIE) 1.0.0, from The PHP Foundation
You are running PHP 8.4.8
Target PHP installation: 8.4.8 nts, on Linux/OSX/etc x86_64 (from /usr/bin/php8.4)
The following repositories are in use for this Target PHP:
- Path Repository (/home/james/workspace/phpf/example-pie-extension)
- Packagist
ç¶åïŒæšå¯ä»¥æµè¯å®æ¯åŠæå»ºïŒ
$ pie build asgrim/example-pie-extension:*@dev
ð¡ Tip
ç±äºæšçæ©å±å°æªååžå° PackagistïŒå æ€åºæå®
*@deväœäžºçæ¬çºŠæïŒåŠå PIE å°æŸäžå°æšçæ©å±ïŒå 䞺é»è®€çš³å®æ§äžºstableã
å° composer.json æäº€å°ä»åºåïŒæšå¯ä»¥åæäº€ä»»äœå
¶ä»å
äžæ ·å°å
¶æäº€å° Packagistã
äžºäºæ¯æ Windows çšæ·ïŒæšå¿ é¡»ååžé¢æå»ºç DLLïŒå 䞺 PIE ç®åäžæ¯æå³æ¶æå»º DLLãWindows å Œå®¹çæ¬çé¢æå·¥äœæµçšæ¯ïŒ
ZIP æä»¶çå称以åå ¶äžå å«ç DLL å¿ é¡»æ¯ïŒ
php_{extension-name}-{tag}-{php-maj/min}-{ts|nts}-{compiler}-{arch}.zipphp_xdebug-3.3.2-8.3-ts-vs16-x86_64.zipè¿äºé¡¹ç®çæè¿°ïŒ
extension-name æ©å±åç§°ïŒäŸåŠ xdebugtag äŸåŠ 3.3.0alpha3 - ç±æšå¶äœçæ çŸ/ååžçæ¬å®ä¹php-maj/min - äŸåŠ 8.3 衚瀺 PHP 8.3.*compiler - éåžžæ¯å vc6ãvs16 è¿æ ·çäžè¥¿ - ä» php -i äžç 'PHP Extension Build' æ å¿è·åts|nts - 线çšå®å
šæé线çšå®å
šãarch - äŸåŠ x86_64ã
php -i äž Architecture çæç€ºïŒè§äžæïŒPHP_INT_SIZE - 32 äœäžº 4ïŒ64 äœäžº 8ã请泚æïŒæ¶æåç§°å¯èœéèŠè§èåïŒå 䞺äžåå¹³å°å¯¹æ¶æçåœåäžåãPIE ææä»¥äžè§èåçæ¶æïŒ
x86_64ïŒä» x64ãx86_64ãAMD64 è§èåïŒarm64ïŒä» arm64 è§èåïŒx86ïŒä»»äœå
¶ä»åŒïŒæå
³ææ°æ å°ïŒåŠæææ¡£äžæ¯ææ°çïŒïŒè¯·æ¥ç \Php\Pie\Platform\Architecture::parseArchitectureã
é¢æå»ºç ZIP åºè³å°å
å«äžäžªäž ZIP æ¬èº«åœåçžåç DLLïŒäŸåŠ php_{extension-name}-{tag}-{php-maj/min}-{ts|nts}-{compiler}-{arch}.dllã.dll å°è¢«ç§»åšå° PHP æ©å±è·¯åŸå¹¶éåœåïŒäŸåŠç§»åšå° C:\path\to\php\ext\php_{extension-name}.dllãZIP æä»¶å¯èœå
å«é¢å€çèµæºïŒäŸåŠïŒ
php_{extension-name}-{tag}-{php-maj/min}-{ts|nts}-{compiler}-{arch}.pdb - è¿å°è¢«ç§»åšå° C:\path\to\php\ext\php_{extension-name}.dll æèŸ¹*.dll - ä»»äœå
¶ä» .dll éœå°è¢«ç§»åšå° C:\path\to\php\php.exe æèŸ¹C:\path\to\php\extras\{extension-name}\.PHP æäŸäºäžç» GitHub ActionsïŒäœ¿æ©å±ç»Žæ€è èœå€æå»ºåååž Windows å Œå®¹èµæºã䜿çšè¿äºæäœç瀺äŸå·¥äœæµçšïŒ
name: Publish Windows Releases
on:
release:
types: [published]
permissions:
contents: write
jobs:
get-extension-matrix:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.extension-matrix.outputs.matrix }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Get the extension matrix
id: extension-matrix
uses: php/php-windows-builder/extension-matrix@v1
build:
needs: get-extension-matrix
runs-on: ${{ matrix.os }}
strategy:
matrix: ${{fromJson(needs.get-extension-matrix.outputs.matrix)}}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Build the extension
uses: php/php-windows-builder/extension@v1
with:
php-version: ${{ matrix.php-version }}
arch: ${{ matrix.arch }}
ts: ${{ matrix.ts }}
release:
runs-on: ubuntu-latest
needs: build
if: ${{ github.event_name == 'release' }}
steps:
- name: Upload artifact to the release
uses: php/php-windows-builder/release@v1
with:
release: ${{ github.event.release.tag_name }}
token: ${{ secrets.GITHUB_TOKEN }}
â ïž Warning
This translation may not be based on the latest version, please ensure you check the original English version for discrepancies.
ç®åïŒæä»¬äœ¿çšåäžç main 忝ååèœåæ¯ãæªæ¥ïŒäžºäºæŽå¥œå°æ¯æè¡¥äžçæ¬ïŒæä»¬å¯èœäŒåæ¢å°çæ¬å忝çç¥ã
ç¡®ä¿æšæ¥æèŠååžçææ°çæ¬ïŒäŸåŠïŒ
# äœ¿çš git resetïŒæ³šæïŒäŒäž¢åŒ `main` äžçä»»äœæ¬å°æäº€ïŒ
git checkout main && git fetch upstream && git reset --hard upstream/main
# æè
ïŒäœ¿çš git pullïŒäœ¿çš `--ff-only` é¿å
å建åå¹¶æäº€ïŒ
git checkout main && git pull --ff-only upstream main
åå€åæŽæ¥å¿ïŒè®Ÿçœ®èŠååžççæ¬åéçšç¢ïŒäŸåŠïŒ
PIE_VERSION=1.3.0
PIE_MILESTONE=$PIE_VERSION
ð¡ Tip
对äºé¢ååžçæ¬ïŒæšå¯ä»¥å°çæ¬/éçšç¢è®Ÿçœ®äžºäžåçåŒïŒäŸåŠïŒ
PIE_VERSION=1.3.0-alpha.2 PIE_MILESTONE=1.3.0è¿å°äœ¿çš
1.3.0-alpha.2çæ¬è¿è¡æ è®°/ååžïŒäœäŒåºäº GitHub äžç1.3.0éçšç¢çæåæŽæ¥å¿ã
ç¶åçæåæŽæ¥å¿æä»¶ïŒ
composer require --dev -W jwage/changelog-generator --no-interaction
vendor/bin/changelog-generator generate --user=php --repository=pie --milestone=$PIE_MILESTONE > CHANGELOG-$PIE_VERSION.md
git checkout -- composer.*
composer install
æ£æ¥æšæ¯åŠå¯¹åæŽæ¥å¿çå 容满æãå建äžäžªçŸåæ çŸïŒ
git tag -s $PIE_VERSION -F CHANGELOG-$PIE_VERSION.md
git push upstream $PIE_VERSION
ååžæµæ°Žçº¿å°è¿è¡ïŒå®å°å建äžäžªèçš¿ååžçæ¬ïŒæå»º PHAR æä»¶å¹¶éå å®ãç¶åïŒæšå¿ é¡»èœ¬å° GitHub äžçèçš¿ååžçæ¬ïŒéªè¯äžåæ£ç¡®ïŒç¶åååžè¯¥ååžçæ¬ã
rm CHANGELOG-$PIE_VERSION.md
â ïž Warning
This translation may not be based on the latest version, please ensure you check the original English version for discrepancies.
Packagist ã PIE ããã±ãŒãžã®æ°ããããŒã ã§ããããããµããŒããããŠãã PIE äºææ¡åŒµæ©èœã®å®å šãªãªã¹ãã¯ä»¥äžã§ç¢ºèªã§ããŸãïŒ
PIE ãµããŒãã远å ããããã»ã¹ã¯ãæ¡åŒµæ©èœã¡ã³ãããŒããã¥ã¡ã³ãã«èšèŒãããŠããŸãã
PECL ãªããžããªã«ã¯ããŸã PIE ãµããŒãã远å ããŠããªã倿°ã®æ¡åŒµæ©èœããããŸãããã㯠PECL ã§ãã¹ããããŠããæ¡åŒµæ©èœã®ãªã¹ããšãPIE ãµããŒãã远å ããããã®ã¹ããŒã¿ã¹ã§ããããã«å€ãæ å ±ãèŠã€ããå Žåã¯ãPull Request ãæåºããŠãã ããã
以äžã®æ¡åŒµæ©èœã¯ãã§ã« PIE ãµããŒãã远å ããŠããŸãïŒ
| PECL æ¡åŒµæ©èœ | PIE æ¡åŒµæ©èœ |
|---|---|
| amqp | php-amqp/php-amqp |
| APCu | apcu/apcu |
| apfd | m6w6/ext-apfd |
| ast | nikic/php-ast |
| bcmath | php/bcmath |
| bitset | pecl/bitset |
| brotli | kjdev/brotli |
| bz2 | php/bz2 |
| calendar | php/calendar |
| CSV | girgias/csv |
| ctype | php/ctype |
| curl | php/curl |
| dba | php/dba |
| decimal | php-decimal/ext-decimal |
| dio | pecl/dio |
| dom | php/dom |
| ds | php-ds/ext-ds |
| enchant | php/enchant |
| exif | php/exif |
| ev | osmanov/pecl-ev |
| event | osmanov/pecl-event |
| ffi | php/ffi |
| geospatial | php-geospatial/geospatial |
| gettext | php/gettext |
| gmp | php/gmp |
| gpio | embedded-php/gpio |
| i2c | embedded-php/i2c |
| iconv | php/iconv |
| imagick | imagick/imagick |
| inotify | arnaud-lb/inotify |
| intl | php/intl |
| jsonpath | supermetrics/jsonpath |
| ldap | php/ldap |
| mailparse | pecl/mailparse |
| mbstring | php/mbstring |
| mcrypt | pecl/mcrypt |
| memcached | php-memcached/php-memcached |
| memprof | arnaud-lb/memprof |
| mongodb | mongodb/mongodb-extension |
| mysqlnd | php/mysqlnd |
| mysqli | php/mysqli |
| opcache | php/opcache |
| opentelemetry | open-telemetry/ext-opentelemetry |
| parallel | pecl/parallel |
| pcov | pecl/pcov |
| pcntl | php/pcntl |
| pdo | php/pdo |
| pdo_mysql | php/pdo_mysql |
| pdo_pgsql | php/pdo_pgsql |
| pdo_sqlite | php/pdo_sqlite |
| pgsql | php/pgsql |
| posix | php/posix |
| rdkafka | rdkafka/rdkafka |
| readline | php/readline |
| redis | phpredis/phpredis |
| relay | cachewerk/relay |
| rpminfo | remi/rpminfo |
| selinux | pecl/selinux |
| session | php/session |
| shmop | php/shmop |
| simdjson | awesome/simdjson_plus |
| simplexml | php/simplexml |
| snmp | php/snmp |
| soap | php/soap |
| sockets | php/sockets |
| sodium | php/sodium |
| spi | embedded-php/spi |
| sqlite3 | php/sqlite3 |
| swoole | swoole/swoole |
| sysvmsg | php/sysvmsg |
| sysvsem | php/sysvsem |
| sysvshm | php/sysvshm |
| tidy | php/tidy |
| timezonedb | pecl/timezonedb |
| translit | derickr/translit |
| uart | embedded-php/uart |
| uuid | pecl/uuid |
| vld | derickr/vld |
| win32service | win32service/win32service |
| xattr | pecl/xattr |
| Xdebug | xdebug/xdebug |
| xlswriter | viest/xlswriter |
| xml | php/xml |
| xmlreader | php/xmlreader |
| xmlwriter | php/xmlwriter |
| xsl | php/xsl |
| xpass | remi/xpass |
| zip | php/zip, pecl/zip |
| zlib | php/zlib |
| zstd | kjdev/zstd |
以äžã®æ¡åŒµæ©èœã¯ PIE ãµããŒãã远å ããåãçµã¿ãå§ãŸã£ãŠããŸãïŒ
| PECL æ¡åŒµæ©èœ | ã¹ããŒã¿ã¹ |
|---|---|
| base58 | â° PR: jasny/base58-php-ext#14 |
| crypto | â° PR: bukka/php-crypto#43 |
| dbase | â° PR: php/pecl-database-dbase#6 |
| hdr_histogram | â° è¿æ¥å ¬é: beberlei/hdrhistogram |
| hrtime | â° PR: php/pecl-datetime-hrtime#1 |
| memcache | â° PR: websupport-sk/pecl-memcache#116 |
| yaml | â° PR: php/pecl-file_formats-yaml#88 |
以äžã®æ¡åŒµæ©èœã¯ PECL ã«ååšããŠããŸãããPIE ãµããŒãããŸã 远å ããŠããªããããã®ã¹ããŒã¿ã¹ãäžæã§ãã
以äžã®æ¡åŒµæ©èœã¯å»æ¢ãããŠãããšèããããŠããŸãïŒ
Since Packagist is the new home for PIE packages, the full list of supported, PIE-compatible extensions can be found on:
The process for adding support for PIE is documented in the Extension Maintainers documentation.
The PECL repository still has a whole host of extensions that have not yet added support for PIE. This is a list of extensions hosted on PECL, and their status for adding PIE support. If you spot some out of date information here, please do submit a Pull Request.
The following extensions have already added support for PIE:
| PECL Extension | PIE extension |
|---|---|
| amqp | php-amqp/php-amqp |
| APCu | apcu/apcu |
| apfd | m6w6/ext-apfd |
| ast | nikic/php-ast |
| bcmath | php/bcmath |
| bitset | pecl/bitset |
| brotli | kjdev/brotli |
| bz2 | php/bz2 |
| calendar | php/calendar |
| CSV | girgias/csv |
| ctype | php/ctype |
| curl | php/curl |
| dba | php/dba |
| decimal | php-decimal/ext-decimal |
| dio | pecl/dio |
| dom | php/dom |
| ds | php-ds/ext-ds |
| enchant | php/enchant |
| exif | php/exif |
| ev | osmanov/pecl-ev |
| event | osmanov/pecl-event |
| ffi | php/ffi |
| geospatial | php-geospatial/geospatial |
| gettext | php/gettext |
| gmp | php/gmp |
| gRPC | bsn4/grpc (drop-in Rust replacement for ext-grpc) |
| gpio | embedded-php/gpio |
| i2c | embedded-php/i2c |
| iconv | php/iconv |
| imagick | imagick/imagick |
| inotify | arnaud-lb/inotify |
| intl | php/intl |
| jsonpath | supermetrics/jsonpath |
| ldap | php/ldap |
| lzf | pecl/lzf |
| mailparse | pecl/mailparse |
| mbstring | php/mbstring |
| mcrypt | pecl/mcrypt |
| memcached | php-memcached/php-memcached |
| memprof | arnaud-lb/memprof |
| mongodb | mongodb/mongodb-extension |
| mysqlnd | php/mysqlnd |
| mysqli | php/mysqli |
| opcache | php/opcache |
| operator | jblo/operator |
| opentelemetry | open-telemetry/ext-opentelemetry |
| parallel | pecl/parallel |
| pcov | pecl/pcov |
| pcntl | php/pcntl |
| pdo | php/pdo |
| pdo_mysql | php/pdo_mysql |
| pdo_pgsql | php/pdo_pgsql |
| pdo_sqlite | php/pdo_sqlite |
| pgsql | php/pgsql |
| posix | php/posix |
| rar | php-win-ext/rar |
| rdkafka | rdkafka/rdkafka |
| readline | php/readline |
| redis | phpredis/phpredis |
| relay | cachewerk/relay |
| rpminfo | remi/rpminfo |
| selinux | pecl/selinux |
| session | php/session |
| shmop | php/shmop |
| simdjson | awesome/simdjson_plus |
| simplexml | php/simplexml |
| snmp | php/snmp |
| soap | php/soap |
| sockets | php/sockets |
| sodium | php/sodium |
| spi | embedded-php/spi |
| sqlite3 | php/sqlite3 |
| swoole | swoole/swoole |
| sync | php-win-ext/sync |
| sysvmsg | php/sysvmsg |
| sysvsem | php/sysvsem |
| sysvshm | php/sysvshm |
| tidy | php/tidy |
| timezonedb | pecl/timezonedb |
| translit | derickr/translit |
| uart | embedded-php/uart |
| uuid | pecl/uuid |
| varnish | php-win-ext/varnish |
| vld | derickr/vld |
| win32service | win32service/win32service |
| xattr | pecl/xattr |
| Xdebug | xdebug/xdebug |
| xlswriter | viest/xlswriter |
| xml | php/xml |
| xmlreader | php/xmlreader |
| xmlwriter | php/xmlwriter |
| xsl | php/xsl |
| xpass | remi/xpass |
| zip | php/zip, pecl/zip |
| zlib | php/zlib |
| zstd | kjdev/zstd |
The following extensions have had efforts started to add support for PIE:
| PECL Extension | Status |
|---|---|
| base58 | â° PR: jasny/base58-php-ext#14 |
| crypto | â° PR: bukka/php-crypto#43 |
| dbase | â° PR: php/pecl-database-dbase#6 |
| hdr_histogram | â° Coming soon: beberlei/hdrhistogram |
| hrtime | â° PR: php/pecl-datetime-hrtime#1 |
| memcache | â° PR: websupport-sk/pecl-memcache#116 |
| yaml | â° PR: php/pecl-file_formats-yaml#88 |
The following extensions exist on PECL, but either have not added support for PIE yet, or their status is unknown.
The following extensions are believed to be abandoned:
â ïž Warning
This translation may not be based on the latest version, please ensure you check the original English version for discrepancies.
ç±äº Packagist æ¯ PIE å çæ°å®¶ïŒå®æŽçæ¯æãå Œå®¹ PIE çæ©å±å衚å¯ä»¥åšä»¥äžäœçœ®æŸå°ïŒ
æ·»å PIE æ¯æçè¿çšåšæ©å±ç»Žæ€è ææ¡£äžæè®°åœã
PECL ä»åºä»ç¶æå€§éå°æªæ·»å PIE æ¯æçæ©å±ãè¿æ¯ PECL äžæç®¡çæ©å±å衚ïŒä»¥åå®ä»¬æ·»å PIE æ¯æçç¶æãåŠææšåç°æ€å€æè¿æ¶çä¿¡æ¯ïŒè¯·æäº€ Pull Requestã
ä»¥äžæ©å±å·²ç»æ·»å äº PIE æ¯æïŒ
| PECL æ©å± | PIE æ©å± |
|---|---|
| amqp | php-amqp/php-amqp |
| APCu | apcu/apcu |
| apfd | m6w6/ext-apfd |
| ast | nikic/php-ast |
| bcmath | php/bcmath |
| bitset | pecl/bitset |
| brotli | kjdev/brotli |
| bz2 | php/bz2 |
| calendar | php/calendar |
| CSV | girgias/csv |
| ctype | php/ctype |
| curl | php/curl |
| dba | php/dba |
| decimal | php-decimal/ext-decimal |
| dio | pecl/dio |
| dom | php/dom |
| ds | php-ds/ext-ds |
| enchant | php/enchant |
| exif | php/exif |
| ev | osmanov/pecl-ev |
| event | osmanov/pecl-event |
| ffi | php/ffi |
| geospatial | php-geospatial/geospatial |
| gettext | php/gettext |
| gmp | php/gmp |
| gpio | embedded-php/gpio |
| i2c | embedded-php/i2c |
| iconv | php/iconv |
| imagick | imagick/imagick |
| inotify | arnaud-lb/inotify |
| intl | php/intl |
| jsonpath | supermetrics/jsonpath |
| ldap | php/ldap |
| mailparse | pecl/mailparse |
| mbstring | php/mbstring |
| mcrypt | pecl/mcrypt |
| memcached | php-memcached/php-memcached |
| memprof | arnaud-lb/memprof |
| mongodb | mongodb/mongodb-extension |
| mysqlnd | php/mysqlnd |
| mysqli | php/mysqli |
| opcache | php/opcache |
| opentelemetry | open-telemetry/ext-opentelemetry |
| parallel | pecl/parallel |
| pcov | pecl/pcov |
| pcntl | php/pcntl |
| pdo | php/pdo |
| pdo_mysql | php/pdo_mysql |
| pdo_pgsql | php/pdo_pgsql |
| pdo_sqlite | php/pdo_sqlite |
| pgsql | php/pgsql |
| posix | php/posix |
| rdkafka | rdkafka/rdkafka |
| readline | php/readline |
| redis | phpredis/phpredis |
| relay | cachewerk/relay |
| rpminfo | remi/rpminfo |
| selinux | pecl/selinux |
| session | php/session |
| shmop | php/shmop |
| simdjson | awesome/simdjson_plus |
| simplexml | php/simplexml |
| snmp | php/snmp |
| soap | php/soap |
| sockets | php/sockets |
| sodium | php/sodium |
| spi | embedded-php/spi |
| sqlite3 | php/sqlite3 |
| swoole | swoole/swoole |
| sysvmsg | php/sysvmsg |
| sysvsem | php/sysvsem |
| sysvshm | php/sysvshm |
| tidy | php/tidy |
| timezonedb | pecl/timezonedb |
| translit | derickr/translit |
| uart | embedded-php/uart |
| uuid | pecl/uuid |
| vld | derickr/vld |
| win32service | win32service/win32service |
| xattr | pecl/xattr |
| Xdebug | xdebug/xdebug |
| xlswriter | viest/xlswriter |
| xml | php/xml |
| xmlreader | php/xmlreader |
| xmlwriter | php/xmlwriter |
| xsl | php/xsl |
| xpass | remi/xpass |
| zip | php/zip, pecl/zip |
| zlib | php/zlib |
| zstd | kjdev/zstd |
ä»¥äžæ©å±å·²åŒå§åªåæ·»å PIE æ¯æïŒ
| PECL æ©å± | ç¶æ |
|---|---|
| base58 | â° PR: jasny/base58-php-ext#14 |
| crypto | â° PR: bukka/php-crypto#43 |
| dbase | â° PR: php/pecl-database-dbase#6 |
| hdr_histogram | â° å³å°æšåº: beberlei/hdrhistogram |
| hrtime | â° PR: php/pecl-datetime-hrtime#1 |
| memcache | â° PR: websupport-sk/pecl-memcache#116 |
| yaml | â° PR: php/pecl-file_formats-yaml#88 |
ä»¥äžæ©å±ååšäº PECL äžïŒäœå°æªæ·»å PIE æ¯æïŒæå ¶ç¶ææªç¥ã
ä»¥äžæ©å±è¢«è®€äžºå·²åºåŒïŒ
â ïž Warning
This translation may not be based on the latest version, please ensure you check the original English version for discrepancies.
PIE 㯠PHP æ¡åŒµæ©èœã®æ°ããã€ã³ã¹ããŒã©ãŒã§ãæçµçã« PECL ã眮ãæããããšãç®çãšããŠããŸãã PHAR ãšããŠé åžããã Composer ãšåæ§ã«åäœããŸãããPHP ããã±ãŒãžããããžã§ã¯ããã©ã€ãã©ãªã« åã蟌ãã®ã§ã¯ãªããPHP æ¡åŒµæ©èœïŒPHP ã¢ãžã¥ãŒã«ãŸã㯠Zend æ¡åŒµæ©èœïŒã PHP ã€ã³ã¹ããŒã«ã«ã€ã³ã¹ããŒã«ããŸãã
PIE ãå®è¡ããã«ã¯ PHP 8.1 以éãå¿ èŠã§ãããPIE ã¯ä»ã®ã€ã³ã¹ããŒã«æžã¿ PHP ããŒãžã§ã³ã« æ¡åŒµæ©èœãã€ã³ã¹ããŒã«ã§ããŸãã
Linux ã§ã¯ããã«ãããŒã«ãã§ãŒã³ãã€ã³ã¹ããŒã«ããå¿ èŠããããŸããDebian/Ubuntu ã¿ã€ãã® ã·ã¹ãã ã§ã¯ã次ã®ãããªã³ãã³ããå®è¡ã§ããŸãïŒ
sudo apt install gcc make autoconf libtool bison re2c pkg-config php-dev
Windows ã§ã¯ããã«ãããŒã«ãã§ãŒã³ãã€ã³ã¹ããŒã«ããå¿ èŠã¯ãããŸãããWindows ã® PHP æ¡åŒµæ©èœã¯ æ¡åŒµæ©èœ DLL ãå«ãããªã³ã³ãã€ã«æžã¿ããã±ãŒãžãšããŠé åžãããããã§ãã
pie.phar ãããŠã³ããŒãããŸãïŒ
gh attestation verify --owner php pie.phar ã§ PHAR ã®åºæã確èªããŸãphp pie.phar <command> ã§ PIE ãåŒã³åºãããšãã§ããŸãã€ã³ã¹ããŒã«ã®è©³çްã«ã€ããŠã¯ãäœ¿çšæ³ ããã¥ã¡ã³ããåç
§ããŠãã ããã
ãã®ããã¥ã¡ã³ãã§ã¯ãpie.phar ã $PATH ã«ç§»åããããšãåæãšããŠããŸãïŒäŸïŒé Windows ã·ã¹ãã ã§ã¯ /usr/local/bin/pieïŒã
install ã³ãã³ãã䜿çšããŠæ¡åŒµæ©èœãã€ã³ã¹ããŒã«ã§ããŸããäŸãã°ãexample_pie_extension æ¡åŒµæ©èœã
ã€ã³ã¹ããŒã«ããã«ã¯ã次ãå®è¡ããŸãïŒ
$ pie install example/example-pie-extension
ãã®ã³ãã³ãã«ã¯ç®¡çè
æš©éãå¿
èŠãªå Žåãããããã¹ã¯ãŒãã®å
¥åãæ±ããããããšããããŸãã
å®è¡äžã® PHP: 8.3.10
ã¿ãŒã²ãã PHP ã€ã³ã¹ããŒã«: 8.3.10 ntsãLinux/OSX/etc x86_64ïŒ/usr/bin/php8.3 ããïŒ
ããã±ãŒãžãèŠã€ãããŸãã: example/example-pie-extension:1.0.1ïŒext-example_pie_extension ãæäŸïŒ
phpize å®äºã
èšå®å®äºã
ãã«ãå®äº: /tmp/pie_downloader_66e0b1de73cdb6.04069773/example-example-pie-extension-769f906/modules/example_pie_extension.so
ã€ã³ã¹ããŒã«å®äº: /usr/lib/php/20230831/example_pie_extension.so
php.ini ã« "extension=example_pie_extension" ã远å ããå¿
èŠããããŸã
$
PHP ãããžã§ã¯ãå ã§ãäžè¶³ããŠãããããã¬ãã«ã®æ¡åŒµæ©èœãã€ã³ã¹ããŒã«ã§ããŸãïŒ
$ pie install
𥧠PHP Installer for Extensions (PIE), 0.9.0, from The PHP Foundation
å®è¡äžã® PHP: 8.3.19
ã¿ãŒã²ãã PHP ã€ã³ã¹ããŒã«: 8.3.19 ntsãLinux/OSX/etc x86_64ïŒ/usr/bin/php8.3 ããïŒ
ãããžã§ã¯ã your-vendor/your-project ã®æ¡åŒµæ©èœã確èªäž
requires: curl â
æ¢ã«ã€ã³ã¹ããŒã«æžã¿
requires: intl â
æ¢ã«ã€ã³ã¹ããŒã«æžã¿
requires: json â
æ¢ã«ã€ã³ã¹ããŒã«æžã¿
requires: example_pie_extension â ïž äžè¶³
以äžã®ããã±ãŒãžãé©åã§ããã©ããã€ã³ã¹ããŒã«ããŸããïŒ
[0] ãªã
[1] asgrim/example-pie-extension: Example PIE extension
> 1
> 𥧠PHP Installer for Extensions (PIE), 0.9.0, from The PHP Foundation
> ãã®ã³ãã³ãã«ã¯ç®¡çè
æš©éãå¿
èŠãªå Žåãããããã¹ã¯ãŒãã®å
¥åãæ±ããããããšããããŸãã
> å®è¡äžã® PHP: 8.3.19
> ã¿ãŒã²ãã PHP ã€ã³ã¹ããŒã«: 8.3.19 ntsãLinux/OSX/etc x86_64ïŒ/usr/bin/php8.3 ããïŒ
> ããã±ãŒãžãèŠã€ãããŸãã: asgrim/example-pie-extension:2.0.2ïŒext-example_pie_extension ãæäŸïŒ
... (çç¥) ...
> â
æ¡åŒµæ©èœã¯ /usr/bin/php8.3 ã§æå¹åãããèªã¿èŸŒãŸããŠããŸã
æ¡åŒµæ©èœã®ç¢ºèªãå®äºããŸããã
PIE ããµããŒãããæ¡åŒµæ©èœã®ãªã¹ã㯠https://packagist.org/extensions ã§ç¢ºèªã§ããŸãã
æ¡åŒµæ©èœã®ã¡ã³ãããŒã§ãæ¡åŒµæ©èœã« PIE ãµããŒãã远å ãããå Žåã¯ã æ¡åŒµæ©èœã¡ã³ãã㌠ãèªãã§ãã ããã
PIE ã®å®å šãªããã¥ã¡ã³ãã¯ äœ¿çšæ³ ããã¥ã¡ã³ãã«ãããŸãã
â ïž Warning
This translation may not be based on the latest version, please ensure you check the original English version for discrepancies.
PIE æ¯äžäžªæ°ç PHP æ©å±å®è£ åšïŒæšåšæç»æ¿ä»£ PECLã å®ä»¥ PHAR æ ŒåŒååïŒ å°±å Composer äžæ ·ïŒå·¥äœæ¹åŒä¹ç±»äŒŒïŒäœå®å° PHP æ©å±ïŒPHP æš¡åæ Zend æ©å±ïŒ å®è£ å°æšç PHP å®è£ äžïŒèäžæ¯å° PHP å æå ¥æšçé¡¹ç®æåºã
æšéèŠ PHP 8.1 ææŽé«çæ¬æ¥è¿è¡ PIEïŒäœ PIE å¯ä»¥å°æ©å±å®è£ å°ä»»äœå ¶ä»å·²å®è£ ç PHP çæ¬ã
åš Linux äžïŒæšéèŠå®è£ æå»ºå·¥å ·éŸãåš Debian/Ubuntu ç±»åçç³»ç»äžïŒæšå¯ä»¥è¿è¡ïŒ
sudo apt install gcc make autoconf libtool bison re2c pkg-config php-dev
åš Windows äžïŒæšäžéèŠå®è£ ä»»äœæå»ºå·¥å ·éŸïŒå 䞺 Windows ç PHP æ©å± 以é¢çŒè¯å ç圢åŒååïŒå 嫿©å± DLLã
pie.pharïŒå¯ä»¥éè¿ä»¥äžæ¹åŒïŒ
gh attestation verify --owner php pie.phar éªè¯ PHAR çæ¥æºphp pie.phar <command> è°çš PIEæŽå€å®è£
诊æ
å¯ä»¥åš äœ¿çšææ¡£ äžæŸå°ã
æ¬ææ¡£å讟æšå·²å° pie.phar ç§»åšå°æšç $PATH äžïŒäŸåŠåšé Windows ç³»ç»äžäžº /usr/local/bin/pieã
æšå¯ä»¥äœ¿çš install åœä»€å®è£
æ©å±ãäŸåŠïŒèŠå®è£
example_pie_extension æ©å±ïŒæšå¯ä»¥è¿è¡ïŒ
$ pie install example/example-pie-extension
æ€åœä»€å¯èœéèŠæåæéïŒå¹¶å¯èœæç€ºæšèŸå
¥å¯ç ã
æšæ£åšè¿è¡ PHP 8.3.10
ç®æ PHP å®è£
ïŒ8.3.10 ntsïŒåš Linux/OSX/etc x86_64 äžïŒæ¥èª /usr/bin/php8.3ïŒ
æŸå°å
ïŒexample/example-pie-extension:1.0.1ïŒæäŸ ext-example_pie_extension
phpize 宿ã
é
çœ®å®æã
æå»ºå®æïŒ/tmp/pie_downloader_66e0b1de73cdb6.04069773/example-example-pie-extension-769f906/modules/example_pie_extension.so
å®è£
宿ïŒ/usr/lib/php/20230831/example_pie_extension.so
æšç°åšå¿
é¡»åš php.ini äžæ·»å "extension=example_pie_extension"
$
åšæšç PHP 项ç®äžïŒæšå¯ä»¥å®è£ ä»»äœçŒºå€±ç顶级æ©å±ïŒ
$ pie install
𥧠PHP Installer for Extensions (PIE), 0.9.0, from The PHP Foundation
æšæ£åšè¿è¡ PHP 8.3.19
ç®æ PHP å®è£
ïŒ8.3.19 ntsïŒåš Linux/OSX/etc x86_64 äžïŒæ¥èª /usr/bin/php8.3ïŒ
æ£æ¥æšçé¡¹ç® your-vendor/your-project çæ©å±
requires: curl â
å·²å®è£
requires: intl â
å·²å®è£
requires: json â
å·²å®è£
requires: example_pie_extension â ïž çŒºå€±
以äžå
å¯èœåéïŒæšæ³å®è£
åªäžªïŒ
[0] æ
[1] asgrim/example-pie-extension: Example PIE extension
> 1
> 𥧠PHP Installer for Extensions (PIE), 0.9.0, from The PHP Foundation
> æ€åœä»€å¯èœéèŠæåæéïŒå¹¶å¯èœæç€ºæšèŸå
¥å¯ç ã
> æšæ£åšè¿è¡ PHP 8.3.19
> ç®æ PHP å®è£
ïŒ8.3.19 ntsïŒåš Linux/OSX/etc x86_64 äžïŒæ¥èª /usr/bin/php8.3ïŒ
> æŸå°å
ïŒasgrim/example-pie-extension:2.0.2ïŒæäŸ ext-example_pie_extension
... (çç¥) ...
> â
æ©å±å·²åš /usr/bin/php8.3 äžå¯çšå¹¶å 蜜
宿æ©å±æ£æ¥ã
æ¯æ PIE çæ©å±å衚å¯ä»¥åš https://packagist.org/extensions äžæŸå°ã
åŠææšæ¯æ³èŠäžºæšçæ©å±æ·»å PIE æ¯æçæ©å±ç»Žæ€è ïŒ è¯·é 读 æ©å±ç»Žæ€è ææ¡£ã
PIE çå®æŽææ¡£å¯ä»¥åš äœ¿çšææ¡£ äžæŸå°ã