PHP code example of vish4395 / laravel-file-viewer

1. Go to this page and download the library: Download vish4395/laravel-file-viewer 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/ */

    

vish4395 / laravel-file-viewer example snippets


    'aliases' => Facade::defaultAliases()->merge([
        'LaravelFileViewer' => Vish4395\LaravelFileViewer\LaravelFileViewerFacade::class,
    ])->toArray(),

use LaravelFileViewer;
/*
 * ...
 */
public function file_preview($filename){
        $filepath='public/'.$filename;
        $file_url=asset('storage/'.$filename);
        $file_data=[
          [
            'label' => __('Label'),
            'value' => "Value"
          ]
        ];
        return LaravelFileViewer::show($filename,$filepath,$file_url,$file_data);
      }
bash
php artisan vendor:publish  --provider="Vish4395\LaravelFileViewer\LaravelFileViewerServiceProvider" --tag=assets
bash
php artisan vendor:publish  --provider="Vish4395\LaravelFileViewer\LaravelFileViewerServiceProvider" --tag=views