cervon/tms-php-client 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

cervon/tms-php-client

最新稳定版本:v0.0.8

Composer 安装命令:

composer require cervon/tms-php-client

包简介

A PHP client for the TMS API.

README 文档

README

use Cervon\Tms\Tms;

$CLIENT_ID = 'MY_CLIENT_ID';
$CLIENT_SECRET = 'MY_CLIENT_SECRET';
$TMS_BASE_URL = 'https://my-tms-url.com/'

$tms = new Tms($CLIENT_ID, $CLIENT_SECRET, $TMS_BASE_URL);
$authenticator = $tms->getAccessToken();
$tms->authenticate($authenticator);

$jobs = $tms->listJobs();

foreach ($jobs as $job) {
    echo "Job #{$job->number} (ID: {$job->_id})\n";
}

Installation

composer require cervon/tms-php-client

Usage

You can authenticate using your TMS client id, client secret and base URL.

use Cervon\Tms\Tms;

$CLIENT_ID = 'MY_CLIENT_ID';
$CLIENT_SECRET = 'MY_CLIENT_SECRET';
$TMS_BASE_URL = 'https://my-tms-url.com/'

$tms = new Tms($CLIENT_ID, $CLIENT_SECRET, $TMS_BASE_URL);
$authenticator = $tms->getAccessToken();

Disabling SSL verify

By default, SSL verification is enabled. If you want to test the API locally, you can disable SSL verification.

$tms = new Tms($CLIENT_ID, $CLIENT_SECRET, $TMS_BASE_URL, verifySsl: false);

Caching authenticator

To avoid sending authentication requests every time, you can serialize and cache the authenticator object. Example in Laravel:

use Cervon\Tms\Tms;
use Illuminate\Support\Facades\Cache;

$tms = new Tms($CLIENT_ID, $CLIENT_SECRET, $TMS_BASE_URL);

$authenticator = Cache::remember('tms_authenticator', 3600, function () use ($tms) {
    // Fresh token when cache is empty
    return $tms->getAccessToken();
});

// Refresh token when expired
if ($authenticator->hasExpired()) {
    $authenticator = $tms->getAccessToken();
    Cache::put('tms_authenticator', $authenticator, 3600);
}

$tms->authenticate($authenticator);

Security

If you discover any security related issues, please email support@cervon.nl instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-10-16

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固