定制 hmennen90/php-steamworks 二次开发

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

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

hmennen90/php-steamworks

最新稳定版本:v0.4.1

Composer 安装命令:

pie install hmennen90/php-steamworks

包简介

PHP extension providing access to the Valve Steamworks SDK via a flat C API

README 文档

README

Native PHP extension providing access to the Steamworks SDK via a flat C API.

Requirements

  • PHP 8.1+
  • Steamworks SDK 1.58+ (download from partner.steamgames.com)
  • macOS (arm64/x86_64), Linux (x86_64), or Windows (x86_64)

Installation

Via PIE (recommended)

PIE is the official PHP extension installer.

pie install hmennen90/php-steamworks --with-steamworks=/path/to/steamworks-sdk

After installation, copy libsteam_api.dylib (macOS) or libsteam_api.so (Linux) from the SDK's redistributable_bin/ directory next to the built extension:

# macOS
cp /path/to/steamworks-sdk/redistributable_bin/osx/libsteam_api.dylib "$(php-config --extension-dir)/"

# Linux x86_64
cp /path/to/steamworks-sdk/redistributable_bin/linux64/libsteam_api.so "$(php-config --extension-dir)/"

Note (Laravel Herd / custom PHP builds): If PIE fails to auto-install the .so due to a read-only filesystem, the build output still exists at ~/.pie/php*/vendor/hmennen90/php-steamworks/modules/steamworks.so. Copy it to your extension directory manually and use an absolute path in php.ini:

extension=/full/path/to/steamworks.so

Manual build

  1. Download the Steamworks SDK and extract it.

  2. Build the extension:

phpize
./configure --with-steamworks=/path/to/steamworks-sdk
make
make install
  1. Copy the Steam shared library next to the extension (see PIE section above).

  2. Enable the extension in php.ini:

extension=steamworks

See INSTALL.md for detailed platform-specific instructions.

Quick Start

<?php
// steam_appid.txt with your App-ID must exist in the working directory

if (!steam_init()) {
    die("Steam not running\n");
}

echo "Player: " . steam_friends_get_name() . "\n";
echo "App ID: " . steam_utils_get_app_id() . "\n";

// Game loop
while (true) {
    steam_run_callbacks();
    // ... game logic ...
    usleep(16667);
}

steam_shutdown();

Available Functions

Core

  • steam_init(): bool
  • steam_shutdown(): void
  • steam_run_callbacks(): void

User

  • steam_user_get_steam_id(): int|false

Friends

  • steam_friends_get_name(): string|false
  • steam_friends_set_rich_presence(string $key, ?string $value = null): bool
  • steam_friends_activate_overlay(string $dialog): void

Stats & Achievements

  • steam_stats_set_achievement(string $id): bool
  • steam_stats_clear_achievement(string $id): bool
  • steam_stats_store(): bool
  • steam_stats_get_int(string $name): int|false
  • steam_stats_set_int(string $name, int $value): bool
  • steam_stats_get_float(string $name): float|false
  • steam_stats_set_float(string $name, float $value): bool

Remote Storage (Cloud Saves)

  • steam_remote_file_write(string $filename, string $data): bool
  • steam_remote_file_read(string $filename): string|false
  • steam_remote_file_exists(string $filename): bool
  • steam_remote_file_delete(string $filename): bool
  • steam_remote_file_list(): array|false

Apps

  • steam_apps_is_subscribed(): bool
  • steam_apps_is_dlc_installed(int $dlc_id): bool
  • steam_apps_get_app_id(): int|false
  • steam_apps_get_language(): string|false

Utils

  • steam_utils_get_app_id(): int|false
  • steam_utils_is_overlay_enabled(): bool
  • steam_utils_get_country_code(): string|false

License

MIT

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: C

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-03-09

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固