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

Shizuku Feature Flags Laravel Package

devexploris/shizuku-feature-flags

Symfony bundle to manage feature flags stored in Doctrine ORM. Toggle features from the database, check flags in PHP via FeatureFlagService or in Twig with the feature() function, and manage flags with CLI commands to list, create, enable, and disable.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture Fit

  • Symfony-Laravel Misalignment: The package is Symfony-specific (Doctrine ORM, Symfony Cache, Symfony Profiler, and Twig), making it a poor fit for Laravel’s Eloquent ORM, Laravel Cache, and Blade templating. Direct integration would require significant abstraction or refactoring.
  • Feature Flag Paradigm Fit: The lifecycle model (create → toggle → lock → delete) and boolean toggles align well with Laravel’s feature flag needs, but the implementation details diverge.
  • Caching Strategy: The 300s TTL with cache invalidation on state changes is reasonable, but Laravel’s cache drivers (e.g., Redis, database) may require custom logic for invalidation.
  • Twig vs. Blade: The Twig integration is a blocker for Laravel, as Blade does not support global functions natively. A custom Blade directive or helper would be needed.
  • Profiler Dependency: Symfony Profiler is non-existent in Laravel, requiring replacement with Laravel Debugbar or a custom admin panel.

Integration Feasibility

  • Low Feasibility Without Refactoring: Direct use is not viable due to Symfony dependencies. A fork or rewrite is necessary to:
    • Replace Doctrine ORM with Eloquent.
    • Replace Symfony Cache with Laravel Cache.
    • Replace Twig with Blade directives or a helper.
    • Replace Symfony Profiler with Laravel Debugbar or a custom solution.
  • Migration Path:
    1. Fork the Repository: Create a Laravel-compatible branch.
    2. Replace ORM: Convert Doctrine entities to Eloquent models (e.g., DateTimeImmutable → Carbon, query builder → Eloquent queries).
    3. Replace Cache: Adapt cache invalidation logic to Laravel’s cache drivers (e.g., tags or manual invalidation).
    4. Replace Twig: Implement a Blade-compatible helper (e.g., @feature('flag_name')).
    5. Replace Profiler: Integrate with Laravel Debugbar or build a custom admin panel.
    6. Replace Console Commands: Rewrite Artisan commands (e.g., php artisan shizuku:flag:create).
  • Compatibility Gaps:
    • No Laravel-Specific Features: Missing integrations with Laravel’s ecosystem (e.g., Scout for caching, Livewire for frontend toggles).
    • Artisan vs. Symfony Console: Laravel’s Artisan commands lack interactive prompts by default, requiring customization.
    • Testing Complexity: Validating the adapted package with Laravel’s frontend (Vite, Blade) and backend (Queues, Events) adds uncertainty.

Key Questions

  1. Is a Fork Justified?
    • Would the effort to rewrite for Laravel outweigh the benefits of using a pre-built Symfony package?
    • Are there existing Laravel feature flag packages (e.g., Spatie’s) that already solve this problem?
  2. What Are the Performance Implications?
    • How will Laravel’s cache drivers (e.g., Redis) handle the 300s TTL and invalidation logic?
    • Will Eloquent queries perform comparably to Doctrine for flag lookups?
  3. How Will Frontend Integration Work?
    • Can Blade directives or helpers replicate Twig’s global feature() function?
    • Will Livewire/Inertia support be needed for real-time flag updates?
  4. What About Multi-Tenancy?
    • Does the package support tenant-specific flags? If not, how would Laravel’s multi-tenant setups (e.g., Eloquent’s tenant()) integrate?
  5. What’s the Fallback Plan?
    • If the fork fails, what are the alternatives (e.g., Spatie’s package, custom solution)?

Integration Approach

Stack Fit

  • Laravel Incompatibility: The package is not natively compatible with Laravel due to:
    • ORM: Doctrine ORM vs. Eloquent.
    • Cache: Symfony Cache vs. Laravel Cache.
    • Templating: Twig vs. Blade.
    • Console: Symfony Console vs. Artisan.
  • Workarounds:
    • Option 1: Abstraction Layer: Create a Laravel facade to translate Symfony services (e.g., FeatureFlagService) into Laravel services, but this would be fragile and require ongoing maintenance.
    • Option 2: Fork and Refactor: Rewrite the package for Laravel, targeting:
      • Eloquent models instead of Doctrine entities.
      • Laravel Cache (Redis, database) with custom invalidation.
      • Blade directives or helpers instead of Twig.
      • Artisan commands instead of Symfony Console.
      • Laravel Debugbar or a custom panel instead of Symfony Profiler.
    • Option 3: Hybrid Approach: Use the package as inspiration to build a custom Laravel package with similar features but native integrations.

