Skip to content

alexanderwanyoike/customer-accounts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Customer Accounts

Simple project used to explain the key ideas of clean architecture

Getting Started

Usage

In order to use the customer accounts component we can create an instance of the interactor and then instantiate a request with the required data and the call will return a response.

<?php
use FunnyBank\Core\CustomerAccounts\Interfaces\CustomerAccountRepository;
use FunnyBank\Core\CustomerAccounts\Interactors\TransferFunds;
use FunnyBank\Core\CustomerAccounts\Entities\Account;
use FunnyBank\Core\CustomerAccounts\Boundries\TransferFunds\TransferFundsRequest;
use FunnyBank\Core\CustomerAccounts\Boundries\TransferFunds\TransferFundsResponse;

class SQLCustomerAccountRepository implements CustomerAccountRepository 
{
    public function __construct()
    {
    }

    public function save(Account $account): void
    {
        //Implementation here
    }

    public function delete(string $accountId): void
    {
        //Implementation here
    }

    public function find(string $accountId): ?Account
    {
        //Implementation here
    }
}


$customerRepository = new SQLCustomerAccountRepository();
$transferFunds = new TransferFunds($customerRepository);

$request = new TransferFundsRequest('A', 'B', 1000.32);
/** @var TransferFundsResponse $response */
$response = $transferFunds($request);

Running the tests

Execute the following to run the tests.

$ vendor/bin/phpunit

Built With

Authors

  • Alexander Wanyoike - Initial work

About

Example Module Showing Clean Architecture

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages