brokeyourbike/has-source-model

Interface for interacting with source models

Maintainers

Package info

github.com/brokeyourbike/has-source-model-laravel

pkg:composer/brokeyourbike/has-source-model

Fund package maintenance!

brokeyourbike

Open Collective

Statistics

Installs: 4 465

Dependents: 36

Suggesters: 0

Stars: 0

3.0.0 2026-03-16 14:44 UTC

This package is auto-updated.

Last update: 2026-03-16 14:44:51 UTC


README

Latest Stable Version Total Downloads

Interface for interacting with source models.

Installation

composer require brokeyourbike/has-source-model

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

License

Mozilla Public License v2.0