cervon / tms-php-client
A PHP client for the TMS API.
Installs: 4
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/cervon/tms-php-client
Requires
- php: ^8.2
- saloonphp/pagination-plugin: ^2.2
- saloonphp/saloon: ^3.14
Requires (Dev)
- laravel/pint: ^1.25
This package is not auto-updated.
Last update: 2025-10-17 05:24:34 UTC
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.