PHP code example of mmieluch / laravel-vfs-provider

1. Go to this page and download the library: Download mmieluch/laravel-vfs-provider 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/ */

    

mmieluch / laravel-vfs-provider example snippets


  return [
  
      'providers' => [

          ...

          /*
           * 3rd Party Service Providers
           */
          Mmieluch\LaravelVfsProvider\LaravelVfsServiceProvider::class,

      ],
  
  ];
  

  return [
  
      ...
  
      'disks' => [

        // This is just an example name, you can call your disk
        // however you want :)
        'virtual' => [
            'driver' => 'vfs',
        ],

      ],
  
  ];
  


// Get a handler for storage...
$storage = app('storage');
// Or, if your VFS disk is not a default one, you need to
// choose it from the pool of available disks.
$storage = app('storage')->disk('virtual');

// And you're ready to use your new virtual filesystem!
$storage->makeDirectory('foo');
$storage->put('foo/bar.txt', 'baz');

$storage->has('foo/bar.txt'); // Returns: true

echo $storage->get('/foo/bar.txt'); // Outputs: baz

// You'd like to use a facade? Why, go ahead!
Storage::put('test.txt', 'All about that bass');
// Again, if your virtual drive is not set as your default:
Storage::disk('virtual')->put('test.txt', 'No treble');