承接 xrobau/laravel-sql-storage 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

xrobau/laravel-sql-storage

最新稳定版本:v0.3

Composer 安装命令:

composer require xrobau/laravel-sql-storage

包简介

Use MySQL as a filesystem.

README 文档

README

This was created because I needed to store 10+m files, linked to 1m+ identifiers, and using NFS was unwieldy.

I threw this together in an afternoon. It's probably missing a bunch of stuff, including the ability to list directories.

Listing files is incomplete, but will be added shortly (hint: FileModel with a trailing slash on the path)

Basic Instructions

Install

composer require xrobau/laravel-sql-storage

Run the migrations

php artisan migrate

It will make two tables - sqlstorage and sqlstorage_blobstore.

Usage

// Everything is related to an individual uuid. Think of this as
// the base folder.
$uuid = 'a3b04866-99b4-4edd-a85f-b12727bdd2ca';

// The @var is just an IDE Hint
/** @var SqlStorageDriver $s */
$s = Storage::disk('database');
// If you don't set 'usingUuid' it'll throw.
$s->usingUuid($uuid);

// This is the filename you want to mess with
$filename = "this.is.fake.txt";
// Set it to some random contents
$contents = str_repeat(str_repeat("a", 100) . str_repeat("b", 100), 100);
$s->put($filename, $contents);

// Now you can test it
if (!$s->exists($filename)) {
    print "$filename does not exist?\n";
    exit;
};

$out = $s->get($filename);
if ($out !== $contents) {
    print "Output didn't match what was put in?\nOut: '$out'\nOrig: '$contents'\n";
    exit;
}

print "Size is " . $s->size($filename) . "\n";
$m = $s->getModel($filename);
print "Model is: " . json_encode($m) . "\n";
$s->delete($filename);

统计信息

  • 总下载量: 1
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: AGPL-3.0-or-later
  • 更新时间: 2024-11-14