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

Myrrix Laravel Package

bcc/myrrix

Myrrix is a Laravel/PHP package that helps manage modular application features with a clean structure and tooling. It supports organizing code into modules, simplifying registration and discovery, and keeping large projects maintainable with predictable conventions.

View on GitHub
Deep Wiki
Context7

Getting Started

Minimal Setup

  1. Installation

    composer require bcc/myrrix
    

    Add the package to your config/app.php providers (if not auto-discovered).

  2. Basic Configuration Create a myrrix.php config file in config/:

    return [
        'host' => env('MYRRIX_HOST', 'localhost'),
        'port' => env('MYRRIX_PORT', 8080),
        'timeout' => 5.0,
    ];
    
  3. First Use Case: Fetching Recommendations

    use Bcc\Myrrix\Client;
    
    $client = new Client(config('myrrix'));
    $recommendations = $client->getRecommendations('user:123', 'item:*', 10);
    

Key Entry Points

  • Client Initialization: new \Bcc\Myrrix\Client($config)
  • Core Methods:
    • getRecommendations($userId, $itemIdPattern, $limit)
    • addFeedback($userId, $itemId, $rating)
    • updateItemFeatures($itemId, $features)

Implementation Patterns

Workflow: Real-Time Recommendations

  1. User Interaction → Feedback Loop

    // In your controller
    $recommendations = $client->getRecommendations(
        auth()->id(),
        'category:electronics',
        5
    );
    
    // After user rates an item
    $client->addFeedback(auth()->id(), $ratedItemId, $rating);
    
  2. Batch Processing

    $client->batchFeedback([
        ['userId' => 'user:1', 'itemId' => 'item:101', 'rating' => 5],
        ['userId' => 'user:2', 'itemId' => 'item:102', 'rating' => 3],
    ]);
    

Integration Tips

  • Caching Layer: Cache recommendations for 5-10 minutes to reduce Myrrix load:

    $cacheKey = "recs:{$userId}:{$category}";
    return Cache::remember($cacheKey, now()->addMinutes(10), function() use ($client, $userId, $category) {
        return $client->getRecommendations($userId, $category, 5);
    });
    
  • Queue Delayed Feedback: Use Laravel queues to defer feedback processing:

    FeedbackProcessed::dispatch($userId, $itemId, $rating)->delay(now()->addSeconds(30));
    
  • Feature Updates: Sync item metadata periodically:

    $client->updateItemFeatures('item:123', [
        'price' => 19.99,
        'stock' => 50,
        'category' => 'electronics',
    ]);
    

Gotchas and Tips

Pitfalls

  1. Connection Timeouts

    • Myrrix may hang on large recommendation requests. Set config('myrrix.timeout') to 10.0 for heavy loads.
    • Debug: Check storage/logs/laravel.log for stream_select(): failed errors.
  2. Item ID Patterns

    • Wildcards (*) in getRecommendations() are not supported in all Myrrix versions. Use exact IDs or pre-filter in Laravel:
      $itemIds = Item::where('category', 'electronics')->pluck('myrrix_id');
      $recommendations = $client->getRecommendations('user:123', implode('|', $itemIds), 5);
      
  3. Feedback Throttling

    • Myrrix may reject rapid feedback updates. Implement exponential backoff in your client:
      try {
          $client->addFeedback($userId, $itemId, $rating);
      } catch (\Bcc\Myrrix\Exception\ThrottledException $e) {
          sleep(2 ** $attempt);
          retry();
      }
      

Debugging

  • Enable Verbose Logging

    $client = new Client(config('myrrix'), [
        'debug' => true,
        'log_path' => storage_path('logs/myrrix.log'),
    ]);
    
  • Common Errors:

    Error Cause Fix
    Invalid user ID format Non-string user IDs Ensure IDs are prefixed (e.g., user:123)
    Item not found Typos in item IDs Validate IDs before calling Myrrix
    Serialization failed Non-serializable features Use arrays/JSON strings only

Extension Points

  1. Custom Response Parsing Override the default JSON decoder:

    $client = new Client(config('myrrix'));
    $client->setResponseParser(function ($raw) {
        return json_decode($raw, true, 512, JSON_BIGINT_AS_STRING);
    });
    
  2. Middleware for Requests Add headers or modify payloads:

    $client->addRequestModifier(function ($request) {
        $request->headers->set('X-Custom-Header', 'value');
    });
    
  3. Event Listeners Trigger events after operations:

    $client->onRecommendations(function ($userId, $recommendations) {
        event(new RecommendationsFetched($userId, $recommendations));
    });
    
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.
besmartand-pro/php-quality-config
sentix/ai-chatbot
codifyo/ts-generator-bundle
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