Installation

System Requirements

  • PHP 8.2 or higher
  • Filament 3.x or 4.x

Version Compatibility

  • Filament 3.x: Use Data Lens ^1.0.0-beta
  • Filament 4.x: Use Data Lens ^2.0.0-beta

Quick Start

1. Purchase License

Purchase a Data Lens license from anystack.sh.

2. Add Repository

Add the anystack.sh repository to your composer.json:

{
    "repositories": [
        {
            "type": "composer",
            "url": "https://data-lens.composer.sh/"
        }
    ]
}

3. Install Package

For Filament 3.x:

composer require padmission/data-lens:"^1.0.0-beta"

For Filament 4.x:

composer require padmission/data-lens:"^2.0.0-beta"

You will be prompted for authentication:

Loading composer repositories with package information
Authentication required (data-lens.composer.sh):
Username: [licensee-email]
Password: [license-key]

Authentication Details

  • Username: Your email address associated with your anystack.sh license
  • Password: Your license key from anystack.sh

Example:

Note: If your license is not assigned to a specific licensee, you can use unlock as the username.

4. Run Interactive Installer

php artisan data-lens:install

The installer will:

  • Detect existing Filament panels
  • Publish migrations and configuration
  • Run database migrations
  • Configure the plugin with your preferences
  • Register the plugin in your panel provider(s)
  • Suggest security configurations

Configuration

Basic Configuration

use Padmission\DataLens\DataLensPlugin;

public function panel(Panel $panel): Panel
{
    return $panel
        ->plugins([
            DataLensPlugin::make()
        ]);
}

Multi-Panel Support

Data Lens fully supports multiple Filament panels with independent configurations.

Example: Different Panels with Different Settings

// AdminPanelProvider.php
public function panel(Panel $panel): Panel
{
    return $panel
        ->id('admin')
        ->plugins([
            DataLensPlugin::make()
                ->navigationLabel('Admin Reports')
                ->apiEnabled()  // API enabled for admin panel
                ->modelDirectories([
                    'app/Models',
                    'app/Admin/Models',
                ])
        ]);
}

// UserPanelProvider.php
public function panel(Panel $panel): Panel
{
    return $panel
        ->id('user')
        ->plugins([
            DataLensPlugin::make()
                ->navigationLabel('My Reports')
                // API not enabled for user panel
                ->modelDirectories([
                    'app/Models',
                    'app/User/Models',
                ])
        ]);
}

Full Configuration Example

->plugins([
    DataLensPlugin::make()
        ->navigationLabel('Reports')
        ->navigationIcon('heroicon-o-chart-bar')
        ->navigationSort(10)
        ->navigationGroup('Analytics')
        ->cluster('analytics')  // Optional cluster
        ->modelDirectories([
            'app/Models',
            'domain/Models',
        ])
        ->apiEnabled()
        ->exportsEnabled()
        ->exportFormats(['csv', 'xlsx'])
        ->defaultExportFormat('xlsx')
        ->useTimestampsInFilename(false)
        ->schedulingEnabled()
])

Plugin Configuration Options

Per-Panel Configuration

These settings can be configured independently for each panel:

Resource Configuration

  • ->slug(string $slug) - URL slug (Filament 4.x only - for v3 use config file)
  • ->shouldRegisterNavigation(bool $register) - Show/hide in navigation
  • ->navigationLabel(string $label) - Navigation menu label
  • ->navigationIcon(string $icon) - Heroicon name
  • ->navigationSort(int $sort) - Navigation order
  • ->navigationGroup(string $group) - Navigation group
  • ->cluster(string $cluster) - Assign to Filament cluster

Model Configuration

  • ->modelDirectories(array $directories) - Configure model discovery per panel

API Configuration

  • ->apiEnabled(bool $enabled) - Enable API access for this panel

Export Configuration

  • ->exportsEnabled(bool $enabled) - Enable/disable exports
  • ->exportFormats(array $formats) - Available formats: ['csv', 'xlsx']
  • ->defaultExportFormat(string $format) - Default export format
  • ->useTimestampsInFilename(bool $use) - Include timestamps in filenames

Scheduling Configuration

  • ->schedulingEnabled(bool $enabled) - Enable report scheduling for this panel

Global Configuration

These settings are configured in the config/data-lens.php file and apply globally:

  • Resource Slug (Filament v3 only) - Configure in slug (e.g., 'slug' => 'reports')
  • API IP Whitelisting - Configure in api.ip_whitelist
  • Export Queue Settings - Configure in exports.should_queue and exports.chunk_size
  • Email Settings - Configure sender email/name in scheduling.from_email and scheduling.from_name
  • Attachment Limits - Configure in scheduling.max_attachment_size
  • Tenant Configuration - All tenant-related settings
  • Cache Settings - All cache configuration

Manual Installation

If you prefer to manually configure Data Lens instead of using the interactive installer:

Configure Custom Theme (Filament 3.x only)

Note: This step is only required for Filament 3.x users. Filament 4.x users can skip this section.

Data Lens requires the Filament Table Repeater package styles. Add to your theme CSS:

@import '../../../../vendor/awcodes/filament-table-repeater/resources/css/plugin.css';

Update tailwind.config.js:

content: [
    // ... existing paths
    './vendor/awcodes/filament-table-repeater/resources/**/*.blade.php',
]

Publish and Run Migrations

php artisan vendor:publish --tag="data-lens-migrations"

Important: For multi-tenant support, configure tenant_aware = true in the config file before running migrations.

📖 Setting up multi-tenancy? See the complete Multi-Tenant Setup Guide for step-by-step instructions.

php artisan migrate

Register the Plugin

In your Filament panel provider:

use Padmission\DataLens\DataLensPlugin;

public function panel(Panel $panel): Panel
{
    return $panel
        ->plugins([
            DataLensPlugin::make()
        ]);
}

Configure Scheduled Reports (Optional)

To enable scheduled reports, add this to your Laravel scheduler:

Schedule::command('data-lens:check-scheduled-reports')->everyMinute();

Add to routes/console.php (Laravel 11) or app/Console/Kernel.php (Laravel 10 and earlier).

Verification

After installation:

  1. Visit your Filament admin panel
  2. Look for "Custom Reports" in the navigation
  3. Create your first report to test functionality