定制 rakshitbharat/laravel-storage-with-database 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

rakshitbharat/laravel-storage-with-database

Composer 安装命令:

composer require rakshitbharat/laravel-storage-with-database

包简介

A Laravel package for storing and retrieving text-based data using a database.

README 文档

README

Latest Version on Packagist Total Downloads Software License

Laravel Storage with Database is a powerful package that provides a seamless way to store and retrieve text-based data using a database in Laravel. It offers a simple and intuitive API similar to Laravel's built-in Storage facade, making it easy to switch from file-based storage to database storage for your text-based data[1].

Features

  • Store and retrieve text-based data using a database
  • Seamless integration with Laravel's Storage facade
  • Simple and intuitive API for interacting with stored data
  • Supports various database drivers (MySQL, PostgreSQL, SQLite, etc.)
  • Customizable database table and column names
  • Provides mock implementations for file-related functions
  • Comprehensive documentation and code examples

Installation

You can install the package via Composer:

composer require rakshitbharat/laravel-storage-with-database

After installing the package, you need to publish the configuration file:

php artisan vendor:publish --provider="Rakshitbharat\LaravelStorageWithDatabase\StorageDatabaseServiceProvider" --tag="config"

This will create a storage-database.php configuration file in your config directory. You can modify this file to customize the database connection, table name, and column names.

Next, run the database migration to create the necessary table:

php artisan migrate

Configuration

To use the database storage driver, you need to update your config/filesystems.php file. Add the following to the disks array:

'disks' => [
    // ... other disks ...
    'database' => [
        'driver' => 'database'
    ],
],

Usage

Once the package is installed and configured, you can start using it to store and retrieve text-based data. You can use the Storage facade with the database disk to interact with the stored data.

Storing Data

To store data, you can use the put method:

use Illuminate\Support\Facades\Storage;

Storage::disk('database')->put('key', 'value');

Retrieving Data

To retrieve data, you can use the get method:

use Illuminate\Support\Facades\Storage;

$value = Storage::disk('database')->get('key');

Checking Data Existence

To check if a key exists, you can use the exists method:

use Illuminate\Support\Facades\Storage;

$exists = Storage::disk('database')->exists('key');

Deleting Data

To delete data, you can use the delete method:

use Illuminate\Support\Facades\Storage;

Storage::disk('database')->delete('key');

Other Methods

The package supports other Laravel Storage methods like append, prepend, copy, move, size, lastModified, and more. Refer to the Laravel filesystem documentation for a complete list of available methods[1].

Contributing

Contributions are welcome! If you find any issues or have suggestions for improvements, please open an issue or submit a pull request on the GitHub repository.

License

Laravel Storage with Database is open-sourced software licensed under the MIT license[1].

rakshitbharat/laravel-storage-with-database 适用场景与选型建议

rakshitbharat/laravel-storage-with-database 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 200 次下载、GitHub Stars 达 17, 最近一次更新时间为 2024 年 06 月 15 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 rakshitbharat/laravel-storage-with-database 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 rakshitbharat/laravel-storage-with-database 我们能提供哪些服务?
定制开发 / 二次开发

基于 rakshitbharat/laravel-storage-with-database 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

  • Stars: 17
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-06-15