Sushi is a Laravel package that provides Eloquent's missing "array" driver, allowing you to use Eloquent models backed by in-memory or cached SQLite databases instead of traditional database tables.
The package solves the problem of needing Eloquent's query interface and relationship features for static or fixture data without setting up a database. It works by having you add the Sushi trait to a model and define a $rows property containing your data. The package then automatically creates and caches a SQLite database for that model, populating it with the supplied rows. If caching is unavailable, it falls back to an in-memory SQLite database. You can also implement a custom getRows() method to determine rows at runtime, even fetching them from external sources like APIs, with optional caching support.
Sushi suits projects that need to work with fixture data such as states, countries, zip codes, user roles, or site settings. It is particularly valuable when you want to leverage Eloquent's query syntax and relationships without database overhead. The tool supports standard Eloquent relationships to other models, database validation rules using the exists rule with fully-qualified model namespaces, and custom schema definition via a $schema property or getSchema() method. One important limitation is that the whereHas method does not work with Sushi models because they exist in a separate SQLite database from related models. The package requires the pdo-sqlite PHP extension.
The project maintains a caching system that monitors the last modified timestamp of your model file and automatically rebuilds the SQLite cache when the model changes, or you can configure an external file for cache invalidation. The tool supports advanced customization through an afterMigrate method, allowing you to add indexes or other table modifications after creation. The package originated as sponsorware and transitioned to fully open source after reaching its sponsorship goal.