Blog Detail


Orbit - A Flat-File Database Driver for Laravel Eloquent cover image

Orbit - A Flat-File Database Driver for Laravel Eloquent

Ryan Chandler comes up with a flat-file driver for Laravel Eloquent known as Orbit. It enables you to replace your generic database with original files that you can handle using the methods you're familiar with. You can employ it as general-purpose "flat-file CMS in any of your web applications." It can be appended to any Laravel Model class and permits you to save data in flat files on a disk.


Orbit is a handy package that can provide flat-file support to any Laravel model class. To install Orbit, you've to run the following command in your project.

composer require ryangjchandler/orbit


Next, you've to create a Laravel model and use the Orbit\Concerns\Orbital trait.

use Orbit\Concerns\Orbital trait.
class Post extends Model
    use \Orbit\Concerns\Orbital;

The Orbital trait is qualified for hooking into the Eloquent lifecycle and assuring all of your interactions are managed correctly.

Defining the Schema

Same as database migration, you've to specify the different pieces of data that your Orbit model can have. You've to append a public static function schema(Blueprint $table) method to your model.

This method will need to receive an instance of Illuminate\Database\Schema\Blueprint, just like a migration.

use Illuminate\Database\Schema\Blueprint;

class Post extends Model
    use \Orbit\Concerns\Orbital;

    public static function schema(Blueprint $table)


Orbit is a driver-based package, building it very straightforward to change the storage format of your data.

It supports the following drivers out of the box:

  • md -> Orbit\Drivers\Markdown
  • json -> Orbit\Drivers\Json
  • yaml -> Orbit\Drivers\Yaml
  • md_json -> Orbit\Drivers\MarkdownJson

You are free to specify custom drivers utilizing the given interface contained in the Orbit package.

Changing drivers

If you prefer to use a different driver for one of your models, you can append a public static $driver property to your model and specify the value to the name of a driver.

class Post extends Model
    use Orbital;

    public static $driver = 'json';

For more detailed information, you can visit this link. ryangjchandler/orbit

Published at : 20-07-2021

Author : Rizwan Aslam
Rizwan Aslam

I am a highly results-driven professional with 12+ years of collective experience in the grounds of web application development especially in laravel, native android application development in java, and desktop application development in the dot net framework. Now managing a team of expert developers at Codebrisk.

Launch project