pipaypw/payroll
Composer 安装命令:
composer require pipaypw/payroll
包简介
PHP package to automate operation transactions on Pi Network
README 文档
README
Payroll - Pi Network PHP server-side Service worker package
This is a Pi Network PHP package you can use to integrate the Pi Network sevice worker apps platform with a PHP backend application.
Install
Install this package as a dependency of your app:
# With composer:
composer require pipaypw/payroll:dev-main
Example
- Initialize the SDK
require __DIR__ . '/vendor/autoload.php'; use Pipaypw\Payroll\SpenderBot; // DO NOT expose these values to public $apiKey = "YOUR_PI_API_KEY"; $walletPrivateSeed = "S_YOUR_WALLET_PRIVATE_SEED"; // starts with S $network = "Pi Network"; $sw = new SpenderBot($apiKey, $walletPrivateSeed);
Stream for payments and events
In this example we will listen for received payments for an account.
$sdk = $sw->getHorizonClient($network); // Create two accounts, so that we can send a payment. $keypair1 = KeyPair::random(); $keypair2 = KeyPair::random(); $acc1Id = $keypair1->getAccountId(); $acc2Id = $keypair2->getAccountId(); FriendBot::fundTestAccount($acc1Id); FriendBot::fundTestAccount($acc2Id); // create a child process that listens to payment steam $pid = pcntl_fork(); if ($pid == 0) { // Subscribe to listen for payments for account 2. // If we set the cursor to "now" it will not receive old events such as the create account operation. $sdk->payments()->forAccount($acc2Id)->cursor("now")->stream(function(OperationResponse $payment) { printf('Payment operation %s id %s' . PHP_EOL, get_class($payment), $payment->getOperationId()); // exit as soon as our specific payment has been received if ($payment instanceof PaymentOperationResponse && floatval($payment->getAmount()) == 100.00) { exit(1); } }); } // send the payment from account 1 to account 2 $acc1 = $sdk->requestAccount($acc1Id); $paymentOperation = (new PaymentOperationBuilder($acc2Id, Asset::native(), "100"))->build(); $transaction = (new TransactionBuilder($acc1))->addOperation($paymentOperation)->build(); $transaction->sign($keypair1, Network::testnet()); $response = $sdk->submitTransaction($transaction); // wait for child process to finish. while (pcntl_waitpid(0, $status) != -1) { $status = pcntl_wexitstatus($status); echo "Completed with status: $status \n"; }
Overall flow for Payroll
To create a SpenderBot payment using the Pi PHP SDK, here's an overall flow you need to follow:
Intentionaly left blank
Apps
- PIPAY Dapp SmartContracts for Pi Network.
- PIPAY WALLET Wallet on Pi, Fast and instant payments.
pipaypw/payroll 适用场景与选型建议
pipaypw/payroll 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 2 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 05 月 30 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 pipaypw/payroll 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 pipaypw/payroll 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 2
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 18
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2025-05-30