承接 2lenet/file-bundle 相关项目开发

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

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

2lenet/file-bundle

最新稳定版本:1.0.3

Composer 安装命令:

composer require 2lenet/file-bundle

包简介

File Bundle

README 文档

README

Validate .github/workflows/test.yml SymfonyInsight

Symfony bundle that standardize the way of handling data file associated with an entity

Installation

The bundle is not yet on packagist make sure to add the following to your composer.json file:

{
    "url": "https://github.com/2lenet/FileBundle",
    "type": "git"
}

Install with composer:

composer require 2lenet/file-bundle

Usage

in your controller or service juste use the fileManager to get the db and absolute path to use to store your data.

        $fileSpec = $this->fileManager->getLocalFilename(
            ENTITY::PDFSTORAGENAME,
            $object,
            "pdf"
        );
  • This function take a first parameter which is the name of the store. Une one store for each field in each entity. It's a good practice to set a constant in the entitiy Class
  • The second parameter is an object ( good to have a getId on it but not required ). Optionnally you can have a getDateForFilename to get the date to use for creating the folders.
  • The third optionnal parameter is the extension to add to the file ( default .bin). Don't set the .

The function return a FileSpec object with two attribute

  • dbPath is the path to use to store in your database ( relative from the projectDir )
  • absPath is the filename to use to write your data ( open it with standard functions )

Path are build this way ( $projectDir / data / $storeName / Y / M / D / $objet->getId() . $ext ) if the folder does not exist it is created with the right right. Y/M/D is the year, month and day from the $object->getDateForFilename() if it exist, instead it use the today date.

        file_put_contents($fileSpec->absPath,$youdata);
        $object->setLocalPdf($fileSpec->dbPath);

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-09-24

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固