Skip to content

Commit aeb0415

Browse files
committed
scope and read only filesystems
1 parent a98b6ec commit aeb0415

File tree

1 file changed

+26
-2
lines changed

1 file changed

+26
-2
lines changed

filesystem.md

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
- [The Local Driver](#the-local-driver)
66
- [The Public Disk](#the-public-disk)
77
- [Driver Prerequisites](#driver-prerequisites)
8+
- [Scoped & Read-Only Filesystems](#scoped-and-read-only-filesystems)
89
- [Amazon S3 Compatible Filesystems](#amazon-s3-compatible-filesystems)
910
- [Obtaining Disk Instances](#obtaining-disk-instances)
1011
- [On-Demand Disks](#on-demand-disks)
@@ -34,7 +35,7 @@ Laravel's filesystem configuration file is located at `config/filesystems.php`.
3435

3536
The `local` driver interacts with files stored locally on the server running the Laravel application while the `s3` driver is used to write to Amazon's S3 cloud storage service.
3637

37-
> **Note**
38+
> **Note**
3839
> You may configure as many disks as you like and may even have multiple disks that use the same driver.
3940
4041
<a name="the-local-driver"></a>
@@ -123,7 +124,7 @@ Laravel's Flysystem integrations work great with SFTP; however, a sample configu
123124
'sftp' => [
124125
'driver' => 'sftp',
125126
'host' => env('SFTP_HOST'),
126-
127+
127128
// Settings for basic authentication...
128129
'username' => env('SFTP_USERNAME'),
129130
'password' => env('SFTP_PASSWORD'),
@@ -142,6 +143,29 @@ Laravel's Flysystem integrations work great with SFTP; however, a sample configu
142143
// 'useAgent' => true,
143144
],
144145

146+
<a name="scoped-and-read-only-filesystems"></a>
147+
### Scoped & Read-Only Filesystems
148+
149+
You may create a path scoped instance of any existing filesystem disk by defining a disk that utilizes the `scoped` driver. Scoped disks allow you to define a filesystem where all paths are automatically prefixed with a given path prefix. For example, you may create a disk which scopes your existing `s3` disk to a specific path prefix, and then every file operation using your scoped disk will utilize the specified prefix:
150+
151+
```php
152+
's3-videos' => [
153+
'driver' => 'scoped',
154+
'disk' => 's3',
155+
'prefix' => 'path/to/videos',
156+
],
157+
```
158+
159+
If you would like to specify that any filesystem disk should be "read-only", you may include the `read-only` configuration option in the disk's configuration array:
160+
161+
```php
162+
's3-videos' => [
163+
'driver' => 's3',
164+
// ...
165+
'read-only' => true,
166+
],
167+
```
168+
145169
<a name="amazon-s3-compatible-filesystems"></a>
146170
### Amazon S3 Compatible Filesystems
147171

0 commit comments

Comments
 (0)