linyows/notionslot
Composer 安装命令:
composer require linyows/notionslot
包简介
Notionslot stores messages in database on Notion for email notifications.
README 文档
README
Notionslot stores messages in database on Notion for email notifications. It is supposed to be used in the contact form of web hosting.
Usage
API mode:
use \Notionslot\Slot; $config = [ 'notion_token' => 'secret_**********************************', 'notion_db_id' => '123456aa-bc12-1234-5678-0987654321aa', 'site_domain' => 'foo.example', 'site_name' => 'My Foo', 'notify_to' => 'me@foo.example', 'reply_to' => 'hello@foo.example', 'mail_from' => 'noreply@foo.example', ]; $data = array_merge($_POST, ['ip' => $_SERVER['REMOTE_ADDR']]); echo Slot::api($config, $_SERVER, $data);
Library mode:
use \Notionslot\Slot; $config = [ 'notion_token' => 'secret_**********************************', 'notion_db_id' => '123456aa-bc12-1234-5678-0987654321aa', 'site_domain' => 'foo.example', 'site_name' => 'My Foo', 'notify_to' => 'me@foo.example', 'reply_to' => 'hello@foo.example', 'mail_from' => 'noreply@foo.example', ]; $data = array_merge($_POST, ['ip' => $_SERVER['REMOTE_ADDR']]); $res = [ 'ok' => true, 'errors' => [], ]; $slot = new Slot($config); if ($slot->sendHeader($_SERVER)->setData($data)->isValid()) { $notionRes = $slot->notify()->reply()->save(); } else { http_response_code(422); $res = [ 'ok' => false, 'errors' => $slot->errors(), ]; } echo json_encode($res);
Installation
The recommended way to install Guzzle is through Composer.
$ composer require linyows/notionslot
Configuration
Please specify notion token, website domain, mail from, reply to, etc by config.
| Name | Description |
|---|---|
| notion_endpoint | Page API endpoint for Notion |
| notion_emoji | Emoji used for Notion pages |
| notion_token | Credential for Notion API needs write permission |
| notion_db_id | Database ID on Notion |
| site_domain | Your website domain |
| notify_to | Email address to notify |
| reply_to | Reply-to header for SMTP |
| mail_from | From header for SMTP |
| mail_to_key | A key that specifies an email address |
| params | See below |
Custom
The default Notion databse property names are Full name(title), Email address(email), IP(rich_text).
You can change the property name and type from the settings.
| Name | Description |
|---|---|
| key | Use as HTTP Post params key |
| required | Whether a param is required |
| notion_name | User defined property name on notion database |
| notion_type | Property type on notion database |
Author
linyows/notionslot 适用场景与选型建议
linyows/notionslot 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 4 次下载、GitHub Stars 达 2, 最近一次更新时间为 2022 年 07 月 31 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 linyows/notionslot 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 linyows/notionslot 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 4
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 9
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-07-31