New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

hughcube/laravel-dingtalk

7,964
Install
composer require hughcube/laravel-dingtalk
Latest Version:v1.2.0
PHP:8.*
Older releases:8
License:MIT
Last Updated:Oct 27, 2026
Links: GitHub  ·  Packagist
Maintainer: hughcube

laravel dingtalk

Test Actions status Lint Actions status StyleCI Code Coverage Scrutinizer Code Quality Code Intelligence Status PHP Versions Supported Latest Stable Version Total Downloads License Latest Unstable Version composer.lock available

Installing

$ composer require hughcube/laravel-dingtalk -vvv

Configuration

[
    /**
     * default config
     */
    'defaults' => [],

    'robots' => [
        'default' => [
            'enabled' => env('DING_TALK_ROBOT_ENABLED', true),

            /**
             * The full webhook url, e.g. https://oapi.dingtalk.com/robot/send?access_token=xxx
             */
            'url' => env('DING_TALK_ROBOT_URL', ''),

            /**
             * The robot access_token, the default url will be generated automatically
             */
            'access_token' => env('DING_TALK_ROBOT_ACCESS_TOKEN', ''),

            /**
             * The robot secret, timestamp and sign will be appended automatically
             */
            'secret' => env('DING_TALK_ROBOT_SECRET', ''),
        ]
    ]
]

Configure either url or access_token, they are interchangeable:

# option 1: the full webhook url
DING_TALK_ROBOT_URL=https://oapi.dingtalk.com/robot/send?access_token=xxxxxxxx

# option 2: only the access_token
DING_TALK_ROBOT_ACCESS_TOKEN=xxxxxxxx

When both are configured the url wins. If the robot has a secret (DING_TALK_ROBOT_SECRET=SECxxxxxxxx), timestamp and sign are appended to the url automatically in both modes.

Usage

use HughCube\Laravel\DingTalk\DingTalk;
use HughCube\Laravel\DingTalk\Robot\Messages\Text;

DingTalk::robot()->send(new Text('hello world'));

// multi robot
DingTalk::robot('other')->send(new Text('hello world'));

Log channel

'channels' => [
    'dingtalk' => [
        'driver'  => 'monolog',
        'handler' => HughCube\Laravel\DingTalk\Log\Handler::class,
        'with'    => [
            'robot'   => null, // the robot name, null means "default"
            'enabled' => env('DING_TALK_ROBOT_ENABLED', true),
            'level'   => 'warning',
        ],
    ],
],

Test

$ composer test

# integration test against a real robot (optional)
$ DING_TALK_ROBOT_URL='https://oapi.dingtalk.com/robot/send?access_token=xxx' DING_TALK_ROBOT_SECRET='SECxxx' ./vendor/bin/phpunit

Contributing

You can contribute in one of three ways:

  1. File bug reports using the issue tracker.
  2. Answer questions or fix bugs on the issue tracker.
  3. Contribute new features or update the wiki.

The code contribution process is not very formal. You just need to make sure that you follow the PSR-0, PSR-1, and PSR-2 coding guidelines. Any new code contributions must be accompanied by unit tests where applicable.

License

MIT

Related Packages

doctrine/dbal

Powerful PHP database abstraction layer (DBAL) with many features for database s...

651,963,193 9,701
laravel/framework

The Laravel Framework.

604,216,237 34,982
laravel/tinker

Powerful REPL for the Laravel framework.

518,004,183 7,444
laravel/serializable-closure

Laravel Serializable Closure provides an easy and secure way to serialize closur...

435,097,283 607
nunomaduro/collision

Cli error handling for console/command-line PHP applications.

407,699,310 4,663

Version History

Version Released PHP Laravel License
v1.2.0 8.* MIT
v1.1.1 8.* MIT
v1.1.0 8.* MIT
v1.0.5 8.* MIT
v1.0.4 8.* MIT