定制 intelligent-intern/minio-storage-bundle 二次开发

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

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

intelligent-intern/minio-storage-bundle

最新稳定版本:v1.0.0

Composer 安装命令:

composer require intelligent-intern/minio-storage-bundle

包简介

Intelligent Intern storage bundle for minio integration

README 文档

README

The intelligent-intern/minio-storage-bundle integrates MinIO with the Intelligent Intern Core Framework, enabling seamless object storage functionality with full Vault integration and AMQP event handling.

Installation

Install the bundle using Composer:

composer require intelligent-intern/minio-storage-bundle

Configuration

Ensure the following secrets are set in Vault:

MINIO_URL=your_minio_url
MINIO_ACCESS_KEY=your_minio_access_key
MINIO_SECRET_KEY=your_minio_secret_key
MINIO_BUCKET=your_default_bucket
MINIO_CODE_BUCKET=your_code_bucket
MINIO_INCOMING_BUCKET=your_incoming_bucket
MINIO_LOGS_BUCKET=your_logs_bucket

Additionally, ensure AMQP settings are configured in MinIO for event notifications.

Usage

Once the bundle is installed and configured, the Core framework will dynamically detect the MinIO service via the storage.strategy tag.

The service will be available via the MinioService:

<?php

namespace App\Controller;

use IntelligentIntern\MinioStorageBundle\Service\MinioStorageService;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;

class StorageController extends AbstractController
{
    public function __construct(
        private MinioStorageService $minioService
    ) {}

    public function uploadFile(Request $request): JsonResponse
    {
        $bucket = $request->get('bucket', 'default');
        $path = $request->get('path');
        $content = $request->get('content');

        if (empty($path) || empty($content)) {
            return new JsonResponse(['error' => 'Path and content are required'], 400);
        }

        try {
            $this->minioService->uploadFile($bucket, $path, $content);
            return new JsonResponse(['message' => 'File uploaded successfully']);
        } catch (\Exception $e) {
            return new JsonResponse(['error' => $e->getMessage()], 500);
        }
    }

    public function generatePresignedUrl(Request $request): JsonResponse
    {
        $bucket = $request->get('bucket', 'default');
        $path = $request->get('path');

        if (empty($path)) {
            return new JsonResponse(['error' => 'Path is required'], 400);
        }

        try {
            $url = $this->minioService->generatePresignedUrl($bucket, $path);
            return new JsonResponse(['url' => $url]);
        } catch (\Exception $e) {
            return new JsonResponse(['error' => $e->getMessage()], 500);
        }
    }
}

Event-Driven Architecture

This bundle supports event-based storage using AMQP (RabbitMQ).
MinIO is configured to send file change events to AMQP, enabling asynchronous processing.

To set up an event listener:

<?php

namespace App\Service;

use IntelligentIntern\MinioStorageBundle\Service\MinioStorageService;

class StorageEventService
{
    public function __construct(private MinioStorageService $minioService) {}

    public function setupBucketEvents(): void
    {
        $this->minioService->setBucketEventListener('incoming', 'incoming_queue');
        $this->minioService->setBucketEventListener('code', 'code_queue');
    }
}

Features

  • Multi-bucket support (incoming, logs, code)
  • Vault integration (fetches MinIO credentials dynamically)
  • AMQP event publishing (triggers events on file operations)
  • Expiring download/upload URLs
  • File metadata and tagging
  • File encryption & decryption
  • Multipart uploads for large files
  • GraphDB integration-ready (for context-aware file retrieval)

Extensibility

This bundle is designed to integrate with intelligent-intern/core and can be extended further.
To implement custom storage strategies, create a new bundle implementing MinioServiceInterface and tag the service with storage.strategy.

For contributions, reach out to jschultz@php.net for guidelines.

License

This bundle is open-sourced software licensed under the MIT license.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-03-11