定制 terremoth/php-win32-playwav 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

terremoth/php-win32-playwav

最新稳定版本:v1.0.0

Composer 安装命令:

composer require terremoth/php-win32-playwav

包简介

Play wav (wave) files natively with PHP on Windows

README 文档

README

Play wav (wave) files natively with PHP on Windows. Zero extensions or dependencies needed!

It uses PlaySound from winmm.dll, unlocked by the power of PHP FFI

Not because we must do it, but because we can!

Made by Terremoth with ⚡ & ❤

CodeCov Psalm type coverage Psalm level Test Run Status Test Coverage Codacy Badge Maintainability License

See demos/demo.php for examples.

Installation

composer require terremoth/php-win32-playwav

Documentation

Play Sync

<?php

require 'vendor/autoload.php';

use Win32Sound\PlayWav;

$sound = new PlayWav('test.wav');
$sound->play();

Play Async

<?php

require 'vendor/autoload.php';

use Win32Sound\PlayWav;

$sound = new PlayWav('test.wav');
$sound->async()->play();

Loop the audio

Also, you can "loop" and then, stop if you want.
IMPORTANT: loop() requires ->async() at some point, in order to work due to Windows API:

<?php

require 'vendor/autoload.php';

use Win32Sound\PlayWav;

$sound = new PlayWav('test.wav');
$sound->async()->loop()->play();

// if the scripts ends it will "kill" the audio process,
// so, to listen just put a sleep in order to test
sleep(5); 

// if you want to stop the looping audio, just:
$sound->stop();

统计信息

  • 总下载量: 1
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-3.0-or-later
  • 更新时间: 2024-11-20