league/flysystem-local
Flysystem Local adapter sub-split for storing files on the local filesystem. Install via composer require league/flysystem-local. For issues and pull requests, use the main Flysystem repo; see the docs for configuration and usage.
composer require league/flysystem-local.storage_path('app') in Laravel):
use League\Flysystem\Local\LocalFilesystemAdapter;
$adapter = new LocalFilesystemAdapter('/path/to/root');
Filesystem:
use League\Flysystem\Filesystem;
$filesystem = new Filesystem($adapter);
$filesystem->write('test.txt', 'Hello');
$content = $filesystem->read('test.txt');
Begin with the Local Adapter docs for full API details.
League\Flysystem\Adapter\Local\LocalFilesystemAdapter in custom disk config (via config/filesystems.php) or build a Storage::extend() closure..env (e.g., FILESYSTEM_DISK_ROOT=storage/app) and inject into the adapter for different environments.writeStream() for large files to avoid memory spikes; pair with temporary files and rename() for atomic uploads.sys_get_temp_dir()-backed adapter or use League\Flysystem\Memory\MemoryFilesystemAdapter for speed and safety.listContents('', true) recursively for migrations, cleanup, or audit scripts — e.g., delete files older than X days using lastModified().read() or write(); sanitize with realpath() or whitelist against a base path.write() uses Visibility::PUBLIC by default (e.g., 0644 on Unix), but directories default to 0755; override via the third argument: ['visibility' => Visibility::PRIVATE].write() auto-creates parent dirs, but createDir() is required to explicitly create empty folders (since they’re implicit on write)./ as separator — avoid OS-specific assumptions (e.g., \ on Windows); Flysystem normalizes automatically.umask-aware visibility), configure League\Flysystem\UnixVisibility\PermissionMap when constructing the adapter.How can I help you explore Laravel packages today?