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 Findby Laravel Package

someonefamous/laravel-findby

Add dynamic finders to Eloquent models: call User::findByLastName('Smith') or User::findAllByFirstName('Bob') instead of where()->first()/get(). Works with any snake_cased field name via the FindBy trait.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Developer Productivity: Reduces boilerplate in Eloquent queries by enabling intuitive findBy* methods (e.g., User::findByLastName()) instead of manual where()->first() chains. Aligns with goals to simplify common CRUD operations for backend teams.
  • Consistency in Query Patterns: Standardizes query syntax across models, reducing cognitive load for developers unfamiliar with the codebase. Supports internal conventions (e.g., "always use findBy* for readability").
  • Roadmap for Query Abstraction: Justifies further investment in query DSLs (Domain-Specific Languages) or internal libraries if this package proves popular. Could serve as a proof-of-concept for custom query builders.
  • Build vs. Buy: Buy for teams prioritizing short-term velocity over long-term customization. Build if needing advanced features (e.g., dynamic field names, nested queries) or Laravel-specific optimizations.
  • Use Cases:
    • Internal admin panels where ad-hoc queries dominate.
    • Legacy codebases with repetitive where()->first() patterns.
    • Prototyping phases where query syntax clarity is critical.

When to Consider This Package

  • Adopt if:

    • Your team frequently writes where()->first() or where()->get() queries for simple lookups.
    • You prioritize readability over micro-optimizations (e.g., this adds negligible performance overhead).
    • Your Laravel version is 8+ (compatible with illuminate/support:>=5).
    • You’re okay with MIT-licensed third-party dependencies (no proprietary risks).
    • Your models use snake_case field names (default in Laravel).
  • Look elsewhere if:

    • You need dynamic field names at runtime (this requires hardcoding findByFieldName methods).
    • Your queries involve complex joins, subqueries, or aggregations (this is for simple where clauses only).
    • You’re using Laravel < 5.5 (compatibility not guaranteed).
    • Your team prefers type safety (this adds runtime method calls vs. IDE autocomplete for where()).
    • You have strict dependency budgets (3 stars, last release in 2021 may raise maintenance concerns).
    • You need enterprise support (MIT license = community-driven).

How to Pitch It (Stakeholders)

For Executives:

"This package lets our backend team write database queries in plain English—e.g., User::findByLastName('Smith') instead of User::where('last_name', 'Smith')->first(). It’s a 10-minute setup that could save hours weekly by reducing repetitive code. Low risk (MIT license, minimal dependencies), high reward for developer happiness and velocity. Ideal for admin panels or legacy systems where query clarity is critical."

For Engineering:

*"Pros:

  • Cleaner code: Replaces verbose where()->first() chains with intuitive findBy* methods.
  • Zero performance cost: Just syntactic sugar over existing Eloquent.
  • Easy to adopt: One trait per model, works with any snake_case field.

Cons:

  • Not production-ready for complex queries (stick to where() for joins/aggregations).
  • Last updated in 2021—monitor for Laravel 10+ compatibility.
  • No tests in wild: Limited adoption (3 stars) may mean edge cases untested.

Recommendation: Pilot in a non-critical module (e.g., admin dashboard) to measure dev productivity gains. If successful, standardize across new models. Avoid for high-performance APIs or mission-critical queries."*


Note: Emphasize that this is a developer experience (DX) tool, not a performance or security feature. Pair with a trial period to assess impact.

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.
craftcms/url-validator
directorytree/privacy-filter-classifier
directorytree/privacy-filter
datacore/hub-sdk
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony
develia/geo-bundle
dreamzy/livewire-charts
touchestate-sdk/php-sdk
22h/doctrine-garbage-collection-bundle
agtp/agtp-php
agtp/mod-php
splash/sonata-admin
splash/metadata
splash/openapi
splash/scopes
splash/toolkit
testo/output-teamcity
testo/bridge-symfony