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

Withable Laravel Package

jedrzej/withable

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Dynamic API/Backend Flexibility: Enables developers to expose granular control over eager-loaded relationships via query parameters, reducing frontend complexity and improving performance by avoiding N+1 queries.
  • Roadmap for API-Driven Features: Supports future plans for self-service data fetching (e.g., admin dashboards, third-party integrations, or headless CMS) where clients need to specify related data dynamically.
  • Build vs. Buy: Avoids reinventing eager-loading logic, saving dev time while maintaining consistency with Laravel’s conventions.
  • Use Cases:
    • Admin Panels: Let admins toggle nested data (e.g., ?with=users,posts,comments).
    • Public APIs: Enable clients to request only the data they need (e.g., ?with=author,tags).
    • Performance Optimization: Reduce over-fetching in complex queries by letting consumers specify relationships.

When to Consider This Package

  • Adopt if:
    • Your Laravel app uses Eloquent models with nested relationships that need dynamic eager-loading.
    • You’re building an API or admin interface where clients/developers should control data depth.
    • You prioritize developer velocity over custom solutions (e.g., manual with() logic in controllers).
    • Your team is already using Laravel 4–6 (compatibility is limited to these versions).
  • Look elsewhere if:
    • You need real-time filtering/sorting alongside eager-loading (consider Pimpable or building a custom solution).
    • Your app uses Laravel 7+ (package is unmaintained; check for forks or alternatives like spatie/laravel-query-builder).
    • You require complex relationship conditions (e.g., conditional with() clauses) beyond simple string matching.
    • Security is a concern: The package lacks input validation by default (you’ll need to sanitize with parameters manually).

How to Pitch It (Stakeholders)

For Executives: "This package lets our backend dynamically serve nested data based on client requests—like a ‘choose-your-own-adventure’ for API responses. For example, an admin could fetch a Post with its author and comments by simply appending ?with=author,comments to the URL. This reduces frontend work, cuts unnecessary data transfer, and future-proofs our APIs for third-party integrations. It’s a low-risk, high-reward way to add flexibility without reinventing the wheel."

For Engineering: "The Withable trait lets us declaratively expose eager-loading via query params, cutting boilerplate in controllers. For a model like Post, we define allowed relations (e.g., ['author', 'tags']), and the package handles the rest. It’s lightweight, Laravel-native, and integrates seamlessly with existing Eloquent queries. Tradeoffs:

  • No built-in validation (add middleware to sanitize with params).
  • Limited to Laravel 4–6 (but works for most legacy apps).
  • Pair with Pimpable if you also need sorting/filtering.

Example use case: Replace Post::with(['author', 'comments'])->get() with Post::with(Request::input('with'))->get() in your API routes."

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.
daikazu/eloquent-salesforce-objects
unseen-codes/chat
romalytar/yammi-jobs-monitoring-laravel
kisame76/filament-db-table-state
nqxcode/laravel-lucene-search
dpfx/laravel-livewire-wizards
workos/workos-php-laravel
sofa/laravel-global-scope
nawasara/auth-primitives
adhocrat-io/arkhe-main
make-dev/orca-harpoon
itsemon245/lamet
baks-dev/dashboard
amoifr/pickle-panther-bundle
make-dev/orca
dmstr/symfony-system-resources-bundle
dmstr/symfony-job-queue-bundle
dmstr/openapi-json-schema-bundle
dmstr/keycloak-security-bundle
dmstr/doctrine-audit-log-bundle