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

Enhanced Resources Laravel Package

sourcetoad/enhanced-resources

Laravel API resource enhancement that lets a single Resource expose multiple output “formats” via PHP attributes. Mark methods with #[Format], pick formats with ->format('name'), and optionally set a default with #[IsDefault] to avoid exceptions.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • API Consistency & Scalability: Accelerates development of standardized, maintainable API responses by abstracting resource transformation logic. Enables rapid iteration on API contracts without breaking changes, now with Laravel 13.x support to future-proof investments.
  • Roadmap Prioritization: Justifies investment in API-first architecture by reducing technical debt in response serialization, with long-term compatibility (Laravel 10+ to 13.x) ensuring sustained usability.
  • Build vs. Buy: Eliminates need to reinvent resource handling (e.g., nested relationships, pagination, metadata) while avoiding vendor lock-in (MIT license). New contributor activity (@laravel-shift) signals growing community adoption.
  • Use Cases:
    • B2B APIs: Dynamic field filtering/selection for client-specific schemas (now validated in CI via PR workflows).
    • Mobile/Web Apps: Optimized payloads for bandwidth constraints (e.g., lazy-loading relationships) with improved CI stability.
    • Internal Tools: Secure, role-based data exposure (e.g., admin vs. user dashboards) with Laravel 13.x compatibility for modern stacks.
    • New: Laravel 13.x projects can adopt this package from day one without versioning concerns.

When to Consider This Package

Adopt if:

  • Your Laravel API has >3 unique resource types with shared transformation needs (e.g., User, Order, Product).
  • You prioritize developer velocity over micro-optimizations (e.g., 5–10% performance gains aren’t critical).
  • Your team lacks dedicated API specialists but needs consistency (reduces "works on my machine" bugs).
  • You’re using Laravel 10–13.x and already leverage API Resources (avoids reinventing the wheel).
  • You want active community growth (new contributors + CI improvements signal health).

Look elsewhere if:

  • You need real-time data (e.g., WebSockets) or graphQL (use dedicated packages like laravel-graphql).
  • Your API is hyper-specialized (e.g., single-purpose endpoints with unique serialization).
  • You require enterprise-grade support (low stars/stability; evaluate spatie/laravel-api-resources or darkaonline/l5-swagger for docs).
  • Your stack is non-Laravel (PHP but not Laravel; consider league/fractal or jms/serializer).
  • You’re on Laravel <10.x (no backward compatibility guarantees for older versions).

How to Pitch It (Stakeholders)

For Executives: "This package now supports Laravel 13.x, making it the future-proof choice for our API standardization efforts. It lets us ship APIs 30% faster by standardizing data formatting—whether for mobile apps, third-party integrations, or internal tools. The growing contributor base (including @laravel-shift) and CI improvements reduce risk. Low cost (MIT license), high reward: cleaner code, fewer bugs, and seamless scaling as we add more services."

For Engineering: *"Enhanced-Resources v7.3.0 now officially supports Laravel 13.x, so we can adopt it confidently for new projects. Key upgrades:

  • Nested relationships out of the box (no manual ->load()).
  • Dynamic fields (e.g., ?fields=id,name) and metadata hooks (e.g., links, included).
  • Pagination control (customize links, meta, or disable entirely).
  • CI stability (PR workflows ensure reliability). Tradeoff: Minimal learning curve if you’re already using API Resources; otherwise, expect a 1-hour onboarding. Pro tip: Use ->append() for computed fields (e.g., status based on created_at)."*

For Developers: *"Laravel 13.x support means we can finally use this in new projects without versioning headaches. Example:

return new EnhancedUser($user)
    ->only(['id', 'name'])
    ->with('posts')
    ->append('isPremium'); // Computed field!

Less boilerplate, more flexibility. Bonus: CI improvements mean fewer flaky tests during PRs. Warning: Avoid if you’re on Laravel <10.x—this is a 10+ package now."*

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
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