Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

C Sushi Laravel Package

wpstarter/c-sushi

Use Eloquent models backed by in-memory arrays instead of a database. Add the Sushi trait and a $rows dataset, then query, relate, eager load, and even validate with exists rules—great for fixture data like states, roles, and settings.

View on GitHub
Deep Wiki
Context7

Sushi for WpStarter

Frequently asked questions about C Sushi
How do I use c-sushi in a Laravel project to replace database fixtures?
Install via Composer (`composer require calebporzio/sushi`), then add the `Sushi` trait to a model and define your static data in a `$rows` array. Query it like a database table—ideal for states, countries, or config-driven records without migrations.
Does c-sushi work with Laravel 10+? What versions are supported?
The package is designed for modern Laravel (tested with recent versions). Check the [GitHub repo](https://github.com/wpstarter/c-sushi) for exact compatibility, but it leverages Eloquent’s core features, so it should work with Laravel 8+.
Can I use c-sushi in WordPress with WpStarter? Will it conflict with Laravel dependencies?
Yes, but with caution. If your WordPress project uses Laravel’s service container (e.g., via `laravel-wordpress-polyfill`), it may work. Otherwise, isolate it to WpStarter environments or use standalone PHP classes to avoid autoload conflicts.
How do relationships work between Sushi models and regular Eloquent models?
Relationships function normally (e.g., `belongsTo`, `hasMany`), but `whereHas` won’t work since Sushi models are in-memory. Use `associate()`, eager loading (`with()`), and direct queries like `whereLabel('admin')->first()` for associations.
Is c-sushi suitable for production? Any performance concerns?
Yes, it’s lightweight and memory-efficient for static data. Avoid heavy operations like `whereHas` or complex joins. For large datasets, consider caching or splitting into smaller models to minimize memory usage.
How do I validate data against Sushi models in Laravel forms?
Use Laravel’s `exists:` validation rule (e.g., `'role_id' => 'required|exists:roles,id'`). The package mimics database behavior, so standard validation rules work seamlessly for in-memory data.
Are there alternatives to c-sushi for static data in Laravel?
Yes. For simple cases, use Laravel’s `config()` or `cache()` with static arrays. For Eloquent-like behavior, consider `spatie/laravel-model-states` or `laravel-shift/eloquent-static`. For WordPress, `wpdb` with custom tables is often lighter.
Can I extend Sushi models with custom query scopes or accessors?
Absolutely. Add scopes or accessors to your model class like normal Eloquent models. For example, `public function scopeActive($query) { return $query->where('status', 'active'); }` works as expected.
What’s the maintenance status of c-sushi? Is it actively updated?
The package is now open-source (previously sponsorware) and appears stable. Check the [GitHub repo](https://github.com/wpstarter/c-sushi) for updates, but since it’s a utility, major changes are unlikely. Always test in staging first.
How do I test Sushi models in PHPUnit? Do I need a database?
No database is needed. Write unit tests by instantiating models directly and asserting results. Example: `$state = new State(); $this->assertEquals('New York', $state->whereAbbr('NY')->first()->name);`. Mock relationships if required.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
andydefer/laravel-cluster
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky
spatie/mailcoach-vapor
spatie/laravel-javascript-views