PHPackages                             owenmelbz/sashimi - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. owenmelbz/sashimi

ActiveLibrary[Database &amp; ORM](/categories/database)

owenmelbz/sashimi
=================

Eloquent's missing "array" driver.

v3.0.1(5y ago)05MITPHPPHP ^7.1.3

Since Jan 25Pushed 5y agoCompare

[ Source](https://github.com/OwenMelbz/sashimi)[ Packagist](https://packagist.org/packages/owenmelbz/sashimi)[ GitHub Sponsors](https://github.com/calebporzio)[ GitHub Sponsors](https://github.com/owenmelbz)[ RSS](/packages/owenmelbz-sashimi/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (6)Versions (12)Used By (0)

Sashimi 🍣
=========

[](#sashimi-)

Eloquent's missing "array" driver.

Sometimes you want to use Eloquent, but without dealing with a database.

Important Notice
----------------

[](#important-notice)

This is a fork of  - however it allows you to run Sushi without having a full Laravel installation, allowing you to pull it into other frameworks, it's 90% Celebs code, with additional work-arounds to avoid core Laravel features such as the IoC Container, and global helpers.

Install
-------

[](#install)

```
composer require owenmelbz/sashimi

```

Use
---

[](#use)

Using this package consists of two steps:

1. Add the `\Sashimi\Sushi` trait to a model.
2. Add a `$rows` property to the model.

That's it.

```
class State extends Model
{
    use \Sashimi\Sushi;

    protected $rows = [
        [
            'abbr' => 'NY',
            'name' => 'New York',
        ],
        [
            'abbr' => 'CA',
            'name' => 'California',
        ],
    ];
}
```

Now, you can use this model anywhere you like, and it will behave as if you created a table with the rows you provided.

```
$stateName = State::whereAbbr('NY')->first()->name;
```

This is really useful for "Fixture" data, like states, countries, zip codes, user\_roles, sites\_settings, etc...

### Relationships

[](#relationships)

Let's say you created a `Role` model, based on an array using Sushi, that looked like this:

```
class Role extends Model
{
    use \Sashimi\Sushi;

    protected $rows = [
        ['id' => 1, 'label' => 'admin'],
        ['id' => 2, 'label' => 'manager'],
        ['id' => 3, 'label' => 'user'],
    ];
}
```

You can add a relationship to another standard model, just like you normally would:

```
class User extends Model
{
    ...

    public function role()
    {
        return $this->belongsTo(Role::class);
    }
}
```

Assuming the `users` table has a `role_id` column, you can do things like this:

```
// Grab a User.
$user = User::first();
// Grab a Role.
$role = Role::whereLabel('admin')->first();

// Associate them.
$user->role()->associate($role);

// Access like normal.
$user->role;

// Eager load.
$user->load('role');
User::with('role')->first();
```

> Note: There is one caveat when dealing with Sushi model relationships. The `whereHas` method will NOT work. This is because the two models are spread across two separate databases.

### Custom Schema

[](#custom-schema)

If Sushi's schema auto-detection system doesn't meet your specific requirements for the supplied row data, you can customize them with the `$schema` property or the `getSchema()` method.

```
class Products extends Model
{
    use \Sashimi\Sushi;

    protected $rows = [
        ['name' => 'Lawn Mower', 'price' => '226.99'],
        ['name' => 'Leaf Blower', 'price' => '134.99'],
        ['name' => 'Rake', 'price' => '9.99'],
    ];

    protected $schema = [
        'price' => 'float',
    ];
}
```

How It Works
------------

[](#how-it-works)

Under the hood, this package creates and caches a SQLite database JUST for this model. It creates a table and populates the rows. If, for whatever reason, it can't cache a .sqlite file, it will default to using an in-memory sqlite database.

Using -&gt;getRows()
--------------------

[](#using--getrows)

You can optionally opt out of using the `protected $rows` property, and directly implement your own `getRows()` method.

This will allow you to determine the rows for the model at runtime. You can even generate the model's rows from an external source like a third-party API.

> Note: If you choose to use your own -&gt;getRows() method, the rows will NOT be cached between requests.

```
class Role extends Model
{
    use \Sashimi\Sushi;

    public function getRows()
    {
        return [
            ['id' => 1, 'label' => 'admin'],
            ['id' => 2, 'label' => 'manager'],
            ['id' => 3, 'label' => 'user'],
        ];
    }
}
```

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 76.9% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~21 days

Recently: every ~42 days

Total

10

Last Release

2108d ago

Major Versions

v1.1.2 → v2.0.02020-03-04

v2.0.0 → v3.0.12020-07-31

### Community

Maintainers

![](https://www.gravatar.com/avatar/672fbfa799365c6b8e334b066ad674e06ed4c6d68536ad2fe9be3bd565b5c601?d=identicon)[OwenMelbz](/maintainers/OwenMelbz)

---

Top Contributors

[![calebporzio](https://avatars.githubusercontent.com/u/3670578?v=4)](https://github.com/calebporzio "calebporzio (60 commits)")[![OwenMelbz](https://avatars.githubusercontent.com/u/1094740?v=4)](https://github.com/OwenMelbz "OwenMelbz (7 commits)")[![ErickZH](https://avatars.githubusercontent.com/u/14044588?v=4)](https://github.com/ErickZH "ErickZH (2 commits)")[![Flynsarmy](https://avatars.githubusercontent.com/u/334808?v=4)](https://github.com/Flynsarmy "Flynsarmy (2 commits)")[![eckelarsson](https://avatars.githubusercontent.com/u/2752093?v=4)](https://github.com/eckelarsson "eckelarsson (1 commits)")[![ce-brex](https://avatars.githubusercontent.com/u/28264129?v=4)](https://github.com/ce-brex "ce-brex (1 commits)")[![shadoWalker89](https://avatars.githubusercontent.com/u/1449151?v=4)](https://github.com/shadoWalker89 "shadoWalker89 (1 commits)")[![incredimike](https://avatars.githubusercontent.com/u/125589?v=4)](https://github.com/incredimike "incredimike (1 commits)")[![caneco](https://avatars.githubusercontent.com/u/502041?v=4)](https://github.com/caneco "caneco (1 commits)")[![randy-allen](https://avatars.githubusercontent.com/u/35460788?v=4)](https://github.com/randy-allen "randy-allen (1 commits)")[![davidpiesse](https://avatars.githubusercontent.com/u/800650?v=4)](https://github.com/davidpiesse "davidpiesse (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/owenmelbz-sashimi/health.svg)

```
[![Health](https://phpackages.com/badges/owenmelbz-sashimi/health.svg)](https://phpackages.com/packages/owenmelbz-sashimi)
```

###  Alternatives

[watson/validating

Eloquent model validating trait.

9723.3M46](/packages/watson-validating)[cybercog/laravel-love

Make Laravel Eloquent models reactable with any type of emotions in a minutes!

1.2k302.7k1](/packages/cybercog-laravel-love)[cviebrock/eloquent-taggable

Easy ability to tag your Eloquent models in Laravel.

567694.8k3](/packages/cviebrock-eloquent-taggable)[clickbar/laravel-magellan

This package provides functionality for working with the postgis extension in Laravel.

423715.4k1](/packages/clickbar-laravel-magellan)[genealabs/laravel-pivot-events

This package introduces new eloquent events for sync(), attach(), detach() or updateExistingPivot() methods on BelongsToMany relation.

1404.9M8](/packages/genealabs-laravel-pivot-events)[reedware/laravel-relation-joins

Adds the ability to join on a relationship by name.

2121.2M13](/packages/reedware-laravel-relation-joins)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
