coderflexx/laravel-sendy
Composer 安装命令:
composer require coderflexx/laravel-sendy
包简介
Laravel Sendy is a simple and clean wrapper for the Sendy API, making it easy to manage subscribers, lists, and campaigns directly from your Laravel application.
README 文档
README
Laravel Sendy is a simple and clean wrapper for the Sendy API, making it easy to manage subscribers, lists, and campaigns directly from your Laravel application.
Installation
You can install the package via composer:
composer require coderflexx/laravel-sendy
You can publish the config file with:
php artisan vendor:publish --tag="laravel-sendy"
This is the contents of the published config file:
return [ /* |-------------------------------------------------------------------------- | Sendy Installation URL |-------------------------------------------------------------------------- | | This URL is used to connect to your Sendy installation. It should | point to the root of your Sendy installation. For example: | https://your-sendy-installation.com */ 'sendy_installation_url' => env('SENDY_INSTALLATION_URL', 'https://your-sendy-installation.com'), /* |-------------------------------------------------------------------------- | Sendy API Key |-------------------------------------------------------------------------- | | This key is used to authenticate your application with the Sendy | installation. You can find your API key in the Sendy settings. | Make sure to keep this key secure and do not share it with anyone. | It is recommended to use environment variables to store sensitive | information like API keys. You can set the SENDY_API_KEY */ 'sendy_api_key' => env('SENDY_API_KEY', 'your-sendy-api-key'), ];
API Keys
After Installation, you can grab your API KEYS from the sendy app installation, then add them in .env file
SENDY_INSTALLATION_URL=https://your-app-installation.com/ SENDY_API_KEY=your-api-key
Sendy Version
This package is compatible with Sendy v6.1.2 (Latest)
Usage
In order to use the package, you can use the facade directly, followed by the main method api (e.g. subscribers() then the verb (action))
use Coderflex\LaravelSendy\Facades\Sendy; $sendy = Sendy::{$service()}->{$action()}
Async Argument for HTTP Requests
All HTTP requests support an async option, allowing you to defer execution. This is useful when a request doesn't need to run immediately or isn't a high priority. You can handle it later using await when you're ready to process the result.
Example:
$promise = Sendy::subscribers()->subscribe( data: $data, async: true // The request is deferred and returns a promise ); // perform other tasks/operation here // later, wait for the response when you're ready. $response = $promise->await();
Subscribers
In order to create a create/delete a subscriber, you have to access the subscribers service first, then to the action
Subscribe a User
use Coderflex\LaravelSendy\Facades\Sendy; $data = [ 'name' => 'John Doe', 'email' => 'john@example.com', 'list' => '123', 'country' => 'US', ]; $response = Sendy::subscribers()->subscribe( data: $data, async: false );
Full Documentation Here
Unsubscribe a User
use Coderflex\LaravelSendy\Facades\Sendy; $data = [ 'email' => 'john@example.com', 'list' => '123', 'boolean' => true, // to get plan text response, instead of json. ]; $response = Sendy::subscribers()->unsubscribe( data: $data, async: false );
Full Documentation Here
Delete Subscriber
use Coderflex\LaravelSendy\Facades\Sendy; $data = [ 'email' => 'john@example.com', 'list_id' => '123', ]; $response = Sendy::subscribers()->delete( data: $data, async: false );
Full Documentation Here
Subscriber Status
use Coderflex\LaravelSendy\Facades\Sendy; $data = [ 'email' => 'john@example.com', 'list_id' => '123', ]; $response = Sendy::subscribers()->status( data: $data, async: false );
Full Documentation Here
Subscribers Count
use Coderflex\LaravelSendy\Facades\Sendy; $data = [ 'email' => 'john@example.com', 'list_id' => '123', ]; $response = Sendy::subscribers()->count( listId: '123', async: false );
Full Documentation Here
Lists
Same thing as the subscribers service, you can access the lists() service, then the http action you want.
Get Lists
use Coderflex\LaravelSendy\Facades\Sendy; $data = [ 'brand_id' => '123', 'include_hidden' => 'yes', // either yes or no. ]; $response = Sendy::lists()->get( data: $data, async: false );
Full Documentation Here
Brands
Laravel Sendy allows you to retrieve all the brand list you have by
use Coderflex\LaravelSendy\Facades\Sendy; $response = Sendy::brands()->get();
Full Documentation Here
Create & Send Compaigns
use Coderflex\LaravelSendy\Facades\Sendy; $data = [ 'subject' => 'Test Subject', 'from_name' => 'John Doe', 'from_email' => 'john@example.com', 'reply_to' => 'alex@example.com', 'title' => 'Test Title', 'plain_text' => 'This is a plain text version of the email.', 'html_text' => '<h1>This is a HTML version of the email.</h1>', 'list_ids' => 'abc123', 'segment_ids' => 'xyz456', 'exclude_list_ids' => null, 'exclude_segment_ids' => null, 'brand_id' => '123', 'query_string' => null, 'track_opens' => 1, 'track_clicks' => 1, 'send_campaign' => 1, // if set to 1 the compaign will be created & sent. 'schedule_date_time' => null, 'schedule_timezone' => null, ]; $response = Sendy::compaigns()->create( data: $data, async: false );
If you want to create and send the compaign at the same time, use createAndSend method
$response = Sendy::compaigns()->createAndSend( data: $data, async: false );
Full Documentation Here
Testing
composer test
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
License
The MIT License (MIT). Please see License File for more information.
coderflexx/laravel-sendy 适用场景与选型建议
coderflexx/laravel-sendy 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 16 次下载、GitHub Stars 达 3, 最近一次更新时间为 2025 年 05 月 05 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「laravel」 「coderflex」 「laravel-sendy」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 coderflexx/laravel-sendy 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 coderflexx/laravel-sendy 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 coderflexx/laravel-sendy 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A package to help you implement the Cloudflare turnstile "CAPTCHA Alternative"
Filament Plugin to help you implement Cloudflare Turnstile
Write Clean/Reusable Code with Presenters.
A package to keep track of your pages & understand your audience
Laravel Ticket System, to help you manage your tickets eaisly
Laravel Ticket System, to help you manage your tickets eaisly
统计信息
- 总下载量: 16
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 21
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-05-05