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

Laravel Options Laravel Package

spatie/laravel-options

Generate unified select option lists in Laravel from enums, Eloquent models, states, and arrays. Spatie laravel-options converts sources to a consistent label/value structure, supports customization via config, and makes building dropdowns and filters faster and cleaner.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Unified UX for dropdowns/selects: Standardize option formatting (label/value pairs) across enums, database records, or static arrays, reducing frontend/back-end inconsistency.
  • Accelerated MVP development: Quickly scaffold dropdowns for admin panels, user settings, or forms without manual option mapping.
  • Enum-first architecture: Align with modern PHP practices (enums) while maintaining backward compatibility with legacy arrays/models.
  • Roadmap for dynamic forms: Enable runtime option generation (e.g., fetching user roles from DB) without hardcoding values.
  • Build vs. Buy: Avoid reinventing option-parsing logic; leverage Spatie’s battle-tested package (MIT license) instead of custom solutions.

When to Consider This Package

  • Adopt if:

    • Your app has >5 dropdowns with repetitive option formatting (enums, models, or arrays).
    • You prioritize developer velocity over micro-optimizations (e.g., performance-critical dropdowns).
    • Your team uses Laravel and PHP 8.1+ (enums support).
    • You need consistent option structures for APIs, Blade templates, or frontend frameworks (React/Vue).
  • Look elsewhere if:

    • You require highly customized option rendering (e.g., nested options, async loading).
    • Your dropdowns are static and hardcoded (no dynamic sources like DB queries).
    • You’re using non-Laravel PHP or need multi-language support (package lacks i18n features).
    • Performance is critical (package adds minimal overhead but isn’t optimized for 10K+ options).

How to Pitch It (Stakeholders)

For Executives: "This package lets us build consistent, maintainable dropdowns faster—imagine cutting 20% of the time spent manually mapping enums or database records to select options. It’s like a ‘copy-paste’ for form UIs, reducing bugs and tech debt. Low risk (MIT license, Spatie’s track record), high reward for admin panels, user settings, or any form-heavy feature."

For Engineers: *"Spatie’s laravel-options unifies option formatting (label/value) for enums, Eloquent models, or arrays into a single API call. Example:

Options::forEnum(UserRole::class)->toArray();
// Returns: [{label: 'Admin', value: 'admin'}, ...]
  • Pros: DRY, type-safe (PHP 8.1+ enums), zero config for 80% of use cases.
  • Cons: Not for async data or complex hierarchies. Tradeoff: speed vs. flexibility.
  • Next steps: Add to composer.json, replace 3 manual dropdown mappings in the admin panel by EOD."*
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.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport