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
Requires
- php: >=8.2
- doctrine/doctrine-bundle: ^2.15
- doctrine/orm: ^3.5
- symfony/asset: ^7.3
- symfony/form: ^7.3
- symfony/framework-bundle: ^7.3
- symfony/stimulus-bundle: ^2.8
- symfony/translation: ^7.3
- symfony/twig-bundle: ^7.3
- symfony/validator: ^7.3
- symfony/webpack-encore-bundle: ^2.0
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
- Add the bundle to your Symfony project
- Register the bundle in your
bundles.php
- Include the routing configuration
- Install assets:
php bin/console assets:install
- 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 expensesGET /expense/new
- Create new expense formPOST /expense/new
- Submit new expenseGET /expense/{id}
- Show expense detailsGET /expense/{id}/edit
- Edit expense formPOST /expense/{id}/edit
- Update expensePOST /expense/{id}
- Delete expenseGET /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.