# Addons Directory

This directory contains all addons for ProInvoice.

## Addon Structure

Each addon must follow this structure:

```
addon-name/
├── addon.json          # Required: Addon manifest
├── ServiceProvider.php # Required: Addon service provider
├── routes.php          # Optional: Addon routes
├── routes/
│   └── web.php        # Alternative routes location
├── resources/
│   └── views/         # Optional: Addon views
└── database/
    └── migrations/     # Optional: Addon migrations
```

## addon.json Manifest

Required fields:
- `slug`: Unique addon identifier (e.g., "sample-addon")
- `name`: Display name
- `version`: Version number
- `provider`: Full class name of service provider

Optional fields:
- `description`: Addon description
- `author`: Author name
- `requires_license`: Boolean, if addon requires valid license
- `min_version`: Minimum ProInvoice version
- `max_version`: Maximum ProInvoice version

Example:
```json
{
    "slug": "my-addon",
    "name": "My Addon",
    "version": "1.0.0",
    "description": "Addon description",
    "author": "Your Name",
    "provider": "MyAddon\\ServiceProvider",
    "requires_license": true
}
```

## Service Provider

Your service provider must extend `App\Addons\Base\AddonServiceProvider`:

```php
<?php

namespace MyAddon;

use App\Addons\Base\AddonServiceProvider;

class ServiceProvider extends AddonServiceProvider
{
    public function register(): void
    {
        // Register services
    }

    public function boot(): void
    {
        parent::boot();
        // Your boot logic
    }
}
```

## License Integration

If your addon requires a license, set `requires_license: true` in `addon.json`. 
The addon will only be enabled if the main license is valid.

## Best Practices

1. **Isolation**: Don't modify core files
2. **Namespacing**: Use unique namespaces for your addon
3. **Error Handling**: Handle errors gracefully
4. **Documentation**: Document your addon's functionality
5. **Testing**: Test your addon before distribution






