guanguans / notify
Push notification SDK(AnPush、Bark、Chanify、DingTalk、Discord、Gitter、GoogleChat、IGot、Lark、Mattermost、MicrosoftTeams、NowPush、Ntfy、Push、Pushback、PushBullet、PushDeer、Pushover、PushPlus、QQ、RocketChat、ServerChan、ShowdocPush、SimplePush、Slack、Telegram、WeWork、WPush、XiZhi、YiFengChuanHua、Zulip).
Fund package maintenance!
Wechat
Installs: 59 780
Dependents: 7
Suggesters: 0
Security: 0
Stars: 636
Watchers: 8
Forks: 45
Open Issues: 0
Requires
- php: >=7.4
- ext-json: *
- ext-openssl: *
- ext-simplexml: *
- guzzlehttp/guzzle: ^7.9
- guzzlehttp/uri-template: ^1.0
- symfony/options-resolver: ^5.4 || ^6.0 || ^7.0
Requires (Dev)
- bamarni/composer-bin-plugin: ^1.8
- brainmaestro/composer-git-hooks: ^2.8 || ^3.0
- ergebnis/composer-normalize: ^2.44
- ergebnis/license: ^2.5
- ergebnis/php-cs-fixer-config: dev-main
- ergebnis/rector-rules: ^1.1
- guanguans/ai-commit: dev-main
- guanguans/monorepo-builder-worker: ^1.4
- icanhazstring/composer-unused: ^0.8
- illuminate/collections: ^8.83 || ^9.0 || ^10.0 || ^11.0
- infection/extension-installer: ^0.1
- infection/infection: ^0.26
- maglnet/composer-require-checker: ^3.8 || ^4.0
- mockery/mockery: ^1.6
- pestphp/pest: ^1.23 || ^2.0 || ^3.0
- pestphp/pest-plugin-faker: ^1.0 || ^2.0 || ^3.0
- php-mock/php-mock-phpunit: ^2.10
- phpbench/phpbench: ^1.2
- phpstan/extension-installer: ^1.4
- phpstan/phpstan: ^1.12 || ^2.0
- phpstan/phpstan-deprecation-rules: ^1.2 || ^2.0
- rector/rector: ^1.2
- symfony/var-dumper: ^5.4 || ^6.0 || ^7.0
- vimeo/psalm: ^5.26
Suggests
- illuminate/collections: Required to use the method [Response::collect()].
- symfony/var-dumper: Required to use the the trait [WithDumpable].
- dev-main / 2.x-dev
- 2.12.4
- 2.12.3
- 2.12.2
- 2.12.1
- 2.12.0
- 2.11.10
- 2.11.9
- 2.11.8
- 2.11.7
- 2.11.6
- 2.11.5
- 2.11.4
- 2.11.3
- 2.11.2
- 2.11.1
- 2.11.0
- 2.10.0
- 2.9.0
- 2.8.4
- 2.8.3
- 2.8.2
- 2.8.1
- 2.8.0
- 2.7.0
- 2.6.1
- 2.6.0
- 2.5.1
- 2.5.0
- 2.4.3
- 2.4.2
- 2.4.1
- 2.4.0
- 2.3.1
- 2.3.0
- 2.2.1
- 2.2.0
- 2.1.2
- 2.1.1
- 2.1.0
- 2.0.6
- 2.0.5
- 2.0.4
- 2.0.3
- 2.0.2
- 2.0.1
- 2.0.0
- 2.0.0-rc1
- 2.0.0-beta3
- 2.0.0-beta2
- 2.0.0-beta1
- 1.x-dev
- 1.28.0
- 1.27.2
- 1.27.1
- 1.27.0
- 1.26.1
- 1.26.0
- v1.25.1
- v1.25.0
- v1.24.1
- v1.24.0
- v1.23.0
- v1.22.2
- v1.22.1
- v1.22.0
- v1.21.3
- v1.21.2
- v1.21.1
- v1.21.0
- v1.20.1
- v1.20.0
- v1.19.2
- v1.19.1
- v1.19.0
- v1.18.2
- v1.18.1
- v1.18.0
- v1.17.0
- v1.16.0
- v1.15.0
- v1.14.1
- v1.14.0
- v1.13.2
- v1.13.1
- v1.13.0
- v1.12.1
- v1.12.0
- v1.11.1
- v1.11.0
- v1.10.0
- v1.9.1
- v1.9.0
- v1.8.2
- v1.8.1
- v1.8.0
- v1.7.2
- v1.7.1
- v1.7.0
- v1.6.0
- v1.5.0
- v1.4.4
- v1.4.3
- v1.4.2
- v1.4.1
- v1.4.0
- v1.3.1
- v1.3.0
- v1.2.0
- v1.1.2
- v1.1.1
- v1.1.0
- v1.0.5
- v1.0.4
- v1.0.3
- v1.0.2
- v1.0.1
- v1.0.0
- dev-dependabot/github_actions/trufflesecurity/trufflehog-3.88.0
- dev-issue-128-_Watch_Live_OFFICIAL/LIVE_—_UFC_310_Pantoja_vs_Asakura_LiVe_𝐒𝐭𝐫𝐞𝐚𝐦𝐬_FrEe_BrOaDcAsT_oN_TV_Guide_&_𝐒𝐭𝐫𝐞𝐚𝐦𝐢𝐧𝐠_7_December_2024_+1539
- dev-issue-73-Please_support_the_anpush_platform
- dev-issue-63-支持_WPUSH_推送平台
This package is auto-updated.
Last update: 2024-12-23 21:10:44 UTC
README
Note
Push notification SDK(AnPush、Bark、Chanify、DingTalk、Discord、Gitter、GoogleChat、IGot、Lark、Mattermost、MicrosoftTeams、NowPush、Ntfy、Push、Pushback、PushBullet、PushDeer、Pushover、PushPlus、QQ、RocketChat、ServerChan、ShowdocPush、SimplePush、Slack、Telegram、WeWork、WPush、XiZhi、YiFengChuanHua、Zulip).
Platform support
- AnPush
- Bark
- Chanify
- DingTalk
- Discord
Gitter- GoogleChat
- IGot
- Lark
- Mattermost
- MicrosoftTeams
NowPush- Ntfy
- Push
- Pushback
- PushBullet
- PushDeer
- Pushover
- PushPlus
- RocketChat
- ServerChan
- ShowdocPush
- SimplePush
- Slack
- Telegram
- WeWork
- WPush
- XiZhi
- YiFengChuanHua
- Zulip
Related repository
Requirement
- PHP >= 7.4
Installation
composer require guanguans/notify -v
Usage example
Quick start
$response = (new Guanguans\Notify\DingTalk\Client( new Guanguans\Notify\DingTalk\Authenticator('c44fec1ddaa8a833156efb77b7865d62ae13775418030d94d05da08bfca73') )) ->send( Guanguans\Notify\DingTalk\Messages\BtnsActionCardMessage::make([ 'title' => 'This is title(keyword).', 'text' => 'This is text.', ]) ) // ->dump() ->json();
// 1. Create authenticator $authenticator = new Guanguans\Notify\DingTalk\Authenticator( 'c44fec1ddaa8a833156efb77b7865d62ae13775418030d94d05da08bfca73', // 'SECc32bb7345c0f73da2b9786f0f7dd5083bd768a29b82e6d460149d730eee51' ); // 2. Create client $client = new Guanguans\Notify\DingTalk\Client($authenticator); // 3. Create message $message = Guanguans\Notify\DingTalk\Messages\BtnsActionCardMessage::make([ 'title' => 'This is title(keyword).', 'text' => 'This is text.', // 'btnOrientation' => 1, // 'btns' => [ // [ // 'title' => 'This is title 1.', // 'actionURL' => 'https://github.com/guanguans/notify', // ], // ], ]) ->btnOrientation(1) ->addBtn([ 'title' => 'This is title 2.', 'actionURL' => 'https://github.com/guanguans/notify', ]); // 4. Send message $response = $client // ->baseUri('base-uri') // ->connectTimeout(10) // ->debug(true) // ->proxy('http://127.0.0.1:1087') // ->timeout(30) // ->verify(false) // ->push( // GuzzleHttp\Middleware::log( // new Psr\Log\NullLogger, // new GuzzleHttp\MessageFormatter(GuzzleHttp\MessageFormatter::DEBUG) // ), // 'log' // ) // ->before( // 'log', // GuzzleHttp\Middleware::mapRequest( // static fn (Psr\Http\Message\RequestInterface $request) => $request // ), // ) ->send($message) ->dump() // ->throw() ->json();
Asynchronous requests
$promise = $client->sendAsync($message); $response = $promise->wait();
Concurrent requests
/** @var iterable<array-key, \Guanguans\Notify\Foundation\Contracts\Message> $messages */ /** @var array<array-key, \Guanguans\Notify\Foundation\Response|\Psr\Http\Message\ResponseInterface> $responses */ $responses = $client->pool($messages);
Hyperf integration
use Guanguans\Notify\Foundation\Client; use GuzzleHttp\HandlerStack; use Hyperf\Guzzle\CoroutineHandler; use Hyperf\Guzzle\HandlerStackFactory; use Hyperf\Guzzle\PoolHandler; // Set Handler directly // $client->setHandler(make(CoroutineHandler::class)); // $client->setHandler(make(PoolHandler::class)); $client->setHandler((fn () => $this->getHandler($this->option))->call(new HandlerStackFactory)); // Or set HandlerStackResolver $client->setHandlerStackResolver(static fn (Client $client): HandlerStack => array_reduce( $client->defaultMiddlewares(), static fn (HandlerStack $handlerStack, callable $middleware) => tap($handlerStack)->push($middleware), (new HandlerStackFactory)->create() ));
Completion
Tip
Required to install Laravel Idea plugin.
Testing
composer test
Benchmark
composer benchmark
+---------------------+--------------------------+-----+-------+-----+----------+-----------+--------+ | benchmark | subject | set | revs | its | mem_peak | mode | rstdev | +---------------------+--------------------------+-----+-------+-----+----------+-----------+--------+ | SendMessageBench | benchSendMessage | | 10000 | 3 | 9.345mb | 186.142μs | ±0.05% | | CreateInstanceBench | benchCreateAuthenticator | | 10000 | 3 | 6.970mb | 0.775μs | ±0.44% | | CreateInstanceBench | benchCreateMessage | | 10000 | 3 | 6.970mb | 1.776μs | ±0.56% | | CreateInstanceBench | benchCreateClient | | 10000 | 3 | 7.410mb | 12.889μs | ±0.58% | +---------------------+--------------------------+-----+-------+-----+----------+-----------+--------+
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
Thanks
License
The MIT License (MIT). Please see License File for more information.