Migration Path

  1. Assess Alternatives:
    • Evaluate existing Laravel packages (e.g., Spatie’s Laravel Feature Flags) to avoid reinventing the wheel.
    • If no suitable alternative exists, proceed with a fork.
  2. Fork the Repository:
    • Clone the package and create a Laravel-specific branch.
    • Update composer.json to target Laravel’s dependencies (e.g., laravel/framework, illuminate/database).
  3. Replace Doctrine ORM:
    • Convert FeatureFlag entity to an Eloquent model.
    • Replace Doctrine queries with Eloquent queries (e.g., RepositoryModel::query()).
    • Handle DateTimeImmutable → Carbon conversions.
  4. Replace Symfony Cache:
    • Replace FeatureFlagService’s cache dependency with Laravel Cache (Cache::tags() or manual invalidation).
    • Ensure cache invalidation triggers on flag state changes (e.g., via model events).
  5. Replace Twig with Blade:
    • Create a Blade directive (e.g., @feature('flag_name')) or a helper (e.g., feature('flag_name')).
    • Ensure the helper integrates with Laravel’s service container.
  6. Replace Symfony Profiler:
    • Integrate with Laravel Debugbar or build a custom admin panel (e.g., using Laravel’s tools package or a dedicated route).
    • Add a dashboard to list flags, their states, and warnings for locked/unknown flags.
  7. Replace Console Commands:
    • Rewrite Symfony Console commands as Artisan commands (e.g., php artisan shizuku:flag:create).
    • Adapt interactive prompts to Laravel’s Artisan style (e.g., using Symfony/Console or Laravel’s Prompt helpers).
  8. Testing:
    • Test with Laravel’s testing tools (e.g., PHPUnit, Pest).
    • Validate integrations with Laravel’s frontend (Blade, Livewire) and backend (Queues, Events).
  9. Documentation:
    • Update README and docs for Laravel-specific usage (e.g., Blade syntax, Artisan commands).
    • Provide migration guides for existing Symfony users.

Compatibility

  • ORM: Eloquent’s query builder is similar but not identical to Doctrine’s, requiring rewrites for complex queries (e.g., joins, subqueries).
  • Cache: Laravel Cache supports tags and manual invalidation, but the 300s TTL may need adjustment for high-frequency use cases.
  • Templating: Blade directives are less flexible than Twig’s global functions but can be implemented with Laravel’s directive system.
  • Console: Artisan commands are more limited than Symfony Console for interactive prompts, but libraries like Symfony/Console can bridge the gap.
  • Profiler: Laravel Debugbar or a custom panel can replicate Symfony Profiler’s functionality but may lack some features (e.g., toolbar highlights).

Sequencing

  1. Phase 1: Core Functionality
    • Fork the repository.
    • Replace Doctrine with Eloquent.
    • Replace Symfony Cache with Laravel Cache.
    • Implement basic flag CRUD via Eloquent and Artisan.
  2. Phase 2: Frontend Integration
    • Add Blade directives/helpers for templating.
    • Test with Laravel’s frontend stack (Blade, Livewire).
  3. Phase 3: Observability
    • Integrate with Laravel Debugbar or build a custom panel.
    • Add warnings for locked/unknown flags.
  4. Phase 4: Polish
    • Optimize cache invalidation.
    • Add multi-tenancy support (if needed).
    • Write comprehensive tests and docs.

Operational Impact

Maintenance

  • High Ongoing Effort:
    • A forked package would require dual maintenance (Symfony and Laravel branches) unless the original package is abandoned.
    • Laravel-specific bugs (e.g., Eloquent quirks, Blade edge cases) would need patching.
    • Dependency updates (e.g., Laravel 10+, PHP 8.3+) would require testing.
  • Alternative: A custom Laravel package would simplify maintenance but require building from scratch.

Support

  • Limited Community Support:
    • The original package has 1 star and 0 dependents, indicating low adoption. Laravel-specific issues would lack community solutions.
    • Symfony-specific documentation (e.g., Profiler, Twig) would be irrelevant
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.
terminal42/code-quality-tools
codifyo/ts-generator-bundle
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