fleetbase/samsara-api
Composer 安装命令:
composer require fleetbase/samsara-api
包简介
Vehicle Data Import & Location Integration via Samsara API
README 文档
README
A comprehensive Fleetbase extension that integrates with the Samsara API for vehicle data import and real-time location tracking. This extension enables fleet operators to seamlessly sync vehicle data from Samsara into their Fleetbase instance, providing unified fleet management capabilities.
Overview
The Samsara Extension bridges the gap between Samsara's fleet management platform and Fleetbase's comprehensive logistics solution. It provides real-time vehicle data synchronization, location tracking, and event processing capabilities that enhance fleet visibility and operational efficiency.
- PHP 8.2 or above
- Ember.js v5.4 or above
- Ember CLI v5.4 or above
- Node.js v18 or above
Key Benefits
- Unified Fleet Management: Manage both Samsara and non-Samsara vehicles within a single Fleetbase interface
- Real-time Location Tracking: Automatic location updates via Samsara webhooks
- Comprehensive Vehicle Data: Import detailed vehicle information including VIN, serial numbers, and metadata
- Multi-tenant Architecture: Secure company-level data isolation
- Role-based Access Control: Granular permissions for different user roles
- Scalable Integration: Handles high-volume webhook events and API calls
Features
Core Functionality
- Vehicle Data Synchronization: Automated import of vehicle information from Samsara
- Real-time Location Updates: Live vehicle tracking via webhook integration
- Credential Management: Secure storage and management of Samsara API credentials
- Event Processing: Comprehensive webhook event handling and logging
- Multi-company Support: Full multi-tenancy with company-level data isolation
Advanced Features
- Scheduled Synchronization: Configurable sync intervals for vehicle data
- Error Handling & Retry Logic: Robust error handling with automatic retry mechanisms
- Health Monitoring: Built-in health checks and sync status monitoring
- Audit Trail: Complete logging of all sync operations and webhook events
- Flexible Linking: Link Samsara vehicles to existing FleetOps vehicles
Structure
├── addon
├── app
├── assets
├── translations
├── config
├── node_modules
├── server
│ ├── config
│ ├── data
│ ├── migrations
│ ├── resources
│ ├── src
│ ├── tests
│ └── vendor
├── tests
├── testem.js
├── index.js
├── package.json
├── phpstan.neon.dist
├── phpunit.xml.dist
├── pnpm-lock.yaml
├── ember-cli-build.js
├── composer.json
├── CONTRIBUTING.md
├── LICENSE.md
├── README.md
Installation
Backend
Install the PHP packages using Composer:
composer require fleetbase/core-api composer require fleetbase/samsara-api
Frontend
Install the Ember.js Engine/Addon:
pnpm install @fleetbase/samsara-engine
Configuration
Environment Variables
Add the following environment variables to your .env file:
# Samsara Extension Configuration SAMSARA_DEFAULT_SYNC_INTERVAL=5 SAMSARA_WEBHOOK_TIMEOUT=30 SAMSARA_API_TIMEOUT=30 SAMSARA_MAX_RETRY_ATTEMPTS=3
Samsara API Credentials
The extension requires Samsara API credentials to function. You can configure these through the Fleetbase console:
- Navigate to FleetOps > Settings > Samsara
- Click Add Credential
- Fill in the required information:
- Name: A descriptive name for the credential set
- API Token: Your Samsara API token
- API Base URL: Usually
https://api.samsara.com(leave blank for default) - Environment: Select Sandbox or Production
- Sync Interval: How often to sync vehicle data (1-60 minutes)
Webhook Configuration
For real-time updates, configure webhooks in your Samsara dashboard:
- Webhook URL:
https://api.fleetbase.io/int/v1/samsara/webhook/{companyId} - Events: Select the events you want to receive:
- Vehicle Location Updates
- Vehicle Information Changes
- Alert Events
- Secret: Generate a webhook secret for signature verification
Usage
Basic Vehicle Synchronization
Once configured, the extension automatically synchronizes vehicle data from Samsara. You can also trigger manual synchronization:
- Navigate to FleetOps > Settings > Samsara > Vehicles
- Click Sync All to import all vehicles
- Use the Sync button next to individual vehicles for selective updates
Permissions & Security
The extension implements comprehensive role-based access control with the following permission structure:
Permission Categories
Credential Permissions
samsara view credentials: View API credentialssamsara create credentials: Create new credentialssamsara update credentials: Modify existing credentialssamsara delete credentials: Remove credentialssamsara test credentials: Test API connectionssamsara manage credentials: Activate/deactivate credentials
Vehicle Permissions
samsara view vehicles: View vehicle data and sync statussamsara create vehicles: Create new vehicle syncssamsara update vehicles: Modify vehicle sync settingssamsara delete vehicles: Remove vehicle syncssamsara sync vehicles: Trigger manual synchronizationsamsara link vehicles: Link/unlink vehicles to FleetOpssamsara view location history: Access vehicle location history
Webhook Permissions
samsara view webhook events: View webhook events and logssamsara manage webhook events: Retry events and manage settings
Administrative Permissions
samsara view sync status: View synchronization statussamsara manage sync: Trigger syncs and manage settingssamsara admin: Full administrative access
Predefined Roles
Samsara Viewer
Basic read-only access to view vehicles, credentials, and events.
Samsara Operator
Operational access including vehicle syncing and linking capabilities.
Samsara Manager
Management access including credential management and webhook configuration.
Samsara Administrator
Full administrative access to all extension features.
Usage
Backend
🧹 Keep a modern codebase with PHP CS Fixer:
composer lint
⚗️ Run static analysis using PHPStan:
composer test:types
✅ Run unit tests using PEST
composer test:unit
🚀 Run the entire test suite:
composer test
Frontend
🧹 Keep a modern codebase with ESLint:
pnpm lint
✅ Run unit tests using Ember/QUnit
pnpm test
pnpm test:ember
pnpm test:ember-compatibility
🚀 Start the Ember Addon/Engine
pnpm start
🔨 Build the Ember Addon/Engine
pnpm build
Contributing
See the Contributing Guide for details on how to contribute to this project.
License
This project is licensed under the AGPL-3.0-or-later License. See the LICENSE file for details.
Developed by Fleetbase
For support, please contact support@fleetbase.io or visit our documentation.
fleetbase/samsara-api 适用场景与选型建议
fleetbase/samsara-api 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 51 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 08 月 27 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「integration」 「tracking」 「vehicle」 「fleet」 「fleetbase」 「fleetbase-extension」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 fleetbase/samsara-api 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 fleetbase/samsara-api 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 fleetbase/samsara-api 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A PHP library for integrating 54grad.de's vehicle labeling services.
API client for the DVLA's Vehicle Enquiry Service API
LinkedIn API PHP SDK with OAuth 2.0 & CSRF support. Can be used for social sign in or sharing on LinkedIn. Examples. Documentation.
PHP library to validate and format license plate numbers.
PHP SDK for the Parcel Monkey UK API
Vehicle logotypes set
统计信息
- 总下载量: 51
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 30
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: AGPL-3.0-or-later
- 更新时间: 2025-08-27