定制 3xw/attachment-third-party 二次开发

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

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

3xw/attachment-third-party

Composer 安装命令:

composer require 3xw/attachment-third-party

包简介

CakePHP utils plugins

README 文档

README

Attachment third pary ( Youtube etc ... ). Is a sub project of plugin 3xw/attachment

Installation

You can install this plugin into your CakePHP application using composer.

The recommended way to install composer packages is:

composer require 3xw/attachment-third-party

Add Queue tasks

Acrtive the plugin in your Application.php file:

// Queue
$this->addPlugin('Queue');

Then migrate the db

bin/cake migrations migrate -p Queue

Google

Install

Install Google lib:

composer require google/apiclient:^2.0

Protect

Ignore your Google private settings. Add following in .gitignore file:

/config/google/*

OAuth

  • select/create a Google project here
  • active Youtube Library in library menu
  • create and download a OAuth Client (of type "Other"), place it as config/google/credentials.json

Usage

Prepare

When using attachment, setup an event listener either:

  • globally in your config/attachment.php
return [
	'Attachment' => [

		//...

		'listeners' => [
			'beforeSave' => [
				'Attachment\Listener\ModifyTypeListener' => [
					'type' => 'transit',
					'subtype' => 'youtube', // or other third party name
				]
			],
		]

		//...

	]
];
  • specifically in any template:
$this->Attachment->buildIndex([
	'actions' => ['add','edit','delete','view'],
	'types' =>['image/jpeg','image/png','embed/youtube','embed/vimeo','video/quicktime','transit/youtube'],
	'listeners' => [
		'beforeSave' => [
			'Attachment\Listener\ModifyTypeListener' => [
				'type' => 'transit',
				'subtype' => 'youtube',
			]
		],
	]
])

Move Files

By creating a cron tasks, the plugin will look for attachments with a type "transit" and create Queue tasks for each attachment with relevant Mover Class.

bin/cake queue add CreateTransitStack & bin/cake queue runworker

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: Unknown
  • 更新时间: 2019-05-14

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固