Repository navigation
Orbit 2.0 is a rework of the package around type safety and a simpler, more reliable storage engine. Your content files are now the source of truth, and the SQLite database is a cache that Orbit rebuilds from them.
Upgrading from 1.x? Read the upgrade guide first. Orbit 2.0 requires PHP 8.3+ and Laravel 13.
Highlights
- Files are the source of truth.
- On the first query of each request, Orbit checks each model's files and schema and rebuilds that model's cache if anything changed, including files edited or deleted by hand.
- Saves, deletes and increments write the model's file inside a transaction, including quiet saves. If the file can't be written, the change is rolled back.
- Files that can't be parsed are skipped with a warning instead of breaking every query.
orbit:cachefor production. Run it on deploy to build the cache and stop checking files for changes.orbit:clearresets it.- Readable files.
- Array casts are written as real lists and maps, and dates as ISO 8601 strings.
nullvalues are left out. - A file without a key uses its file name, so hand-written files like
content/posts/hello-world.mdwork with a string key.
- Array casts are written as real lists and maps, and dates as ISO 8601 strings.
- Single-file storage. The new
FlatJsondriver stores all of a model's records in one file, such ascontent/posts.json. Custom drivers can do the same by implementingOrbit\Contracts\SingleFile(thanks @godismyjudge95). - Multitenancy. A model can return a different table and directory per tenant from
getTable()andgetOrbitSource(), and each gets its own cache. - Laravel's
SoftDeletesnow works directly. Soft deleting writesdeleted_atto the file.
Breaking changes
- Models must implement
Orbit\Contracts\Orbitalongside theOrbitaltrait. schema()is now an instance method with avoidreturn type.- Drivers are chosen by class name from
getOrbitDriver().$driver,getOrbitalDriver()andOrbit::extend()are gone. - Custom drivers implement the new
Orbit\Contracts\Driverinterface, andFileDriverhas been removed. getOrbitalName()is nowgetOrbitSource(), andgetOrbitalPathPattern()has been removed.Orbit\Concerns\SoftDeleteshas been removed in favour of Laravel's trait.orbit:clearno longer asks for confirmation, and its--forceoption has been removed.
See the upgrade guide for details and code examples.
Fixed since 1.x
- Many-to-many relationships through an Orbit pivot model no longer fail with "no such table" when the relationship is empty (#116).
- Array and JSON casts are no longer double-encoded when the cache is rebuilt (#171).
- The
_orbit_meta"table already exists" error can no longer happen (#153). - Filament table summaries and
withCount()between Orbit models work (#156).
Known limitations
- Query-level writes such as
Post::where('draft', true)->delete()don't load models, so they don't update files. Load the models and save or delete each one instead. morphToManyrelationships through an Orbit pivot model aren't covered by the many-to-many fix yet.
Changes since v2.0.0-rc1: v2.0.0-rc1...v2.0.0