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

Compoships Laravel Package

awobaz/compoships

Adds composite-key relationship support to Laravel Eloquent. Define hasOne/hasMany/belongsTo relations matching two or more columns so eager loading works with legacy or third‑party schemas, using a custom base Model or Compoships trait.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Legacy System Modernization: Enables seamless integration with legacy databases featuring composite keys without requiring schema refactoring, reducing migration costs and technical debt.
  • Multi-Dimensional Relationships: Critical for platforms with complex hierarchies (e.g., SaaS, marketplaces, or enterprise apps) where relationships span multiple dimensions (e.g., user-team-project-category).
  • Third-Party Data Integration: Eliminates the need for custom query logic when connecting to external systems (e.g., ERP, CRM, or legacy databases) with composite-key schemas, accelerating integration timelines.
  • Build vs. Buy Decision: Validates the choice to build (vs. custom development) for composite-key support, reducing ongoing maintenance overhead and leveraging a battle-tested, community-backed solution.
  • Roadmap for Advanced Features: Provides a foundation for future enhancements like dynamic composite relationships, AI-driven data modeling, or real-time sync with external systems.
  • Performance Optimization: Enables efficient eager loading of complex relationships, reducing N+1 query issues in high-traffic applications (e.g., dashboards, analytics, or real-time collaboration tools).
  • Data Governance & Compliance: Supports audit trails and compliance requirements (e.g., GDPR, HIPAA) by maintaining accurate relationship mappings across composite-key tables.

When to Consider This Package

  • Adopt if:

    • Your Laravel application interacts with legacy databases or third-party systems using composite keys (e.g., team_id + category_id).
    • You need to define multi-column relationships (e.g., hasMany, belongsTo, belongsToMany) where Eloquent’s native syntax fails during eager loading.
    • Your roadmap includes complex data models (e.g., multi-tenant SaaS, hierarchical structures, or multi-dimensional categorization).
    • You prioritize developer velocity over custom query logic for composite-key relationships.
    • Your team lacks bandwidth to maintain custom solutions for composite-key relationships.
  • Look elsewhere if:

    • Your database schema already uses single-column primary keys and composite keys are only for relationships (native Eloquent may suffice with where clauses).
    • You require full composite primary key support (e.g., tables where (col1, col2) is the primary key; this package only supports composite relationships, not keys).
    • Your application is highly dynamic and needs runtime-definable relationships (this package requires static relationship definitions).
    • You’re using Laravel Octane or advanced query builders that may conflict with Compoships’ query modifications.
    • Your team prefers zero dependencies and can tolerate custom query logic for composite relationships.

How to Pitch It (Stakeholders)

For Executives:

"Compoships solves a critical gap in Laravel’s Eloquent ORM by enabling seamless multi-column relationships—critical for integrating with legacy systems, scaling complex SaaS platforms, or accelerating third-party data connections. By adopting this package, we avoid costly schema refactoring, reduce development time by 30–50% for composite-key relationships, and future-proof our data architecture for advanced features. With MIT licensing and 1,200+ stars, it’s a low-risk, high-reward choice backed by the community."

Key Outcomes:

  • Faster integrations with external systems (e.g., ERP, CRM).
  • Lower technical debt by avoiding custom query logic.
  • Scalable architecture for multi-dimensional data (e.g., user-team-project assignments).

For Engineering/Technical Leads:

"Compoships extends Eloquent to support composite-key relationships (e.g., hasMany(Task::class, ['team_id', 'category_id'])) without modifying your database schema. It handles eager loading, belongsToMany, and pivot tables with composite keys—solving the core limitation where $this->team_id is null during eager loading. The package is Laravel-agnostic (supports v8–v13), actively maintained (last release: 2026), and integrates with factories and pivot models. Migration effort is minimal: just extend your models with the Compoships trait or base class."

Why It’s Worth the Dependency:

  • No schema changes: Works with existing composite-key relationships.
  • Full Eloquent compatibility: Supports has(), with(), sync(), and eager loading.
  • Performance: Optimized for bulk operations (e.g., attach() with composite tuples).
  • Community-backed: 1,200+ stars, active contributions, and CI-tested across Laravel/PHP versions.

Trade-offs:

  • Requires all related models to use the trait/base class.
  • Minor learning curve for composite-key syntax (e.g., json_encode([...]) for attach()).
  • Not a replacement for true composite primary keys (only for relationships).

Call to Action: "Let’s prototype this for our [legacy system/integration roadmap] in 2 sprints. The payoff—cleaner code, faster integrations, and future scalability—justifies the adoption."

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