SDL_mixer for PHP allows to easily load audio files (WAV, OGG, etc.) and play them. It requires SDL PHP Extension.
Install with PIE (PHP Installer for Extensions):
$ pie install kea/php-sdl-mixerThe SDL_mixer development files (e.g. libsdl2-mixer-dev on Debian/Ubuntu) and the SDL PHP extension must be installed first.
If SDL_mixer is in a non-standard location:
$ pie install kea/php-sdl-mixer --with-sdl_mixer=/opt/sdl_mixer$ pecl install sdl-beta sdl_mixer-devel$ phpize
$ ./configure --with-sdl_mixer
$ make
$ make install$ php run-tests.php --show-diff -q
$ docker build --build-arg PHP_VERSION=8.4 -t php-sdl-mixer:8.4 .
$ docker run --rm php-sdl-mixer:8.4