PHP code example of cable8mm / laravel-vite-s3
1. Go to this page and download the library: Download cable8mm/laravel-vite-s3 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/ */
cable8mm / laravel-vite-s3 example snippets
// config/filesystems.php
'disks' => [
// ...
'build' => [
'driver' => 'local',
'root' => public_path('build'),
],
],
return [
// Disk containing the Vite build output
'source_disk' => env('VITE_S3_SOURCE_DISK', 'build'),
// Disk to copy the build output into
'target_disk' => env('VITE_S3_TARGET_DISK', 's3'),
// Directory prefix inside the target disk (empty string for the root)
'target_path' => env('VITE_S3_TARGET_PATH', 'build'),
// Cache-Control headers (set 'cache_control' to false to disable)
'cache_control' => [
'immutable_directories' => ['assets'],
'immutable' => 'public, max-age=31536000, immutable',
'default' => 'public, max-age=300',
],
];
// config/filesystems.php
's3' => [
'driver' => 's3',
// ...
'visibility' => 'public', // uploads with a public-read ACL
],
bash
php artisan vendor:publish --tag=config
bash
php artisan s3:copy-vite-build
bash
php artisan s3:copy-vite-build --dry-run
php artisan s3:copy-vite-build --delete
php artisan s3:copy-vite-build --dry-run --delete