aisuvro / laravel-storage-linker
A Laravel package to create symbolic links for storage disks with interactive selection
Requires
- php: ^8.1
- illuminate/console: ^9.0|^10.0|^11.0|^12.0
- illuminate/filesystem: ^9.0|^10.0|^11.0|^12.0
- illuminate/support: ^9.0|^10.0|^11.0|^12.0
Requires (Dev)
- orchestra/testbench: ^7.0|^8.0|^9.0|^10.0
- phpunit/phpunit: ^9.0|^10.0|^11.0
This package is auto-updated.
Last update: 2025-06-20 06:04:08 UTC
README
A Laravel package that provides an interactive way to create symbolic links for all your storage disks with local drivers.
Recent Updates (v1.0.1)
🔧 Fixed: Resolved symbolic link creation issues by replacing hard link creation with proper symbolic links using native PHP symlink()
function.
Features
- 🔗 Interactive symlink creation with disk selection
- 📋 Display all available local disks in a table format
- ⚡ Create symlinks for all local disks with
--all
flag - 🗑️ Remove existing symlinks with
--remove
flag - 🔄 Force recreation of existing symlinks with
--force
flag - ✅ Real-time symlink status checking
- 🛡️ Safe error handling and validation
Installation
You can install the package via composer:
composer require aisuvro/laravel-storage-linker
The package will automatically register itself via Laravel's package discovery feature.
Usage
Interactive Mode
Run the command without any flags to see all available local disks and select which ones to link:
php artisan storage:link-all
This will show you a table with:
- Disk name
- Root path
- Current symlink status
You can then select one or multiple disks to create symlinks for.
Create All Symlinks
To create symlinks for all local disks at once:
php artisan storage:link-all --all
Remove Symlinks
To remove all existing symlinks:
php artisan storage:link-all --remove
Force Recreation
To force recreation of symlinks (even if they already exist):
php artisan storage:link-all --all --force
How It Works
The package scans your config/filesystems.php
file for all disks with the local
driver and creates symbolic links in the public/storage/{disk-name}
directory pointing to the disk's root path.
Example
If you have these disks configured:
// config/filesystems.php 'disks' => [ 'local' => [ 'driver' => 'local', 'root' => storage_path('app'), ], 'public' => [ 'driver' => 'local', 'root' => storage_path('app/public'), ], 'uploads' => [ 'driver' => 'local', 'root' => storage_path('app/uploads'), ], 's3' => [ 'driver' => 's3', // ... s3 config (will be ignored) ], ],
The package will create:
public/storage/local
→storage/app
public/storage/public
→storage/app/public
public/storage/uploads
→storage/app/uploads
The S3 disk will be ignored since it's not a local driver.
Requirements
- PHP ^8.1
- Laravel ^9.0|^10.0|^11.0|^12.0
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Security Vulnerabilities
If you discover a security vulnerability, please send an e-mail to info@appenjel.com.
Credits
License
The MIT License (MIT). Please see License File for more information.