A production-ready, open-source financial management system built with PHP Yii2 - crafted for businesses, freelancers, and individuals who demand clarity over their money.
Overview • Why Choose It • Features • Screenshots • Tech Stack • Installation • Configuration • Usage • Roadmap • Hire Me • Contributing • License
If this project saves you time or inspires your own work, please consider giving it a ⭐ star - it takes one second and means the world to an open-source developer.
Expense Manager is a self-hosted, full-featured financial tracking application built from the ground up with the Yii2 PHP framework. It gives businesses, freelancers, and individuals a clean, powerful dashboard to manage income, expenses, budgets, and reports across multi-user team workspaces - localized in five languages and without depending on third-party cloud services or paying subscription fees.
This is not a demo project. It is a production-grade application with:
- Secure authentication, CSRF protection, and hardened session management
- A normalized relational database schema with versioned migrations
- Professionally formatted XLSX exports with column formatting and frozen headers
- A unified AJAX response system across all controllers
- Clean MVC architecture following Yii2 conventions throughout
Whether you are a business owner looking for a finance tool you control, a developer evaluating modern PHP architecture, or a hiring manager assessing real-world PHP skill - this project speaks for itself.
Off-the-shelf finance tools force an uncomfortable trade-off: pay a recurring subscription, hand your data to someone else's cloud, or settle for something too basic to run a real business on. Expense Manager removes that trade-off entirely. It is a self-hosted, production-grade platform you own outright, engineered to the standard you would expect from a commercial SaaS product, minus the monthly bill and the vendor lock-in.
| What You Get | Why It Matters |
|---|---|
| You Own Everything | Open source under the MIT license. No subscriptions, no per-seat fees, no vendor lock-in, and full source-code ownership. |
| Your Data Never Leaves | Fully self-hosted. Sensitive financial records stay on your own infrastructure, not a third-party cloud. |
| Bank-Grade Security | Rate-limited login, bcrypt password hashing, CSRF on every form, PDO prepared statements, and secrets isolated in .env. |
| Team-Ready from Day One | Multi-user workspaces with role-based access (Owner, Admin, Member, Viewer) and email invitations for staff or accountants. |
| Reports You Can Hand to a CFO | Branded PDF financial reports and styled XLSX exports your accountant can open without reformatting a single cell. |
| Budgets That Warn You Early | Per-category budgets with configurable alert thresholds and instant in-app and email notifications before you overspend. |
| Built for Global Business | 50+ currencies and a fully localized interface in 5 languages, including complete right-to-left support. |
| Effortless Onboarding | Bulk CSV and Excel import with a row-by-row validation preview, so nothing bad ever lands in your books. |
| Modern, Responsive UI | A polished Bootstrap 5.3 interface that looks sharp on desktop, tablet, and mobile. |
| Engineered to Extend | Clean Yii2 MVC with a documented service layer. Easy to audit, easy to customize, easy to hand to any developer. |
Every detail, from the normalized database schema to the footer of each generated PDF, reflects how I approach paid client work: deliberate, secure, and built to last. If you like what you see here, the same standard is available for hire.
- Record all income sources with date, amount, category, and reference
- Attach receipts and invoices (PDF, JPG, PNG) directly to each record
- Filter and search by date range, category, or reference keyword
- Export filtered results to professionally styled XLSX (Excel) files
- Inline quick-view popup with full record details
- Track expenses with detailed metadata - date, amount, payment method, notes
- Hierarchical categories with parent/child structure for real-world expense trees
- Multiple payment methods: Cash, Card, Bank Transfer
- File attachment support for receipts and invoices
- Advanced filtering, searching, and pagination
- Export filtered data to styled XLSX - column-formatted, zebra-striped, and branded
- Financial overview dashboard with live summary cards
- Income vs. Expense balance tracking
- Monthly and yearly statistical breakdowns
- Category-wise spending analysis
- Interactive charts powered by ApexCharts
- Real-time balance widget
- Set spending budgets per category (expense caps or income targets)
- Monthly, yearly, and fiscal-year budget periods - spending is tracked against the current period automatically
- Configurable alert threshold per budget (e.g. warn at 80% of the limit)
- Color-coded progress bars with on-track / approaching-limit / over-budget states
- In-app toast alerts the moment a saved expense pushes a category over its threshold
- Optional email alerts when a budget crosses its threshold
- Dashboard Budget Overview widget highlighting at-risk categories
- Hierarchical expense categories roll child spending up to the parent budget
- Downloadable, professionally-styled PDF financial reports (powered by mPDF)
- Four report types: Financial Summary, Category Breakdown, Income vs Expense trend, and Budget Status
- Flexible periods: this/any month, fiscal year, custom date range, and all-time
- Branded header (company name), summary metric cards, percentage bars, and per-page footers
- Full Unicode & right-to-left rendering - reports generate correctly in every supported language, including Urdu
- Shared workspaces - invite teammates to collaborate on the same income, expenses, categories, and budgets
- Role-based access control: Owner (full control + delete), Admin (manage members + data), Member (manage data), Viewer (read-only)
- Email invitations for existing and brand-new users, with token-based acceptance (new sign-ups auto-join on registration)
- One-click workspace switcher in the navbar; every user keeps a private personal workspace
- Server-side enforcement - read-only members can't create/edit/delete, non-admins can't manage members
- Existing data migrates seamlessly into each user's personal workspace (no data loss)
- Bulk-import expenses and income from
.csv,.xlsx, or.xlsfiles - Preview before commit - every row is validated and shown with an OK / duplicate / skip status before anything is written
- Flexible column mapping by header name (order-independent); tolerant of currency symbols, thousands separators, and multiple date formats
- Auto-create missing categories and skip duplicates (toggleable per import)
- Downloadable template per type to get started quickly
- Round-trips the app's own Excel exports
- Secure registration and login with email verification
- Custom avatar and profile banner upload with server-side image resizing
- Password reset via email token
- "Remember me" persistent sessions
- Last login timestamp and IP tracking
- Hardened session cookies (configurable
SameSiteandSecureflags)
- 50+ currencies with fully customizable symbol, position, and decimal formatting
- Date/time format and timezone preferences per user
- Company name, logo, and favicon upload for white-label feel
- Database backup/export from within the application
- All sensitive settings managed via
.env- nothing hardcoded
- Responsive Bootstrap 5.3 layout - mobile, tablet, and desktop
- Clean, distraction-free interface with a consistent visual language
- PJAX-powered navigation - fast, no full page reloads
- AJAX modals for all Create/Edit/View/Delete operations
- Toast notification system (NEM Toast) with success, warning, and error states
- Bootstrap Icons throughout - consistent, crisp iconography
- Full UI localization in 5 languages - English, Spanish (Español), French (Français), Urdu (اردو), and German (Deutsch)
- In-app language switcher in the navigation bar - change languages with one click
- Per-user language preference saved to the database; remembered across sessions
- Automatic language detection for guests via the browser
Accept-Languageheader, with cookie persistence - Right-to-left (RTL) layout support, enabled automatically for Urdu
- Built on Yii2's native
Yii::t()translation framework with PHP message catalogs - easy to extend with new languages - Graceful fallback to English for any string not yet translated
- Login rate limiting - max 5 failed attempts per IP per 15 minutes
- CSRF protection on every POST form
- Bcrypt password hashing
- SQL injection prevention via PDO prepared statements
- XSS prevention via Yii2 output encoding
- Session cookie hardening via
.env(SESSION_SECURE,SESSION_SAMESITE) - Debug mode disabled by default - no stack traces in production
Dashboard - See your full financial picture at a glance: income, expenses, balance, and trends
Income Categories - Organize income sources with icons and colors for instant recognition
Income - Track every earning with date, category, amount, reference, and attachments
Expense Categories - Grid view with icon, color, and usage count per category
Expense Categories - Hierarchical tree view for modeling real-world business expense structures
Expenses - Complete expense ledger with filters, search, payment method, and export
Profile - User settings, avatar, theme preference, currency, and timezone
This project demonstrates a deliberate, professional choice of technologies - selected for stability, security, and real-world production viability.
| Layer | Technology | Why |
|---|---|---|
| Backend Framework | Yii2 v2.0.53 | Fast, secure, enterprise-proven PHP framework |
| Language | PHP 8.1+ | Modern type declarations, named arguments, enums |
| Database | MySQL 5.7+ / MariaDB 10.3+ | Proven relational storage with full migration history |
| ORM | Yii2 ActiveRecord | Clean model layer with relations, scopes, and validation |
| Frontend | Bootstrap 5.3 | Responsive, accessible, mobile-first UI framework |
| Icons | Bootstrap Icons | Consistent, high-quality SVG icon set |
| Charts | ApexCharts | Interactive, animated financial charts |
| XLSX Export / Import | PhpSpreadsheet | Styled Excel exports + CSV/Excel bulk import |
| PDF Reports | mPDF | HTML→PDF financial reports with Unicode & RTL support |
| AJAX Navigation | Yii2 PJAX | Partial page rendering without full reloads |
| Notifications | NEM Toast | Non-blocking, accessible toast alerts |
| Dependency Manager | Composer 2.x | PSR-4 autoloading, package versioning |
| Requirement | Version |
|---|---|
| PHP | 8.1 or higher |
| MySQL / MariaDB | 5.7+ / 10.3+ |
| Composer | 2.x |
| Web Server | Apache / Nginx |
Required PHP Extensions: pdo_mysql · mbstring · intl · gd or imagick · json · openssl
composer create-project mohsin-rafique/expense-manager expense-manager
cd expense-manager
composer install
chmod -R 755 runtime web/assets web/uploadsgit clone https://github.com/mohsin-rafique/expense-manager.git
cd expense-manager
composer install
chmod -R 755 runtime web/assets web/uploads- Download from GitHub Releases
- Extract to your web server root
- Run
composer install - Set directory permissions on
runtime/,web/assets/,web/uploads/
CREATE DATABASE expense_manager CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;Copy the example and configure your environment:
cp .env.example .env# Application
YII_DEBUG=false
YII_ENV=prod
# Database
DB_DSN=mysql:host=localhost;dbname=expense_manager
DB_USERNAME=your_db_user
DB_PASSWORD=your_db_password
DB_CHARSET=utf8mb4
# Session Security (set SESSION_SECURE=true when running HTTPS)
SESSION_SECURE=false
SESSION_SAMESITE=LaxYour
.envfile is gitignored - credentials are never committed to the repository.
⚠️ Never setYII_DEBUG=truein production - it exposes stack traces and internal file paths.
php yii migrateThis creates all required tables: user, profile, settings, income_categories, incomes, expense_categories, expenses.
php yii seed/demoCreates a demo account with realistic sample data so you can explore the app immediately.
| Field | Value |
|---|---|
| demo@example.com | |
| Password | demo123 |
⚠️ Remove or change the demo account before going live in production.
Update config/web.php with a unique secret key:
'request' => [
'cookieValidationKey' => 'your-unique-random-secret-here',
],Apache - The web/.htaccess file is included. Enable mod_rewrite:
sudo a2enmod rewrite
sudo systemctl restart apache2Nginx:
server {
listen 80;
server_name your-domain.com;
root /path/to/expense-manager/web;
index index.php;
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass unix:/var/run/php/php8.1-fpm.sock;
}
location ~ /\.(ht|git) {
deny all;
}
}- Open
http://your-domain.comorhttp://localhost/expense-manager/web/ - Log in with the demo account or register a new user
- Go to Settings - configure your currency, timezone, and branding
- Create your income and expense Categories
- Start recording transactions under Income and Expenses
- Navigate to Income → All Income
- Click Add Income
- Select date, category, amount, optional reference, and optional attachment
- Use the filter bar to search and narrow records
- Click Export to download a styled XLSX spreadsheet
- Navigate to Expenses → All Expenses
- Click Add Expense
- Select date, category, amount, payment method, optional reference and attachment
- Filter and search across all fields
- Export filtered results to XLSX
Tip: When you attach a receipt photo (PNG/JPG), enable the Read this invoice toggle (Beta) to have the form auto-fill the date, amount, payment method, reference, and description from the image - read entirely in your browser, nothing is uploaded for processing. Leave it off for bills paid on a due date (e.g. utilities), where the invoice date is not the payment date.
Income Categories: Navigate to Income → Categories - add, edit, delete, set icon and color.
Expense Categories: Navigate to Expenses → Categories - supports parent/child hierarchy, drag-and-drop organization, icon and color customization.
The dashboard provides a real-time snapshot: total income, total expenses, current balance, monthly breakdown, and category-level charts. The Budget Overview widget highlights any categories that are approaching or over their limit.
- Navigate to Budgets
- Click Add Budget and pick a category, a limit amount, and a period (monthly, yearly, or fiscal year)
- Set an alert threshold (e.g. 80%) to be warned before you hit the cap
- Watch color-coded progress bars track current-period spending automatically
- Get an in-app toast (and optional email) the moment a saved expense pushes a category over its threshold
- Navigate to Reports
- Choose a report type: Financial Summary, Category Breakdown, Income vs Expense, or Budget Status
- Pick a period: a specific month, fiscal year, custom date range, or all-time
- Click Download PDF to generate a branded report (full Unicode and RTL support, including Urdu)
- Open the workspace switcher in the navbar and create or select a shared workspace
- Go to Workspace → Members and invite teammates by email (existing or brand-new users)
- Assign a role: Owner, Admin, Member, or Viewer (read-only)
- Switch between your personal workspace and any shared workspace at any time - data stays scoped per workspace
- Navigate to Import
- Download the template for expenses or income, or use your own
.csv,.xlsx, or.xlsfile - Upload the file and preview every row with its OK / duplicate / skip status before anything is written
- Toggle auto-create missing categories and skip duplicates as needed, then confirm the import
Use the language switcher in the navigation bar to switch between English, Spanish, French, Urdu, and German. Your choice is saved to your profile and remembered across sessions; Urdu automatically switches the layout to right-to-left.
expense-manager/
├── actions/ # Reusable standalone controller actions
├── assets/ # Asset bundles (CSS/JS registration)
├── commands/ # Console commands (migrations, seeders)
├── components/ # Reusable application components
│ ├── ApiResponse.php # Unified AJAX response envelope
│ ├── BalanceHelper.php # Income/expense balance calculation
│ ├── CurrencyFormatter.php # Locale-aware currency formatting
│ ├── PdfGenerator.php # mPDF report generation wrapper
│ ├── WorkspaceManager.php # Active workspace + member resolution
│ ├── WorkspaceBehavior.php # Scopes records to the active workspace
│ ├── RequireWorkspaceCapability.php # Role-based access enforcement
│ └── ...
├── config/ # Application configuration
│ ├── web.php # Main web application config
│ ├── db.php # Database config (reads from .env)
│ └── params.php
├── controllers/ # HTTP request handlers (MVC Controllers)
│ ├── ExpenseController.php
│ ├── IncomeController.php
│ ├── BudgetController.php
│ ├── ReportController.php # PDF financial reports
│ ├── ImportController.php # CSV/Excel bulk import
│ ├── WorkspaceController.php # Team workspaces + member management
│ ├── ProfileController.php
│ └── ...
├── helpers/ # Stateless helper utilities
├── mail/ # Email view templates (invitations, alerts)
├── messages/ # i18n translation catalogs (en, es, fr, ur, de)
├── migrations/ # Versioned database schema migrations
├── models/ # ActiveRecord models + Search models
│ ├── Expense.php
│ ├── ExpenseSearch.php
│ ├── Budget.php
│ ├── Workspace.php
│ └── ...
├── services/ # Business-logic service layer
│ ├── BudgetService.php # Budget tracking + threshold alerts
│ ├── ReportService.php # Report data aggregation
│ ├── ImportService.php # Import parsing + validation
│ └── FiscalYearService.php # Fiscal-year period calculation
├── viewmodels/ # Presentation models for views
├── views/ # PHP view templates
│ ├── expense/
│ ├── income/
│ ├── budget/
│ ├── report/ # PDF report layouts
│ ├── import/
│ ├── workspace/
│ ├── layouts/
│ └── ...
├── widgets/ # Reusable UI widget components
├── web/ # Public web root (Apache/Nginx points here)
│ ├── css/
│ ├── js/
│ ├── libs/ # Vendored front-end libraries
│ ├── uploads/
│ └── index.php
├── .env.example # Environment template
├── composer.json
├── LICENSE
└── README.md
The project is under active development. Planned features in priority order:
- REST API - Yii2 RESTful API for mobile and third-party integrations
- Mobile app - React Native companion app via the REST API
- Bank account integration - connect to banking APIs for auto-import
Want to help build any of these? See Contributing.
Mohsin Rafique
Senior PHP Developer · Yii2 Specialist · Full Stack Engineer
This project is a live demonstration of what I bring to every client engagement:
- Clean architecture - MVC strictly followed, no logic in views, no fat controllers
- Security-first mindset - every form protected, every secret in
.env, rate limiting baked in - Database professionalism - normalized schemas, versioned migrations, no raw SQL in business logic
- Real deliverables - styled XLSX exports your accountant can open, not raw data dumps
- Maintainable code - PHPDoc on every class, PHP 8.1 type declarations throughout, Yii2 coding standards enforced
| Service | Description |
|---|---|
| Custom PHP / Yii2 Development | Bespoke web applications built on the Yii2 framework |
| Financial & ERP Systems | Expense tracking, invoicing, payroll, inventory management |
| API Development | RESTful APIs for mobile apps, third-party integrations |
| Legacy PHP Modernization | Upgrade and refactor old PHP 5/7 codebases to PHP 8+ |
| Performance Optimization | Query tuning, caching, response time improvements |
| Security Audits | Code review and hardening against OWASP Top 10 |
- 20+ years of PHP development experience
- Deep expertise in Yii2, Laravel, and raw PHP architecture
- Every project delivered with full documentation and clean handover
- Responsive communication - I treat your project like my own product
- Open source contributor - you can see how I write code before you hire me
Ready to discuss your project? Email me at mohsin.rafique@gmail.com or visit mohsinrafique.com
Contributions from the community are welcome and genuinely appreciated. This project grows better with every issue reported, feature suggested, and pull request submitted.
- Fork the repository on GitHub
- Clone your fork:
git clone https://github.com/YOUR-USERNAME/expense-manager.git - Create a feature branch:
git checkout -b feature/your-feature-name - Make your changes following the code style guidelines below
- Commit with a clear message:
git commit -m 'feat: add budget alert system' - Push to your branch:
git push origin feature/your-feature-name - Open a Pull Request against
master
This project follows Yii2 Coding Standards:
# Check code style
php vendor/bin/phpcs --standard=Yii2 controllers models components widgets
# Auto-fix code style
php vendor/bin/phpcbf --standard=Yii2 controllers models components widgetsFound a bug? Please open an issue and include:
- A clear description of the problem
- Steps to reproduce it
- Expected vs actual behavior
- PHP version, OS, and web server details
- Screenshots if applicable
If Expense Manager saved you time, inspired your work, or helped you learn - here is how you can give back:
- ⭐ Star this repository - it helps others discover the project and supports the developer's profile
- 🐛 Report bugs - help make the project more stable for everyone
- 💡 Suggest features - open a GitHub Discussion or Issue
- 📖 Improve documentation - fix typos, add examples, translate
- 📢 Share - tell other PHP developers, business owners, or communities about it
See CHANGELOG.md for the full version history, including every feature added, bug fixed, and security improvement applied since the initial release.
This project is open-source software licensed under the MIT License - you are free to use, modify, and distribute it for any purpose, including commercial use.
MIT License
Copyright (c) 2025 - 2026 Mohsin Rafique
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
- Yii Framework Team - the fast, secure, and professional PHP framework that powers this application
- Bootstrap - the world's most popular front-end toolkit
- Bootstrap Icons - clean, high-quality open-source icons
- ApexCharts - beautiful, interactive JavaScript charts
- PhpSpreadsheet - powerful PHP library for reading and writing spreadsheets
- All contributors who improve this project with every pull request and issue
Built with precision and care by Mohsin Rafique
⭐ Star this repository if it helped you - it keeps the project alive and growing.