To leverage the static site export feature in this package, start by installing the package via Composer:
composer require vendor/package-name
Publish the package's configuration file to customize export settings:
php artisan vendor:publish --provider="Vendor\PackageName\PackageServiceProvider" --tag="config"
The simplest use case is exporting your Laravel application to static HTML files. Run the export command:
php artisan package-name:export
This will generate static files in storage/app/public/static-export by default. Review the config/package-name.php for customization options like output paths, excluded routes, and asset handling.
Development Workflow:
Deployment Workflow:
--clean flag to clear the export directory before generating new files:
php artisan package-name:export --clean
Asset Handling:
assets option in the config file to specify how assets (CSS, JS, images) are handled. Options include:
copy: Copy assets as-is.optimize: Optimize and minify assets during export.skip: Exclude assets from the export.Extend the export behavior by creating a custom command or service provider:
use Vendor\PackageName\Commands\ExportCommand;
class CustomExportCommand extends ExportCommand
{
protected $signature = 'custom:export {--path= : Export path}';
public function handle()
{
$this->configureExportPath($this->option('path'));
parent::handle();
}
}
/assets/style.css), update them to relative paths (e.g., assets/style.css) or configure the asset_url option in the config file.--verbose flag to get detailed logs during the export process:
php artisan package-name:export --verbose
storage/logs/laravel.log file for errors if the export fails silently.Vendor\PackageName\Contracts\Exporter interface to create custom exporters for specific use cases.export.middleware array in the config file to filter or modify requests during the export process.package-name.exporting and package-name.exported events to hook into the export process and perform additional tasks. Example:
public function handle(Exporting $event)
{
// Perform actions before export
}
How can I help you explore Laravel packages today?