Samsara SDK for Laravel
A comprehensive Laravel SDK for the Samsara Fleet Management API with fluent query builder, type-safe entities, and full API coverage.
Features
- 40+ Resource Endpoints - Full coverage of Samsara’s API including Fleet, Telematics, Safety, Dispatch, Industrial, and more
- Fluent Query Builder - Filter, paginate, and stream data with an intuitive query interface
- Type-Safe Entities - All API responses are mapped to strongly-typed entity classes
- Cursor Pagination - Built-in support for Samsara’s cursor-based pagination
- Lazy Collections - Memory-efficient streaming for large datasets
- Testing Support -
SamsaraFakeclass for easy mocking in tests
Quick Example
use Samsara\Facades\Samsara;
// Get all drivers
$drivers = Samsara::drivers()->all();
// Find a specific vehicle
$vehicle = Samsara::vehicles()->find('vehicle-id');
// Query with filters
$stats = Samsara::vehicleStats()
->current()
->whereVehicle(['vehicle-1', 'vehicle-2'])
->types(['gps', 'engineStates'])
->get();
Documentation
Getting Started
- Getting Started - Installation and quick start guide
- Configuration - All configuration options
Guides
- Query Builder - Fluent filtering, pagination, and data retrieval
- Error Handling - Exception handling and retry logic
- Testing - Testing with SamsaraFake and fixtures
Resources
See the Resources section for detailed documentation on each API resource:
| Category | Resources |
|---|---|
| Fleet | Drivers, Vehicles, Trailers, Equipment |
| Telematics | Vehicle Stats, Vehicle Locations, Trips |
| Safety | Hours of Service, Maintenance, Safety Events |
| Dispatch | Routes, Addresses |
| Organization | Users, Tags, Contacts |
Requirements
- PHP 8.1 or higher
- Laravel 10.x, 11.x, or 12.x
- Samsara API token
License
This package is open-sourced software licensed under the MIT license.