ryangjchandler/orbit
Orbit is a flat-file driver for Laravel Eloquent. Store model records as files instead of a database while keeping familiar Eloquent create, update, delete, and query workflows. Define a schema on your model, and Orbit handles paths and persistence automatically.
where, orderBy, relations) while abstracting flat-file storage. Reduces boilerplate for simple data persistence.config/database.php). Leverages Eloquent’s existing query builder, reducing learning curve.filesystem and json extensions. No external services or heavy libraries.OrbitEncryptor), and chunked file handling for larger datasets.dd() or telescope before production.flock) for multi-process writes.php artisan orbit:migrate). No built-in schema management.hasManyThrough)? Orbit may simplify these to linear scans./storage/orbit) writable and persistent across deployments?Settings, StaticPages).OrbitServiceProvider to register the driver alongside existing DB connections.// config/database.php
'connections' => [
'orbit' => [
'driver' => 'orbit',
'path' => storage_path('app/orbit'),
],
];
connection() method to route models dynamically:
class Product extends Model {
protected $connection = 'orbit'; // or 'mysql'
}
OrbitSeeder.orbit connection.where, orderBy, limit, relations (via JSON nesting).join clauses (use denormalized data or pre-computed relations).increment/decrement (implement manually with file reads/writes).composer require ryangjchandler/orbit.config/database.php.php artisan tinker):
$user = new User(); $user->name = 'Test'; $user->save();
Orbit::logQueries(true)) to detect performance issues.storage_path('app/orbit') disk usage).fs events).filesystem events to trigger cleanup:
// app/Providers/EventServiceProvider.php
Event::listen(FileWritten::class, function ($event) {
if (str_contains($event->path(), 'orbit')) {
// Log or alert on large files
}
});
Orbit::getRawData() to inspect the underlying JSON structure.chmod -R 755 storage).flock in custom queries for high-concurrency apps.flysystem adapter).users_1.json, users_2.json).chunk option to split files by record count:
'path' => storage_path('app/orbit'),
'chunk' => 1000, // Split into files of ~1000 records
Cache::remember()).| Failure | Impact | Mitigation |
|---|---|---|
| Filesystem corruption | Data loss | Regular backups (e.g., rsync to S3). |
| Disk full | Write failures | Monitor disk space (e.g., df -h). |
| Concurrent write conflicts | Data corruption | Implement flock or queue writes. |
| Large file slowdowns | Timeouts | Partition data or switch to SQLite. |
| Accidental file deletion | Data loss | Version files (e.g., orbit_2023-01-01). |
join).storage/app/orbit/users.json").zip -r orbit_backup.zip storage/app/orbit).README.md section in your repo outlining Orbit’s role in the stack.## Data Storage
- **Orbit**: Used for static data (e.g., `/config`, `/pages`).
- **MySQL**: Used for dynamic data (e.g., `/users`, `/orders`).
How can I help you explore Laravel packages today?