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 4d 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 32% 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

2261d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/368c2f3ea5c9320905f994faea954b9b9b63d185ca55bfd9bfe498702c5f78ac?d=identicon)[notpurpell](/maintainers/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.1k7.2M71](/packages/mongodb-laravel-mongodb)[spiritix/lada-cache

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

591444.8k2](/packages/spiritix-lada-cache)[pdphilip/elasticsearch

An Elasticsearch implementation of Laravel's Eloquent ORM

145360.2k4](/packages/pdphilip-elasticsearch)[mvanduijker/laravel-transactional-model-events

Add eloquent model events fired after a transaction is committed or rolled back

75164.5k](/packages/mvanduijker-laravel-transactional-model-events)[guidocella/eloquent-populator

Guess attributes for Eloquent model factories

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

A package for getting FileMaker records as Eloquent models in Laravel

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

PHPackages © 2026

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