PHPackages                             tmakinde/expense-tracker - 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. tmakinde/expense-tracker

ActiveLibrary

tmakinde/expense-tracker
========================

This is a package for anyone building a banking/fintech application in Laravel to be able to seamlessly integrate an expense tracker feature into their application

34PHP

Since Jan 10Pushed 1y ago1 watchersCompare

[ Source](https://github.com/Tmakinde/expense-tracker)[ Packagist](https://packagist.org/packages/tmakinde/expense-tracker)[ RSS](/packages/tmakinde-expense-tracker/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (2)Used By (0)

Tools for managing users expenses
=================================

[](#tools-for-managing-users-expenses)

The package `Tmakinde/expensetracker` for anyone building a banking/fintech application in Laravel to be able to seamlessly integrate an expense manager feature into their application. it allows easy management of users expenses based on categories and also provides a way to track expenses based on categories and time periods.

Features
--------

[](#features)

Key packages features include:

- Ability to create different categories for users selection. Categories could be:
    - Food
    - Transportation
    - Rent
    - Entertainment
    - Health
    - Education
    - Shopping
    - Others
- Ability for users to add expenses to their selected category.
- Statistics
    - Ability to view all expenses within a particular category for a particular period of time
    - Ability to even see all expenses within a particular period of time but grouped by category
- Define limits for a category for a particular time period so as to know when the expense has been exceeded for that time period
    - daily limit
    - weekly limit
    - monthly limit
    - yearly limit

Requirements
------------

[](#requirements)

- PHP 8 or higher
- Laravel 8 or higher

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

[](#installation)

You can install the package via composer:

```
composer require tmakinde/expense-tracker
```

Configuration
-------------

[](#configuration)

Publish the configuration file using the following command:

Migration:

```
php artisan vendor:publish --provider="Tmakinde\ExpenseTracker\ExpenseServiceProvider --tag="expenses-migrations"
```

Config:

```
php artisan vendor:publish --provider="Tmakinde\ExpenseTracker\ExpenseServiceProvider --tag="expenses-config"
```

Execute migration

```
php artisan migrate --path=/database/migrations/expenses
```

Usage
-----

[](#usage)

### Users

[](#users)

Users are the actual users that can add expenses to their expense list.

To be able to use certain methods in the users model, you need to add trait `UserLimitInteraction`, `UserCategoryInteraction` to the user model.

```
use Tmakinde\ExpenseTracker\Trait\UserCategoryInteraction;
use Tmakinde\ExpenseTracker\Trait\UserLimitInteraction;

class User extends Model
{
    use UserLimitInteraction, UserCategoryInteraction;
}
```

### Category

[](#category)

Category are the different types of expenses that a user can add to their expense list. You can create a category using the following command:

```
use Tmakinde\Expensetracker\Model\Category;
Category::create([
    'name' => 'Food'
]);
```

This will create a category with the name `Food` and set field `is_active` to `true` by default.

#### Mark category as inactive

[](#mark-category-as-inactive)

```
use Tmakinde\Expensetracker\Model\Category;
Category::markAsInactive($categoryId);
```

#### Mark category as active

[](#mark-category-as-active)

```
use Tmakinde\Expensetracker\Model\Category;
Category::markAsActive($categoryId);
```

`Use category facade to access the below methods`

```
use Tmakinde\ExpenseTracker\Facade\CategoryRequest;

// fetch categories of a user
CategoryRequest::for($user)->get();

// fetch categories of a user based on limit type
CategoryRequest::for($user)->whereLimitType('daily')->get();

// fetch categories of a user based on limit amount
CategoryRequest::for($user)->whereLimitAmountBetween(1000, 3000)->get();

// fetch categories of a user based on limit type and limit amount
CategoryRequest::for($user)->whereLimitType('daily')->whereLimitAmountBetween(1000, 3000)->get();
```

### Expenses

[](#expenses)

Expenses are the actual expenses that a user can add to their expense list. You can create an expense using the following command:

```
use Tmakinde\Expensetracker\Model\Expense;
Expense::create([
    'user_id' => 1,
    'user_type' => 'App\Models\User',
    'category_id' => 1,
    'currency' => 'NGN',
    'amount' => 1000,
]);
```

Note: `user_type` is the model of the user, which means it can serve as a polymorphic relationship.

Fetch all user expenses

```
use Tmakinde\ExpenseTracker\Facade\ExpenseRequest;
ExpenseRequest::for($user)->get();
```

Fetch all user expenses for a category

```
use Tmakinde\ExpenseTracker\Facade\ExpenseRequest;
ExpenseRequest::for($user)->whereCategory($categoryId)->get();
```

Fetch all user expenses for a category within a time period

```
use Tmakinde\ExpenseTracker\Facade\ExpenseRequest;
ExpenseRequest::for($user)->whereCategory($categoryId)->whereDateBetween('2022-01-01', '2022-01-31')->get();
```

Fetch all user expenses within a time period

```
use Tmakinde\ExpenseTracker\Facade\ExpenseRequest;
ExpenseRequest::for($user)->whereDateBetween('2022-01-01', '2022-01-31')->get();
```

Fetch user expenses and group by category

```
use Tmakinde\ExpenseTracker\Facade\ExpenseRequest;
ExpenseRequest::for($user)->groupByCategory()->get();
```

### Limit

[](#limit)

Limits are the maximum amount of expenses that a user can spend on a category for a particular time period. You can create a limit using the following command:

```
// create limit for a user category
use Tmakinde\ExpenseTracker\Model\Category;
use Tmakinde\ExpenseTracker\Enum\LimitType;

$category = Category::find(1);
$category->createLimit(LimitType::Daily, 500)->for($user)

// create limit using the user model

$categoryCallback = function(Category $category) {
    return $category->where('is_active', 1)->first();
}
auth()->user()->createCategoryLimit(LimitType::Daily, 1000, $categoryCallback)
```

where `$limitType` can be `daily`, `weekly`, `monthly`, `yearly`

### Config changes

[](#config-changes)

- You can change the default currency in the config file

Testing
-------

[](#testing)

Run the tests with:

```
vendor/bin/phpunit
```

###  Health Score

17

—

LowBetter than 6% of packages

Maintenance32

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity18

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/bfc47a12d75d2af0632911b7e7b432ff90ece85520ab938112701e8e44968517?d=identicon)[Tmakinde](/maintainers/Tmakinde)

---

Top Contributors

[![tolulinux](https://avatars.githubusercontent.com/u/237241254?v=4)](https://github.com/tolulinux "tolulinux (56 commits)")

### Embed Badge

![Health badge](/badges/tmakinde-expense-tracker/health.svg)

```
[![Health](https://phpackages.com/badges/tmakinde-expense-tracker/health.svg)](https://phpackages.com/packages/tmakinde-expense-tracker)
```

PHPackages © 2026

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