定制 valzargaming/php-osc 二次开发

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

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

valzargaming/php-osc

最新稳定版本:v2.0.0

Composer 安装命令:

composer require valzargaming/php-osc

包简介

Open Sound Control (OSC) Client Library for PHP

README 文档

README

Install the dependencies with Composer:

Run composer install to install the project dependencies.

Bot example

A production-ready example, bot.php, is included. It sends periodic OSC messages (sender-only).

Listener and acknowledgement functionality has been moved to the separate entrypoint script osc_listener.php.

Environment variables for bot.php:

  • OSC_DEST – remote IP to send messages to (default 127.0.0.1)
  • OSC_PORT – remote port to send messages to (default 9000)
  • OSC_INTERVAL – send interval in seconds (default 5)
  • OSC_ADDRESS – OSC address for heartbeat messages (default /bot/heartbeat)

Examples:

Run the bot with defaults:

php bot.php

Send to a custom destination:

OSC_DEST=192.168.1.50 OSC_PORT=3890 OSC_INTERVAL=2 OSC_ADDRESS=/my/bot php bot.php

Start the separate listener (acknowledgement service) in another terminal:

php osc_listener.php

Examples

See examples.md for more usage examples, including the ReactPHP UDP server (server.php) and how to run it together with bot.php for end-to-end testing.

php-osc

PSR-4 version of Open Sound Control (OSC) Client Library for PHP

Authors:

Copyright:

  • Copyright (c) 2003-2007 Andy W. Schmeder
  • Copyright (c) 2026-present Valithor Obsidion

Version: 2.0

Requirements: PHP >= 8.1.2

For information about Open Sound Control, see http://www.opensoundcontrol.org/

Known Issues

  • Listener callbacks in automated tests: The earlier external-process integration test (starting server.php and osc_listener.php as detached processes) failed to observe the server->listener callback in the automated PHPUnit run on Windows. This was caused by process-start timing and platform-specific spawn/quoting behavior. As a result we now provide an in-process integration test that is reliable under PHPUnit: tests/IntegrationTest.php.

  • Manual run that did work: A manual interactive run did exercise the end-to-end flow successfully — start the server and listener, send a probe, and observe the callback/ack cycle in the logs. Example commands used interactively in PowerShell:

    • Start the server (foreground):

      php server.php

    • Start the listener (foreground):

      php osc_listener.php

    • Send a probe to trigger the server callback (helper script):

      php tests/probe_9001.php

    The listener log (osc-listener.log) then shows the received probe and the ack sent back.

  • Why this matters: If you rely on automated external-process integration tests on Windows CI, prefer the in-process ReactPHP test harness provided in tests/IntegrationTest.php or run the manual commands interactively. If you want the external-process test to work in CI, it may require platform-specific adjustments to process startup and timeouts.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: Unknown
  • 更新时间: 2026-01-25

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固