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

Conditionable Laravel Package

illuminate/conditionable

Add fluent, chainable conditional logic to Laravel objects. The Conditionable trait provides when/unless helpers to apply callbacks only when conditions are met, keeping pipelines and builders clean and readable without scattered if/else blocks.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Enables clean, chainable conditional logic in Eloquent models, collections, and service layers, reducing boilerplate code and improving readability.
  • Supports roadmap priorities for maintainable codebases by minimizing nested conditionals, accelerating feature development and reducing technical debt.
  • Eliminates the need for third-party packages for conditional operations (build vs buy), as it’s a core Laravel feature included in illuminate/support.
  • Use cases include dynamic query building, conditional data transformations, and context-aware logic in controllers/jobs without breaking method chains.

When to Consider This Package

  • Adopt when building Laravel applications requiring expressive, chainable conditional logic in data processing (e.g., filtering collections based on user roles, conditional API responses).
  • Consider when code readability and maintainability are critical for long-term scalability, especially in complex workflows with multiple conditional steps.
  • Look elsewhere if the project uses a non-Laravel stack (e.g., Symfony, plain PHP), or for trivial conditions where a standard if/else is more straightforward (e.g., single-line checks without chaining).

How to Pitch It (Stakeholders)

  • Executives: "This built-in Laravel feature streamlines development by reducing code complexity and bugs, cutting feature delivery time by up to 20% while ensuring cleaner, more maintainable code. It’s zero-cost since it’s part of the framework, directly supporting our goals of faster releases and lower maintenance overhead."
  • Engineering: "Conditionable simplifies conditional logic in method chains—like when() and unless()—eliminating nested if statements and improving readability. It’s battle-tested, requires no extra dependencies, and integrates seamlessly with Laravel’s ecosystem, making it ideal for dynamic data processing in models, collections, and services."
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.
apiboxsym/user-bundle
apiboxsym/health-check-bundle
jayeshmepani/jpl-moshier-ephemeris-php
elnasnato/laraliveui
labrodev/rest-sdk
sampaui/sampaui
babelqueue/php-sdk
facebook/capi-param-builder-php
babelqueue/symfony
hamzi/corewatch
minionfactory/raw-hydrator
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui