Skip to content

About

Expanse manager to track your finances.

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

12 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Expense Tracker CLI

PHP command-line application to track, manage, list, and summarize personal expenses stored in a flat JSON file.


Features

  • CLI arguments are dynamically bound and strictly validated through setter methods using PHP's Reflection API.
  • Date inputs support both Unix timestamps (e.g., 1788115034) and human-readable/relative string formats (e.g., "2026-08-31", "yesterday", "2026-08-01 14:30").

Commands & Usage

1. Add an Expense (add)

Creates a new expense entry, increments the internal ID tracker, and updates the overall balance.

  • Parameters:
    • --amount (Required, float/numeric): Total expense amount.
    • --description (Optional, string): Brief description (Defaults to "").
    • --date (Optional, timestamp|string): Transaction date (Defaults to current time).
php main.php add --amount 150.50 --description "Grocery shopping"
php main.php add --amount 4.75 --description "Coffee" --date "2026-08-30 09:15"
php main.php add --amount 120 --description "Internet bill" --date 1788115034

2. List Expenses (list)

Displays recorded expenses in a formatted view with optional pagination limits and date filters.

  • Parameters:
    • --limit (Optional, positive integer): Maximum number of rows to print (Defaults to 25).
    • --firstdate (Optional, timestamp|string): Start boundary filter.
    • --lastdate (Optional, timestamp|string): End boundary filter.
# List default 25 records
php main.php list

# Limit results to 5 records
php main.php list --limit 5

# Filter records between specific dates
php main.php list --firstdate "2026-08-01" --lastdate "2026-08-31 23:59:59"

3. Update an Expense (update)

  • Parameters:
    • --id (Required, integer): Target expense ID to modify.
    • --amount (Optional, float/numeric): Updated monetary value.
    • --description (Optional, string): Updated description text.
    • --date (Optional, timestamp|string): Updated timestamp/date.
php main.php update --id 1 --amount 175.00
php main.php update --id 2 --description "Fuel (Gasoline)" --amount 65.00
php main.php update --id 3 --date "2026-08-25"

4. Delete an Expense (delete)

  • Parameters:
    • --id (Required, integer): The target expense ID to delete.
php main.php delete --id 1

5. Expense Summary (summary)

  • Parameters:
    • --firstdate (Optional, timestamp|string): Filter range start date.
    • --lastdate (Optional, timestamp|string): Filter range end date.
# Overall total of all expenses
php main.php summary

# Summary within a specific timeframe
php main.php summary --firstdate "2026-08-01" --lastdate "2026-08-31 23:59:59"

About

Expanse manager to track your finances.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages