deschutesdesigngroupllc/perscom-php-sdk
Composer 安装命令:
composer create-project deschutesdesigngroupllc/perscom-php-sdk
包简介
The PERSCOM PHP SDK is a powerful tool that enables seamless integration with the PERSCOM platform, allowing you to interact with PERSCOM's personnel data programmatically.
README 文档
README
The Official PERSCOM PHP SDK
A PHP package that helps kickstart your next PERSCOM integration.
Introduction
The PERSCOM PHP SDK is a powerful tool that enables seamless integration with the PERSCOM platform, allowing you to interact with PERSCOM's personnel data programmatically.
Getting Started
You can install the package using Composer:
composer require deschutesdesigngroupllc/perscom-php-sdk
Documentation
Visit our documentation here to get started.
Usage
Below is an overview of common usages for the SDK.
<?php use Perscom\PerscomConnection; use Perscom\Data\ResourceObject; use Perscom\Data\SortObject; use Perscom\Data\FilterObject; // The following are examples on the user resource, but the same principles // can be applied to any PERSCOM resource. $perscom = new PerscomConnection('YOUR_API_KEY'); // Optionally include your PERSCOM ID for better request identification // $perscom = new PerscomConnection('YOUR_API_KEY', 'YOUR_PERSCOM_ID'); // For custom base URLs (advanced usage) // $perscom = new PerscomConnection('YOUR_API_KEY', 'YOUR_PERSCOM_ID', 'https://staging.perscom.io'); // Get a list of a specific resource $response = $perscom->users()->all(); // Get a specific resource $response = $perscom->users()->get(id: 1); // Create a resource $response = $perscom->users()->create(data: [ 'name' => 'User 1', 'email' => 'user1@email.com' ]); // Update a resource $response = $perscom->users()->update(id: 1, data: [ 'name' => 'User 1 New Name' ]); // Delete a resource $response = $perscom->users()->delete(id: 1); // Search for a resource $response = $perscom->users()->search( value: 'foobar', sort: new SortObject('first_name', 'asc'), filter: new FilterObject('created_at', '<', '2024-01-01') ); // Batch create a resource $response = $perscom->users()->batchCreate([ new ResourceObject(data: [ 'name' => 'User 1', 'email' => 'user1@email.com' ]), new ResourceObject(data: [ 'name' => 'User 2', 'email' => 'user2@email.com' ]) ]); // Batch update a resource $response = $perscom->users()->batchUpdate([ new ResourceObject(id: 1, data: [ 'name' => 'User 1 New Name' ]), new ResourceObject(id: 2, data: [ 'name' => 'User 2 New Name' ]) ]); // Batch delete a resource $response = $perscom->users()->batchDelete([ new ResourceObject(id: 1), new ResourceObject(id: 2) ]); // Uploading an attachment $response = $perscom->users()->attachments(userId: 1)->create(data: [ 'name' => 'Attachment 1', 'file' => fopen('/../file.pdf', 'r') ]); // Other examples $response = $perscom->users()->profilePhoto(userId: 1)->create(filePath: 'image.jpg'); $response = $perscom->users()->assignmentRecords(userId: 1)->delete(id: 1); // Parse the response into a usable array $data = $response->json();
Error Handling
The PERSCOM SDK throws exceptions when an API error occurs. You can catch these exceptions and handle them accordingly with a standard try/catch block. For a more elegant approach to error handling, consider using the promise-based approach.
use Perscom\PerscomConnection; use Perscom\Exceptions\AuthenticationException; try { $perscom = new PerscomConnection('YOUR_API_KEY'); $response = $perscom->users()->all()->json(); } catch (AuthenticationException $exception) { Log::error('The provided API key is invalid'); }
Promise Support
The PERSCOM SDK can send asynchronous requests using a promise-based approach. This allows you to handle both successful and failed requests in a more fluent way.
use Perscom\PerscomConnection; use Perscom\Http\Requests\Crud\GetAllRequest; use Saloon\Http\Response; use Saloon\Exceptions\Request\RequestException; // Create a PERSCOM instance $perscom = new PerscomConnection('YOUR_API_KEY'); // Create a promise $promise = $perscom->sendAsync(new GetAllRequest('users')); // Send the request $promise ->then(function (Response $response) { // Handle successful response }) ->otherwise(function (RequestException $exception) { // Handle failed request }); // Resolve the promise $promise->wait();
Contributing
Please see here for more details about contributing.
deschutesdesigngroupllc/perscom-php-sdk 适用场景与选型建议
deschutesdesigngroupllc/perscom-php-sdk 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 752 次下载、GitHub Stars 达 0, 最近一次更新时间为 2023 年 09 月 26 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「php」 「sdk」 「perscom」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 deschutesdesigngroupllc/perscom-php-sdk 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 deschutesdesigngroupllc/perscom-php-sdk 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 deschutesdesigngroupllc/perscom-php-sdk 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Alfabank REST API integration
Zero-dependency raw PHP DNS resolver, domain-ownership verification, and intoDNS/MxToolbox-style diagnostics. Queries authoritative nameservers directly over sockets — never trusts the recursive cache for ownership checks.
A command-line interface tool to interact with your PERSCOM data.
A lightweight plain-PHP framework for database-backed CRUD APIs.
bughq error tracking - PHP SDK
ABsurge PHP SDK for feature flags and A/B testing
统计信息
- 总下载量: 752
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 8
- 依赖项目数: 2
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-09-26
