PHPackages                             brokeyourbike/has-source-model - 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. brokeyourbike/has-source-model

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

brokeyourbike/has-source-model
==============================

Interface for interacting with source models

3.0.0(1mo ago)04.5k20MPL-2.0PHPPHP ^7.4|^8.0CI passing

Since Oct 19Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/brokeyourbike/has-source-model-laravel)[ Packagist](https://packagist.org/packages/brokeyourbike/has-source-model)[ GitHub Sponsors](https://github.com/brokeyourbike)[ Fund](https://opencollective.com/brokeyourbike)[ RSS](/packages/brokeyourbike-has-source-model/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (4)Dependencies (4)Versions (8)Used By (20)

has-source-model
================

[](#has-source-model)

[![Latest Stable Version](https://camo.githubusercontent.com/2c85e1bad117603fb8d79524cb7b5c6ef18cc53d4cf6d4425c6ba7c16a642360/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f62726f6b65796f757262696b652f6861732d736f757263652d6d6f64656c2d6c61726176656c)](https://github.com/brokeyourbike/has-source-model-laravel/releases)[![Total Downloads](https://camo.githubusercontent.com/d04aa28088f9d32932d958b3f2218d9ff64dc26df98822cf5bfeaff5dcc1f816/68747470733a2f2f706f7365722e707567782e6f72672f62726f6b65796f757262696b652f6861732d736f757263652d6d6f64656c2f646f776e6c6f616473)](https://packagist.org/packages/brokeyourbike/has-source-model)

Interface for interacting with source models.

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

[](#installation)

```
composer require brokeyourbike/has-source-model
```

Usage
-----

[](#usage)

```
use BrokeYourBike\HasSourceModel\HasSourceModelInterface;
use BrokeYourBike\HasSourceModel\HasSourceModelTrait;

class Client implements HasSourceModelInterface
{
    use HasSourceModelTrait;

    public function fetchTransaction(Transaction $transaction)
    {
        $this->setSourceModel($transaction);
        $this->performRequest("transactions/{$transaction->id}");
    }

    private function performRequest(string $url)
    {
        if ($this->getSourceModel($transaction)) {
            // do something with it
        }
    }
}
```

Authors
-------

[](#authors)

- [Ivan Stasiuk](https://github.com/brokeyourbike) | [Twitter](https://twitter.com/brokeyourbike) | [LinkedIn](https://www.linkedin.com/in/brokeyourbike) | [stasi.uk](https://stasi.uk)

License
-------

[](#license)

[Mozilla Public License v2.0](https://github.com/brokeyourbike/has-source-model-laravel/blob/main/LICENSE)

###  Health Score

50

—

FairBetter than 95% of packages

Maintenance89

Actively maintained with recent releases

Popularity22

Limited adoption so far

Community21

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 81% 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 ~536 days

Total

4

Last Release

54d ago

Major Versions

1.0.0 → 2.0.02021-10-21

2.0.1 → 3.0.02026-03-16

### Community

Maintainers

![](https://www.gravatar.com/avatar/114f3c6e8506e0bba763451e8e4bcc3e94d662c2dce982a910b5d7b3444593cf?d=identicon)[brokeyourbike](/maintainers/brokeyourbike)

---

Top Contributors

[![brokeyourbike](https://avatars.githubusercontent.com/u/1554371?v=4)](https://github.com/brokeyourbike "brokeyourbike (17 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (4 commits)")

---

Tags

eloquenteloquent-modelshacktoberfestinterfacelaravellaravel-8laravel-8-packagephpphp8

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/brokeyourbike-has-source-model/health.svg)

```
[![Health](https://phpackages.com/badges/brokeyourbike-has-source-model/health.svg)](https://phpackages.com/packages/brokeyourbike-has-source-model)
```

###  Alternatives

[doctrine/orm

Object-Relational-Mapper for PHP

10.2k285.3M6.2k](/packages/doctrine-orm)[jdorn/sql-formatter

a PHP SQL highlighting library

3.9k115.1M102](/packages/jdorn-sql-formatter)[illuminate/database

The Illuminate Database package.

2.8k52.4M9.3k](/packages/illuminate-database)[mongodb/mongodb

MongoDB driver library

1.6k64.0M543](/packages/mongodb-mongodb)[ramsey/uuid-doctrine

Use ramsey/uuid as a Doctrine field type.

90340.3M209](/packages/ramsey-uuid-doctrine)[reliese/laravel

Reliese Components for Laravel Framework code generation.

1.7k3.4M16](/packages/reliese-laravel)

PHPackages © 2026

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