PHPackages                             notpurpell/composito - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. notpurpell/composito

ActiveLibrary[Database &amp; ORM](/categories/database)

notpurpell/composito
====================

Composito is a small package that gives eloquent models the ability to have composite primary keys.

1.0.0(6y ago)03MITPHPPHP ^7.4CI failing

Since Mar 7Pushed 6y agoCompare

[ Source](https://github.com/notpurpell/composito)[ Packagist](https://packagist.org/packages/notpurpell/composito)[ RSS](/packages/notpurpell-composito/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependencies (2)Versions (2)Used By (0)

Composito
=========

[](#composito)

Composito is a small package that gives eloquent models the ability to have composite primary keys through a trait.

Installation
------------

[](#installation)

You can install `composito` using [Composer](https://getcomposer.org/).

```
composer require notpurpell/composito

```

Usage
-----

[](#usage)

To add the composite primary key functionality to your eloquent model you must:

1. Use the `HasCompositePrimaryKey` trait.
2. Specify the composite primary key using the `$primaryKey` property.
3. Set the `$incrementing` property to false.

```
use Composito\Traits\HasCompositePrimaryKey;

class MyModel extends Eloquent
{
    use HasCompositePrimaryKey;

    /**
     * Indicates if the IDs are auto-incrementing.
     * @var bool
     */
    public $incrementing = false;

    /**
     * The composite primary key of the model.
     * @var array
     */
    protected $primaryKey = [ "primary_one", "primary_two" ];

    ...
}

```

Then, you can use the `create()`, `save()`, `update()`, and `delete()` methods normally.

Support for other methods such as the `find()` method is coming soon.

Tests
-----

[](#tests)

The package contains some tests that can be run via [phpunit](https://phpunit.readthedocs.io/en/8.5/).

```
./vendor/bin/phpunit

```

Credits
-------

[](#credits)

- [Joe Karam](https://github.com/joekaram)

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

24

—

LowBetter than 31% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

2310d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/64373199?v=4)[Purpell](/maintainers/notpurpell)[@notpurpell](https://github.com/notpurpell)

---

Top Contributors

[![joekaram](https://avatars.githubusercontent.com/u/5563189?v=4)](https://github.com/joekaram "joekaram (3 commits)")

---

Tags

databaseeloquentcompositeprimary keycomposite keys

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/notpurpell-composito/health.svg)

```
[![Health](https://phpackages.com/badges/notpurpell-composito/health.svg)](https://phpackages.com/packages/notpurpell-composito)
```

###  Alternatives

[mongodb/laravel-mongodb

A MongoDB based Eloquent model and Query builder for Laravel

7.1k8.4M96](/packages/mongodb-laravel-mongodb)[kirschbaum-development/eloquent-power-joins

The Laravel magic applied to joins.

1.6k32.6M46](/packages/kirschbaum-development-eloquent-power-joins)[spiritix/lada-cache

A Redis based, automated and scalable database caching layer for Laravel

592456.3k1](/packages/spiritix-lada-cache)[dbout/wp-orm

WordPress ORM with Eloquent.

12910.3k1](/packages/dbout-wp-orm)[guidocella/eloquent-populator

Guess attributes for Eloquent model factories

7762.7k2](/packages/guidocella-eloquent-populator)[gearbox-solutions/eloquent-filemaker

A package for getting FileMaker records as Eloquent models in Laravel

6662.6k2](/packages/gearbox-solutions-eloquent-filemaker)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
