PHPackages                             voltra/laravel-export - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. voltra/laravel-export

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

voltra/laravel-export
=====================

Create a static site bundle from a Laravel app

v1.2.7(3mo ago)16MITPHPPHP ^8.2

Since Mar 21Pushed 3mo agoCompare

[ Source](https://github.com/Voltra/laravel-export)[ Packagist](https://packagist.org/packages/voltra/laravel-export)[ Docs](https://github.com/Voltra/laravel-export)[ Fund](https://spatie.be/open-source/support-us)[ GitHub Sponsors](https://github.com/spatie)[ RSS](/packages/voltra-laravel-export/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (6)Dependencies (19)Versions (35)Used By (0)

Create a static site bundle from a Laravel app
==============================================

[](#create-a-static-site-bundle-from-a-laravel-app)

[![voltra/laravel-export](https://raw.githubusercontent.com/Voltra/laravel-export/main/art/voltra__laravel_export.png)](https://raw.githubusercontent.com/Voltra/laravel-export/main/art/voltra__laravel_export.png)

[![Latest Version on Packagist](https://camo.githubusercontent.com/1823f5b0de056bff2a886b4b39f683ac69bf7c36df7ca2f88138bb60f0299922/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f766f6c7472612f6c61726176656c2d6578706f72742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/voltra/laravel-export)[![Total Downloads](https://camo.githubusercontent.com/f54d3322cf74e8c326dd57e68534ecdd41095935fbebedf25ef59427bae8692e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6f6c7472612f6c61726176656c2d6578706f72742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/voltra/laravel-export)

```
$ php artisan export
Exporting site...
Files were saved to disk `export`

```

Build your blog or site with Laravel like with the tools you're used to having and export it to be hosted statically.

Laravel Export will scan your app and create an HTML page from every URL it crawls. The entire `public` directory also gets added to the bundle so your assets are in place too.

A few example use cases for this package:

- Build your own blog or site in Laravel with all the tools you're used to using. Export a static version and just upload it anywhere for hosting, no need for managing a full-blown server anymore.
- Use something like [Nova](https://nova.laravel.com/), [Wink](https://github.com/themsaid/wink), [Filament](https://filamentphp.com/), [Sharp](https://sharp.code16.fr/), or any other admin panel to manage your site locally or on a remote server, then publish it to a service like Netlify. This gives you all benefits of a static site (speed, simple hosting, scalability) while still having a dynamic backend of some sort.

Why a fork?
-----------

[](#why-a-fork)

> I don't want to maintain this complexity in our package

This is an answer I received to a PR that fixed symlink detection on Windows but also on all other OS. Without that PR, directories like the one symlinked via `php artisan storage:link` were not properly exported.

If you don't count comments and unit tests, the PR was a 10 lines edit (including proper indentation and multiline function calls).

As such `voltra/laravel-export` can be treated as a community-driven fork of `spatie/laravel-export` that won't shy away from bugfixes.

It's even treated as a replacement for that package on a composer level. That means that if you use other packages that depend on `spatie/laravel-export` and you then choose to require `voltra/laravel-export`, then that's what every package will be using.

Such a fork will also allow to slightly diverge from upstream to allow nice QoL features like on-export base URL replacement (WIP).

Compatibility
-------------

[](#compatibility)

The `voltra/laravel-export` version range on the right can replace the version range of `spatie/laravel-export` on the left.

spatie/laravel-exportvoltra/laravel-export^1.0 &lt;=1.2.2^1.0 &lt;= 1.2.7Installation
------------

[](#installation)

You can install the package via composer:

```
composer require voltra/laravel-export
```

After the package is installed, you can optionally publish the config file.

```
php artisan vendor:publish --provider=Spatie\\Export\\ExportServiceProvider
```

Configuration
-------------

[](#configuration)

Laravel Export doesn't require configuration to get started, but there are a few things you can tweak to your needs.

```
// config/export.php

return [
    'disk' => 'export',
];
```

This means you can also use other filesystem drivers, so you could export your site straight to something like S3.

```
# Optional, if the env variable is not defined it'll not do any replacement
EXPORT_BASE_URL="https://my.base-url.com/prefix"
```

### (optional) Vite plugin

[](#optional-vite-plugin)

If you heavily use JS in your app, you might want to register the included vite plugin to properly handle rewrites and absolute URLs in your app:

```
// vite.config.js
// [...]
import laravelExport from "./vendor/voltra/laravel-export/resources/js/vite-laravel-export-plugin";
// [...]

export default defineConfig({
    // [...]
    laravel({
        // [...]
    }),
    laravelExport(),
    // [...]
})
```

Then you can resolve URLs in your app using the helper function:

```
import { asExportUrl } from "/my/path/to/vendor/laravel-export/resources/js/vite-laravel-export-plugin"

const url = asExportUrl("/test"); // URL object
console.log(url);
console.log(url.toString());
```

### Determining the export contents

[](#determining-the-export-contents)

#### Crawling

[](#crawling)

With the default configuration, Laravel Export will crawl your site and export every page to a static site. If you'd like to disable this behaviour, disable the `crawl` option.

```
return [
    'crawl' => true,
];
```

#### Paths

[](#paths)

`paths` is an array of URL paths that will be exported to HTML. Use this to manually determine which pages should be exported.

```
return [
    'paths' => [
        '/',
        '/rss.xml',
    ],
];
```

#### Including files

[](#including-files)

`include_files` allows you to specify files and folders relative to the application root that should be added to the export. By default, we'll include the entire `public` folder.

```
return [
    'include_files' => [
        'public' => '',
    ],
];
```

`exclude_file_patterns` will check all source paths of included files, and exclude them if they match a pattern from in `exclude_file_patterns`. By default, all PHP files will be excluded, mainly to stop `index.php` from appearing in your export. Because the `mix-manifest.json` is no longer needed after compilation it is also excluded by default.

```
return [
    'exclude_file_patterns' => [
        '/\.php$/',
        '/mix-manifest\.json$/',
    ],
];
```

#### Configuration through code

[](#configuration-through-code)

All configuration options that affect the exports contents are also exposed in the `Exporter` class. You can inject this class to modify the export settings through code.

```
use Illuminate\Support\ServiceProvider;
use Spatie\Export\Exporter;

class AppServiceProvider extends ServiceProvider
{
    public function boot(Exporter $exporter)
    {
        $exporter->crawl(false);

        $exporter->paths(['', 'about', 'contact', 'posts']);
        $exporter->paths(Post::all()->pluck('slug'));
    }
}
```

### Custom disks

[](#custom-disks)

By default, Laravel Export will save the static bundle in a `dist` folder in your application root. If you want to store the site in a different folder, [configure a new disk](https://laravel.com/docs/5.8/filesystem) in `config/filesystem.php`.

```
// config/filesystem.php

return [
    'disks' => [
        //

        'export' => [
            'driver' => 'local',
            'root' => base_path('out'),
        ],
    ],
];
```

### Hooks

[](#hooks)

`before` and `after` hooks allow you to do things before or after an export. Hooks can contain any shell command.

The default configuration doesn't have any hooks configured, but shows two examples.

With this `before` hook, we'll use Yarn to build our assets before every export:

```
return [
    'before' => [
        'assets' => '/usr/local/bin/yarn production',
    ],
];
```

With this `after` hook, we'll deploy the static bundle to Netlify with their [CLI tool](https://www.netlify.com/docs/cli/) after the export.

```
return [
    'after' => [
        'deploy' => '/usr/local/bin/netlify deploy --prod',
    ],
];
```

If you want to run an export without certain hooks, use `--skip-{hook}` flags.

```
php artisan export --skip-deploy
```

To skip before, after and all hooks use the `--skip-before`, `--skip-after`, `--skip-all` flags respectively.

```
php artisan export --skip-before
```

```
php artisan export --skip-after
```

```
php artisan export --skip-all
```

Usage
-----

[](#usage)

To build a bundle, run the `export` command:

```
php artisan export
```

We recommend adding a composer script to make it handy:

```
{
    "scripts": {
        "app:export": [
            "Composer\\Config::disableProcessTimeout",
            "@php artisan export"
        ]
    },
    "scripts-descriptions": {
        "app:export": "Export the website as a static site bundle"
    }
}
```

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Security
--------

[](#security)

If you've found a bug regarding security please mail  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Voltra](https://github.com/Voltra)
- [Sebastian De Deyne](https://github.com/sebastiandedeyne)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

50

—

FairBetter than 96% of packages

Maintenance79

Regular maintenance activity

Popularity6

Limited adoption so far

Community19

Small or concentrated contributor base

Maturity84

Battle-tested with a long release history

 Bus Factor3

3 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~80 days

Recently: every ~18 days

Total

32

Last Release

110d ago

Major Versions

0.3.11 → 1.0.02024-01-08

PHP version history (5 changes)0.1.0PHP ^7.1

0.2.0PHP ^7.2

0.3.9PHP ^7.3|^7.4|^8.0

0.3.10PHP ^8.0

1.0.1PHP ^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/802602e0aeb4b70b8385bfa34308b3d1aa55baa9b41d9216cbd824da0d7bcad0?d=identicon)[Voltra](/maintainers/Voltra)

---

Top Contributors

[![freekmurze](https://avatars.githubusercontent.com/u/483853?v=4)](https://github.com/freekmurze "freekmurze (68 commits)")[![Voltra](https://avatars.githubusercontent.com/u/25990549?v=4)](https://github.com/Voltra "Voltra (47 commits)")[![sebastiandedeyne](https://avatars.githubusercontent.com/u/1561079?v=4)](https://github.com/sebastiandedeyne "sebastiandedeyne (45 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (24 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (17 commits)")[![mvdnbrk](https://avatars.githubusercontent.com/u/802681?v=4)](https://github.com/mvdnbrk "mvdnbrk (16 commits)")[![Gummibeer](https://avatars.githubusercontent.com/u/6187884?v=4)](https://github.com/Gummibeer "Gummibeer (15 commits)")[![patinthehat](https://avatars.githubusercontent.com/u/5508707?v=4)](https://github.com/patinthehat "patinthehat (14 commits)")[![royvanv](https://avatars.githubusercontent.com/u/18717340?v=4)](https://github.com/royvanv "royvanv (10 commits)")[![AdrianMrn](https://avatars.githubusercontent.com/u/12762044?v=4)](https://github.com/AdrianMrn "AdrianMrn (9 commits)")[![nuernbergerA](https://avatars.githubusercontent.com/u/13331388?v=4)](https://github.com/nuernbergerA "nuernbergerA (7 commits)")[![rubenvanassche](https://avatars.githubusercontent.com/u/619804?v=4)](https://github.com/rubenvanassche "rubenvanassche (4 commits)")[![Nielsvanpach](https://avatars.githubusercontent.com/u/10651054?v=4)](https://github.com/Nielsvanpach "Nielsvanpach (4 commits)")[![amoktar](https://avatars.githubusercontent.com/u/6639392?v=4)](https://github.com/amoktar "amoktar (4 commits)")[![rubuano](https://avatars.githubusercontent.com/u/33329579?v=4)](https://github.com/rubuano "rubuano (3 commits)")[![brendt](https://avatars.githubusercontent.com/u/6905297?v=4)](https://github.com/brendt "brendt (3 commits)")[![addorange](https://avatars.githubusercontent.com/u/1980618?v=4)](https://github.com/addorange "addorange (2 commits)")[![AlexVanderbist](https://avatars.githubusercontent.com/u/6287961?v=4)](https://github.com/AlexVanderbist "AlexVanderbist (2 commits)")[![amitavroy](https://avatars.githubusercontent.com/u/1438890?v=4)](https://github.com/amitavroy "amitavroy (2 commits)")[![laravel-shift](https://avatars.githubusercontent.com/u/15991828?v=4)](https://github.com/laravel-shift "laravel-shift (2 commits)")

---

Tags

spatielaravellaravel-exportVoltra

###  Code Quality

TestsPest

Static AnalysisRector

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/voltra-laravel-export/health.svg)

```
[![Health](https://phpackages.com/badges/voltra-laravel-export/health.svg)](https://phpackages.com/packages/voltra-laravel-export)
```

###  Alternatives

[spatie/laravel-export

Create a static site bundle from a Laravel app

646127.9k5](/packages/spatie-laravel-export)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)[laravel/passport

Laravel Passport provides OAuth2 server support to Laravel.

3.4k85.0M532](/packages/laravel-passport)[laravel/reverb

Laravel Reverb provides a real-time WebSocket communication backend for Laravel applications.

1.6k9.4M48](/packages/laravel-reverb)[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[spatie/laravel-health

Monitor the health of a Laravel application

86910.0M83](/packages/spatie-laravel-health)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
