PHPackages                             jestillore/has-one-belongs-to - 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. jestillore/has-one-belongs-to

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

jestillore/has-one-belongs-to
=============================

One-To-One Relationship with Pivot for Laravel Eloquent

v6.0.3(2y ago)214.7k↓45.1%1MITPHP

Since Mar 5Pushed 2y ago1 watchersCompare

[ Source](https://github.com/jestillore/has-one-belongs-to)[ Packagist](https://packagist.org/packages/jestillore/has-one-belongs-to)[ RSS](/packages/jestillore-has-one-belongs-to/feed)WikiDiscussions master Synced today

READMEChangelog (7)DependenciesVersions (9)Used By (0)

Has-One-Belongs-To
==================

[](#has-one-belongs-to)

> A one-to-one relationship with pivot for Laravel Eloquent.

This is just the same as `belongsToMany` from Eloquent. The only difference is that the model will only be related to a single model instead of a collection of models.

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

[](#installation)

```
composer require jestillore/has-one-belongs-to
```

Usage example
-------------

[](#usage-example)

##### Database tables

[](#database-tables)

`courses` table

idname1Math`users` table

idname1Juan dela Cruz`student_data` table

iduser\_idcourse\_idstudent\_number1111234567890##### Code Usage

[](#code-usage)

```
class Course
{

}

class User
{
    use HasOneBelongsToRelationship;

    public function course()
    {
        return $this->hasOneBelongsTo(Course::class, 'student_data');
    }
}
```

Versioning
----------

[](#versioning)

I decided to drop the whole syncing with illuminate version thing to avoid upgrading every time laravel upgrades to a new version.

Author
------

[](#author)

Jillberth Estillore – [@ejillberth](https://twitter.com/ejillberth) –

Distributed under the MIT license. See `LICENSE` for more information.

###  Health Score

35

—

LowBetter than 77% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity29

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity66

Established project with proven stability

 Bus Factor1

Top contributor holds 91.7% 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

Every ~260 days

Recently: every ~451 days

Total

8

Last Release

858d ago

Major Versions

v5.6.x-dev → v6.0.02019-09-16

### Community

Maintainers

![](https://www.gravatar.com/avatar/6522dbe642bf5afbde727b895988e2f14dd0ac2e5c263c7076b0fb969775b76d?d=identicon)[jestillore](/maintainers/jestillore)

---

Top Contributors

[![jestillore](https://avatars.githubusercontent.com/u/3094154?v=4)](https://github.com/jestillore "jestillore (11 commits)")[![haamzaay](https://avatars.githubusercontent.com/u/53896577?v=4)](https://github.com/haamzaay "haamzaay (1 commits)")

### Embed Badge

![Health badge](/badges/jestillore-has-one-belongs-to/health.svg)

```
[![Health](https://phpackages.com/badges/jestillore-has-one-belongs-to/health.svg)](https://phpackages.com/packages/jestillore-has-one-belongs-to)
```

###  Alternatives

[jdorn/sql-formatter

a PHP SQL highlighting library

3.9k117.2M118](/packages/jdorn-sql-formatter)[propel/propel1

Propel is an open-source Object-Relational Mapping (ORM) for PHP5.

8351.6M87](/packages/propel-propel1)[jfelder/oracledb

Oracle DB driver for Laravel

11518.4k](/packages/jfelder-oracledb)

PHPackages © 2026

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