php-gnupg/README.md
Venca Krecl c9dcd34f33
Add PIE support (GH-56)
Add a composer.json with the `php-ext` type and metadata required by PIE
(https://github.com/php/pie), the modern replacement for PECL, so the
extension can be installed via `pie install php-gnupg/gnupg`.

The `configure-options` mirror the flags exposed by config.m4
(`--with-gnupg`, `--with-gpg`). Windows is excluded via
`os-families-exclude` since GpgME builds supported by PHP are unavailable
there. Document the PIE install method in the README.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-19 17:34:16 +02:00

68 lines
1.4 KiB
Markdown

# PHP GnuPG
The php-gnupg is a wrapper for GpgME library that provides access to GnuPG.
## Installation
### Linux
Before starting with installation of this extensions, the `GpgME` library has to be installed. It
has got installation packages on the most Linux distributions. The minimal version of GpgME that
is supported is 1.3.0. The extension supports GnuPG version 1 and 2.
Of course PHP has to be installed too. The minimal version that is supported is 5.3.2.
#### PIE
This extension can be installed with [PIE](https://github.com/php/pie), the modern
successor to PECL.
```
$ pie install php-gnupg/gnupg
```
#### PECL
This extension is available on PECL.
```
$ sudo pecl install gnupg
```
#### Manual Installation
It's important to have a git installed
First clone the repository
```
git clone https://github.com/php-gnupg/php-gnupg.git
```
Then go to the created directory and compile the extension. The PHP development package has to be
installed (command `phpize` must be available).
```
cd php-gnupg
phpize
./configure
make
sudo make install
```
Finally the following line needs to be added to `php.ini`
```
extension=gnupg.so
```
or for PHP 8+ it's just
```
extension=gnupg
```
### Windows
The extension is not currently supported on Windows due to unavailable GpgME library builds that
would be supported by PHP.
## Documentation
The extension documentation is now available in the PHP-Manual: http://php.net/manual/en/book.gnupg.php