hajjvero/expense-bundle

Expense Bundle for CRUD operations following Symfony 7.3+ conventions

Installs: 1

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 0

Open Issues: 0

Language:Twig

Type:symfony-bundle

dev-master 2025-08-28 12:25 UTC

This package is not auto-updated.

Last update: 2025-08-28 19:04:41 UTC


README

A modern Symfony bundle for managing expense CRUD operations following Symfony 7.0+ directory structure conventions.

Features

  • ✅ Complete CRUD operations for expenses
  • ✅ Modern PHP 8.1+ attributes and type declarations
  • ✅ Form handling with comprehensive validation
  • ✅ Repository pattern for database operations
  • ✅ Responsive Bootstrap templates with custom styling
  • ✅ Multi-language support (EN, FR, ES)
  • ✅ Category-based expense filtering
  • ✅ Date-based expense tracking
  • ✅ Flash messages and interactive JavaScript
  • ✅ Asset management with source and compiled versions

Installation

  1. Add the bundle to your Symfony project
  2. Register the bundle in your bundles.php
  3. Include the routing configuration
  4. Install assets: php bin/console assets:install
  5. Run database migrations

Bundle Structure (Symfony 7.0+ Conventions)

├── assets/                     # Source assets
│   ├── scripts/
│   │   └── expense.js         # JavaScript functionality
│   └── styles/
│       └── expense.css        # CSS styles
├── config/                     # Configuration files
│   └── routes.yaml            # Bundle routing
├── public/                     # Compiled/production assets
│   ├── css/
│   │   └── expense-bundle.css # Compiled CSS
│   └── js/
│       └── expense-bundle.js  # Compiled JavaScript
├── src/                       # PHP source code
│   ├── Controller/
│   │   └── ExpenseController.php
│   ├── Entity/
│   │   └── Expense.php
│   ├── Form/
│   │   └── ExpenseType.php
│   ├── Repository/
│   │   └── ExpenseRepository.php
│   └── ExpenseBundle.php
├── templates/                  # Twig templates
│   └── expense/
│       ├── index.html.twig
│       ├── show.html.twig
│       ├── new.html.twig
│       ├── edit.html.twig
│       └── by_category.html.twig
├── translations/               # Multi-language support
│   ├── ExpenseBundle.en.yaml  # English translations
│   ├── ExpenseBundle.fr.yaml  # French translations
│   └── ExpenseBundle.es.yaml  # Spanish translations
├── composer.json
└── README.md

Usage

Routes

  • GET /expense - List all expenses
  • GET /expense/new - Create new expense form
  • POST /expense/new - Submit new expense
  • GET /expense/{id} - Show expense details
  • GET /expense/{id}/edit - Edit expense form
  • POST /expense/{id}/edit - Update expense
  • POST /expense/{id} - Delete expense
  • GET /expense/category/{category} - Filter by category

Entity Properties

  • id: Primary key (auto-increment)
  • title: Expense title (required, max 255 chars)
  • description: Optional description (text)
  • amount: Expense amount (decimal 10,2, required)
  • category: Expense category (required, predefined choices)
  • date: Expense date (required)
  • createdAt: Creation timestamp (auto-set)
  • updatedAt: Last update timestamp (auto-updated)

Available Categories

  • Food & Dining (food_dining)
  • Transportation (transportation)
  • Shopping (shopping)
  • Entertainment (entertainment)
  • Bills & Utilities (bills_utilities)
  • Healthcare (healthcare)
  • Travel (travel)
  • Business (business)
  • Education (education)
  • Personal Care (personal_care)
  • Home & Garden (home_garden)
  • Technology (technology)
  • Other (other)

JavaScript Features

  • Auto-focus on first form field
  • Confirmation dialogs for delete actions
  • Auto-hide flash messages after 5 seconds
  • Amount input formatting
  • Category color coding for badges

Styling Features

  • Hover effects on expense cards
  • Responsive design for mobile devices
  • Color-coded category badges
  • Professional gradient styling
  • Form focus states

Translation Support

The bundle supports multiple languages:

  • English (en)
  • French (fr)
  • Spanish (es)

To add more languages, create new translation files in the translations/ directory following the pattern ExpenseBundle.{locale}.yaml.

Requirements

  • PHP 8.1+
  • Symfony 7.0+
  • Doctrine ORM 2.15+
  • Symfony Form, Validator, Twig Bundle, Asset, Translation components
  • Bootstrap 5.x (for templates)

Development

For development, use the source assets in the assets/ directory. The public/ directory contains compiled/minified versions for production use.