PHP code example of webman-tech / laravel-filesystem

1. Go to this page and download the library: Download webman-tech/laravel-filesystem 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/ */

    

webman-tech / laravel-filesystem example snippets

bash
php webman storage:link
bash


namespace app\controller;

use support\Request;
use WebmanTech\Polyfill\LaravelRequest;
use WebmanTech\Polyfill\LaravelUploadedFile;

class UserAvatarController
{
    public function update(Request $request)
    {
        $path = LaravelRequest::wrapper($request)->file('file')->store('avatars');
        // 或者
        $path = LaravelUploadedFile::wrapper($request->file('avatar'))->store('avatars');

        return response($path);
    }
}