Comprehensive guidance for working with SolidInvoice codebase - a sophisticated open-source invoicing application built with Symfony, featuring client management, invoicing, payments, and API integration.
Expert guidance for AI assistants working with the SolidInvoice codebase - an elegant invoicing solution for small businesses and freelancers.
SolidInvoice is a sophisticated open-source invoicing application providing:
**Tech Stack:** Symfony 7.1+, PHP 8.4+, Doctrine ORM, API Platform, MySQL 8.0+
**Version:** 2.3.11
**License:** MIT
The application uses 19 specialized bundles organized by domain:
**Business Logic:**
**System & Infrastructure:**
**UI & Presentation:**
Entry points for HTTP requests are **Action classes** with single responsibility:
```php
// src/InvoiceBundle/Action/CreateAction.php
class CreateAction
{
public function __invoke(Request $request): Response
{
// Handle invoice creation
}
}
```
Extensive use of Symfony EventDispatcher:
Symfony Workflow for invoice state management:
Custom repositories extending Doctrine EntityRepository in `Repository/` directory.
Complex domain operations encapsulated in Manager classes (e.g., `InvoiceManager`, `PaymentSettingsManager`) in `Manager/` directory.
```
/
├── assets/ # Frontend (Stimulus, SCSS)
│ ├── controllers/ # Stimulus controllers
│ └── scss/ # Sass stylesheets
├── bin/ # Executables (console, phpunit)
├── config/ # Symfony configuration
│ ├── packages/ # Package configurations
│ ├── routes/ # Route definitions
│ └── services.php # Service container config
├── migrations/ # Database migrations
├── src/ # 19 bundles
├── templates/ # Twig templates
└── tests/ # Test bootstrap and utilities
```
```
BundleNameBundle/
├── Action/ # Action classes (HTTP entry points)
├── Entity/ # Doctrine entities
├── Form/ # Symfony Form types
├── (Listener|EventSubscriber)/ # Event handlers
├── Manager/ # Business logic managers
├── Repository/ # Database access objects
├── Resources/
│ ├── config/ # Bundle configs
│ │ ├── routing/ # Route configuration
│ │ └── services/ # DI services
│ ├── translations/ # i18n files
│ └── views/ # Twig templates
└── Tests/
├── Functional/ # Integration tests
└── Unit/ # Unit tests
```
```bash
git clone https://github.com/SolidInvoice/SolidInvoice.git
cd SolidInvoice
composer install
bun install
bun run dev # Development with watch
bun run build # Production build
bin/console doctrine:database:create
bin/console doctrine:migrations:migrate
```
```bash
bun run dev # Build assets in dev mode with watch
bun run build # Production optimized build
bun run lint:js # ESLint validation
bun run lint:css # StyleLint validation
bin/console cache:clear # Clear cache
bin/console doctrine:migrations:migrate # Run migrations
bin/console doctrine:schema:validate # Validate schema
bin/ecs check # Check coding standards
bin/ecs check --fix # Auto-fix standards
bin/phpstan analyse # Static analysis
bin/rector process # Apply refactoring
bin/phpunit # Run all tests
bin/phpunit --coverage-html coverage # Generate coverage
bin/phpunit --filter testCreateInvoice # Run specific test
```
```
src/BundleNameBundle/Tests/
├── Functional/
│ └── Api/ # API endpoint tests
├── Form/ # Form type tests
└── Repository/ # Repository tests
```
**1. Unit Tests** - Test individual classes in isolation with Mockery:
```php
use Mockery as m;
class InvoiceManagerTest extends TestCase
{
public function testCreateInvoice(): void
{
$repository = m::mock(InvoiceRepository::class);
// Test logic
}
}
```
**2. Functional Tests** - Test full request/response cycle with database
**3. API Tests** - Test REST API endpoints extending `ApiTestCase`
All PHP files must include:
```php
<?php
declare(strict_types=1);
/*
* This file is part of SolidInvoice project.
*
* (c) Pierre du Plessis <[email protected]>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
```
1. ✅ `bin/ecs check --fix` - Coding standards
2. ✅ `bin/phpstan analyse` - Static analysis
3. ✅ `bin/phpunit` - Run tests
4. ✅ Ensure proper file headers
5. ✅ Validate commit message format
```php
trait Archivable {
private bool $archived = false;
}
trait TimeStampable {
private DateTimeInterface $created;
private DateTimeInterface $updated;
}
trait CompanyAware {
private Company $company;
}
trait Money {
// Money object fields
}
```
**Recommended:** FrankenPHP binary (single binary containing PHP, web server, and application code)
**Alternatives:**
Every pull request triggers:
1. **Unit Tests** - PHP 8.4/8.5, MySQL 8.0, code coverage (Codecov), E2E tests
2. **Coding Standards** - ECS, Composer normalize, Super-Linter
3. **Static Analysis** - PHPStan Level 6, Qodana
4. **Security Checks** - Composer vulnerabilities, CodeQL
Leave a review
No reviews yet. Be the first to review this skill!
# Download SKILL.md from killerskills.ai/api/skills/solidinvoice-development-guide/raw