承接 rossriley/doctrine-uploader 相关项目开发

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

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

rossriley/doctrine-uploader

Composer 安装命令:

composer require rossriley/doctrine-uploader

包简介

Small package to handle file uploads via a save to a Flysystem Handler

README 文档

README

Doctrine Uploader

This is a very basic composer package designed to slot into an existing Doctrine ORM based project.

The listener takes care of handling file uploads and saves the resulting path to the Entity.

How to bootstrap

Define your entity targets.

This is an array in the format Entity\Class=>[field1,field2] for example.

$targets = [
    'Myproject\Entity\User' => ['logo','profilepic'],
    'Myproject\Entity\Company' => ['logo']
];
Provide a filesystem handler

This project uses Flysystem(http://flysystem.thephpleague.com) to handle saves. The simplest usage is as follows.

$fsAdapter = new League\Flysystem\Adapter\Local('/path/to/save');
$filesystem = new League\Flysystem\Filesystem($fsAdapter);
$handler = Handler($filesystem);
Add the listener to your EntityManager setup with the above setup
use Doctrine\Uploader\Listener;

$em->getEventManager()->addEventListener([Doctrine\ORM\Events::preUpdate], new Listener($handler, $targets));

Putting it all together.
use League\Flysystem\Adapter\Local;
use League\Flysystem\Filesystem;
use Doctrine\Uploader\Listener;
use Doctrine\Uploader\Handler;

$targets = [
    'Myproject\Entity\User' => ['logo','profilepic'],
    'Myproject\Entity\Company' => ['logo']
];

$fsAdapter = new Local('/path/to/save');
$filesystem = new Filesystem($fsAdapter);
$handler = Handler($filesystem);

$em->getEventManager()->addEventListener([Doctrine\ORM\Events::preUpdate], new Listener($handler, $targets));

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2014-05-21

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固