# ProInvoice Addon System

A modular addon system that allows extending ProInvoice functionality without modifying core files.

## Features

- ✅ Auto-detection of addons in `/addons` directory
- ✅ Enable/Disable addons from admin panel
- ✅ License integration per addon
- ✅ Clean isolation (addons can't break core)
- ✅ Service provider registration
- ✅ Routes, views, and migrations support

## Architecture

### Services

1. **AddonLoader** (`app/Addons/Services/AddonLoader.php`)
   - Auto-detects addons
   - Loads addon manifests
   - Validates addon structure

2. **AddonManager** (`app/Addons/Services/AddonManager.php`)
   - Enables/disables addons
   - License validation
   - Status checking

3. **AddonRegistrar** (`app/Addons/Services/AddonRegistrar.php`)
   - Registers enabled addons with Laravel
   - Loads service providers
   - Loads routes

### Base Classes

- **AddonServiceProvider** (`app/Addons/Base/AddonServiceProvider.php`)
  - Base class for all addon service providers
  - Handles routes, views, and migrations loading

## Creating an Addon

1. Create directory: `addons/your-addon-name/`
2. Create `addon.json` manifest
3. Create `ServiceProvider.php`
4. (Optional) Add routes, views, migrations

See `addons/sample-addon/` for a complete example.

## Admin UI

Access addon management at: `/admin/addons`

Features:
- View all installed addons
- Enable/Disable addons
- License status per addon
- Addon information display

## License Integration

Addons can require a valid license by setting `requires_license: true` in `addon.json`.
If license is invalid, the addon cannot be enabled.

## Safety Features

- Addons are isolated from core system
- Failed addons don't break the application
- Validation before enabling
- Error logging for debugging






