A PHP extension to use Arch Linux's ALPM
This is still a work in progress. Although most features work, some do not and there may still be some memory leaking hidden in here.
The main thing to be cautious about is using AlpmTransaction
as it is very
leaky. If you are just using this to gather information from a Pacman database
(using AlpmHandle
, AlpmDb
, and AlpmPkg
), it should result in very few
problems.
You need the following to build and run this.
- PHP >= 7.1
- libalpm >=10.0
Do what you'd normally do for a php extension:
Get the code:
$ git clone https://github.com/markzz/php-alpm.git
If you are not on Arch Linux, you will need to build and install pacman (which contains libalpm) first:
On Ubuntu (maybe Debian):
# apt-get install libarchive-dev
$ curl -O https://sources.archlinux.org/other/pacman/pacman-5.1.2.tar.gz
$ tar -xzvf pacman-5.0.2.tar.gz
$ cd pacman-5.0.2 && ./configure --disable-doc && make
# make install
Build it:
$ phpize
$ ./configure --enable-alpm
$ make
# make install
You should now have alpm.so
installed in your modules folder and you need to
add extension=alpm.so
to your php.ini
.
This project is licensed under the LGPLv2.1 and any and all contributions are
welcome. You can either fork this on GitHub and file a Pull Request or you can
send git formatted patches to [email protected]
. Whichever you prefer.