brokeyourbike / has-source-model
Interface for interacting with source models
Package info
github.com/brokeyourbike/has-source-model-laravel
pkg:composer/brokeyourbike/has-source-model
3.0.0
2026-03-16 14:44 UTC
Requires
- php: ^7.4|^8.0
Requires (Dev)
- bamarni/composer-bin-plugin: ^1.4
- phpunit/phpunit: ^9.5
This package is auto-updated.
Last update: 2026-03-16 14:44:51 UTC
README
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
- Ivan Stasiuk | Twitter | LinkedIn | stasi.uk