PHP code example of delboy1978uk / expenses

1. Go to this page and download the library: Download delboy1978uk/expenses library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

delboy1978uk / expenses example snippets


use Del\Common\ContainerService;
use Del\Expenses\ExpensesPackage;

$package = new ExpensesPackage();
ContainerService::getInstance()->registerToContainer($package);

$container = ContainerService::getInstance()->getContainer();
$svc = $container['service.expenses'];

$svc->createIncomeFromArray($data);
$svc->createExpenditureFromArray($data);
$svc->createExpenseClaimFromArray($data);
$svc->toArray($entity);
$svc->saveIncome($entity);
$svc->saveExpenditure($entity);
$svc->saveExpenseClaim($entity);
$svc->deleteIncome($entity);
$svc->deleteExpenditure($entity);
$svc->deleteExpenseClaim($entity);
$svc->deleteEntry($entity);
$svc->findByCriteria($criteria);
$svc->findIncomeById($id);
$svc->findExpenditureById($id);
$svc->findExpenseClaimById($id);
$svc->findExpenseClaimById($id);
$svc->saveIncome($income);
$svc->saveExpenditure($expenditure);
$svc->saveExpenseClaim($claim);

$entity->getId();
$entity->getUserId();
$entity->getDate();
$entity->getAmount();
$entity->getDescription();
$entity->getNote();
$entity->getCategory();
$entity->getType();

use Del\Expenses\Criteria\EntryCriteria;

$criteria = new Criteria();
$criteria->setUserId(42);
$criteria->setType('IN'); // also OUT or CLAIM
$criteria->setOrder(Criteria::ORDER_DATE);
$criteria->setLimit(25);
$criteria->setOffset(74);

$results = $svc->findByCriteria($criteria);