Download the PHP package alipeng/laravel-dingtalk-robot-notification without Composer

On this page you can find all versions of the php package alipeng/laravel-dingtalk-robot-notification. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-dingtalk-robot-notification

Laravel-dingtalk-robot-notification

钉钉群机器人 Laravel/Lumen 扩展包

Latest Stable Version Total Downloads License

功能说明

实现了 钉钉群机器人 的消息推送功能,并通过自定义通道使得机器人的消息推送也可以使用 Laravel 的消息通知(Notification)进行发送,同时对也 Lumen 也进行了支持。

依赖情况

如遇到依赖过高无法安装的问题请提 Issues。

安装方法

配置

Laravel

安装成功后执行

会将 dingtalk_robot.php 添加到您项目的配置文件目录中。

Lumen

安装成功后首先需要在 bootstrap/app.php 中注册 Provider

如果使用 Laravel 的 Notifications 还需要额外增加 Notifications 相关 Provider

如果使用 Facades 可以设置别名

然后需要您手动的将 vendor/calchen/laravel-dingtalk-robot-notification/config/dingtalk_robot.php 文件拷贝至您项目的配置文件目录中。

获取 access_token

首先在钉钉中发起群聊并设置一个群机器人,如果您不知道如何设置请查看 钉钉文档,请注意这里需要设置的是"自定义"类型的机器人。

在设置完成后您将获得一个 webhook 地址,该地址中 access_token 的值即下文中使用到的 access_token 的值,请妥善保存该 access_token。

配置文件参数

可在 .env 文件中进行配置

使用消息通知(Notification)

Tips:为了方便快速调试功能,内置了一个使用了 Notifiable Trait 的类:Calchen\LaravelDingtalkRobot\Robot ,以下均以此对象为例,实际开发中请务必根据您项目情况进行对应处理。

首先需要先创建一个 TestDingtalkNotification ,如果是 Laravel 可通过 artisan 命令创建

如果是 Lumen 那么可能需要您手动创建 app/Notifications 文件夹并创建 TestDingtalkNotification.php 文件

根据 Laravel 文档发送通知既可以使用 Notifiable Trait

也可以使用 Notification Facade

TestDingtalkNotification 中的 $message = ...; 部分可替换成下面的五种消息类型。

文本类型消息

link 类型消息

markdown 类型消息

ActionCard 类型消息

整体跳转类型

独立跳转类型

FeedCard 类型消息

使用消息通知(Notification)给多个机器人发同一条消息

不使用消息通知(Notification)

本扩展也支持不使用 Notification 直接调用机器人接口发送信息,有多种方式可以实现:

辅助函数 dingtalk_robot

容器解析

直接创建并调用接口

鸣谢

感谢 王举,他的 wangju/ding-notice 项目给予了我很多启发。本项目中的很多代码原形均来自于该项目。

License

MIT


All versions of laravel-dingtalk-robot-notification with dependencies

PHP Build Version
Package Version
Requires php Version >=7.1
guzzlehttp/guzzle Version ~6.0
phpunit/phpunit Version ^7.0
illuminate/notifications Version ^5.7
ramsey/uuid Version ^3.8
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package alipeng/laravel-dingtalk-robot-notification contains the following files

Loading the files please wait ....