PHP code example of he426100 / tus-php-hyperf

1. Go to this page and download the library: Download he426100/tus-php-hyperf 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/ */

    

he426100 / tus-php-hyperf example snippets

shell script
composer 
shell script
php bin/hyperf.php vendor:publish he426100/tus-php-hyperf



declare(strict_types=1);

namespace App\Controller;

use Tus\Tus\Server;

class TusController extends AbstractController
{
    public function index()
    {
        $server = (new Server($this->request, $this->response))->setUploadDir(\dirname(__DIR__, 3) . '/public/' . 'uploads');
        return $server->serve();
    }
}



use Tus\Tus\Server;
use Hyperf\Nano\Factory\AppFactory;

t' => [
        'driver' => \Hyperf\Cache\Driver\RedisDriver::class,
        'packer' => \Hyperf\Utils\Packer\PhpSerializerPacker::class,
        'prefix' => 'c:',
    ],
]);

$app->addRoute(['HEAD', 'GET', 'POST', 'PUT', 'PATCH', 'OPTIONS', 'DELETE'], '/', function() {
    $server = new Server($this->request, $this->response);
    return $server->serve();
});

$app->run();