PHP code example of spatie / laravel-export

1. Go to this page and download the library: Download spatie/laravel-export library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

spatie / laravel-export example snippets


// config/export.php

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

return [
    'crawl' => true,
];

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

return [
    'ic' => '',
    ],
];

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

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'));
    }
}

// config/filesystem.php

return [
    'disks' => [
        //

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

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

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

$ php artisan export
Exporting site...
Files were saved to disk `export`
bash
php artisan vendor:publish --provider=Spatie\\Export\\ExportServiceProvider
bash
php artisan export --skip-deploy
bash
php artisan export --skip-before
bash
php artisan export --skip-after
bash
php artisan export --skip-all
bash
php artisan export