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

Getting Started

Minimal Setup

  1. Installation

    composer require wpstarter/c-sushi
    

    Publish the package config (if available):

    php artisan vendor:publish --provider="WpStarter\CSushi\CSushiServiceProvider"
    
  2. Basic Usage Register the package in config/app.php under providers:

    WpStarter\CSushi\CSushiServiceProvider::class,
    
  3. First Use Case Use the facade to generate a simple sushi recipe (hypothetical example):

    use WpStarter\CSushi\Facades\CSushi;
    
    $recipe = CSushi::make('vegetable')
        ->addIngredient('avocado')
        ->addIngredient('cucumber')
        ->roll();
    

Implementation Patterns

Core Workflows

  1. Recipe Generation

    • Use the fluent interface to define recipes:
      $sushi = CSushi::make('type')
          ->addIngredient('ingredient1')
          ->addIngredient('ingredient2')
          ->addTopping('topping1')
          ->roll();
      
    • Extend with custom recipe types via service providers.
  2. Integration with WpStarter

    • If wpstarter/c-sushi is a plugin for WpStarter, integrate it into your WpStarter-based project:
      // Example: Add sushi recipes to a menu
      $menu = new \WpStarter\Menu\Menu();
      $menu->addItem('sushi', CSushi::make('vegetable')->roll());
      
  3. Dependency Injection

    • Bind custom sushi types in a service provider:
      $this->app->bind('sushi.type.custom', function () {
          return new \WpStarter\CSushi\Recipes\CustomSushi();
      });
      
  4. Command-Line Usage

    • Use Artisan commands (if provided) for bulk operations:
      php artisan sushi:generate --type=vegetable --ingredients=avocado,cucumber
      

Gotchas and Tips

Common Pitfalls

  1. Missing Config

    • If the package lacks a published config file, check for defaults in config/c-sushi.php (create it if missing).
    • Example default config:
      return [
          'default_type' => 'vegetable',
          'ingredients' => [
              'vegetable' => ['avocado', 'cucumber'],
              'salmon' => ['raw_salmon'],
          ],
      ];
      
  2. Recipe Validation

    • Some recipes may require specific ingredients. Validate before rolling:
      if (!CSushi::validateRecipe('vegetable', ['avocado'])) {
          throw new \InvalidArgumentException("Invalid recipe ingredients.");
      }
      
  3. Namespace Conflicts

    • If CSushi conflicts with other facades, use the fully qualified class name:
      \WpStarter\CSushi\Facades\CSushi::make('type');
      
  4. Laravel Version Compatibility

    • The package may not support Laravel 10+. Check composer.json for laravel/framework constraints.

Debugging Tips

  • Log Recipe Steps Enable debug mode in config:

    'debug' => env('SUSHI_DEBUG', false),
    

    Then inspect logs for recipe generation steps.

  • Override Defaults Extend the base Sushi class to customize behavior:

    namespace App\Extensions;
    
    use WpStarter\CSushi\Sushi;
    
    class CustomSushi extends Sushi {
        public function addSauce($sauce) {
            $this->ingredients[] = $sauce;
            return $this;
        }
    }
    

Extension Points

  1. Custom Recipes Create new recipe classes by extending WpStarter\CSushi\Recipes\BaseRecipe:

    namespace App\Recipes;
    
    use WpStarter\CSushi\Recipes\BaseRecipe;
    
    class SpicyTuna extends BaseRecipe {
        protected $type = 'spicy_tuna';
        protected $ingredients = ['tuna', 'spicy_mayo'];
    }
    
  2. Service Provider Hooks Register custom recipes in a service provider’s boot method:

    public function boot() {
        CSushi::extend('spicy_tuna', function () {
            return new \App\Recipes\SpicyTuna();
        });
    }
    
  3. Event Listeners Listen for sushi-related events (if the package emits them):

    \Event::listen('sushi.rolled', function ($sushi) {
        \Log::info("Sushi rolled: {$sushi->type}");
    });
    
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