zlt/laravel-notion-viewer
Composer 安装命令:
composer require zlt/laravel-notion-viewer
包简介
Get Notion blocks with Laravel
README 文档
README
This is a server side package for getting Notion page and blocks.
In order to render notion blocks in your application, please consider using npm package notion-viewer-client.
Table Of Contents
Prerequisites
Requirements are:
"illuminate/support": "^8.0|^9.0",
"php": "^8.1",
"illuminate/http": "^8.0|^9.0"
You need to provide API key for getting Notion API.
If you don't know how to get API key, please consult this documentation.
Installation
- Install package via composer
composer require laravel-notion-viewer
- Publish config file
php artisan vendor:publish --tag=laravel-notion-viewer
The following routes will be auto registered.
/laravel-notion-viewer/data/{id}
/laravel-notion-viewer/link-preview
Config file will be
'API_KEY' => env('NOTION_API_KEY'), 'API_VERSION' => env('NOTION_API_VERSION'), // default '2022-06-28' 'cache' => [ // If you want to cache the response, set this to true 'enabled' => false, // specify cache time in seconds 'time' => 60, ]
Usage
use Zlt\LaravelNotionViewer\Notion\Client;
-
Getting Notion Page
Client::getPage('page-id');
-
Getting Blocks
Client::getBlocks('block-id');
-
Getting Notion Page With Blocks
Client::getPageWithBlocks('page-id');
-
Getting Recursive Blocks
Some blocks have children blocks. In order to get all children blocks, use this method.
Client::getRecursiveBlocks('block-id');
-
Getting Page with Recursive Blocks
Client::getPageWithRecursiveBlocks('page-id');
TroubleShooting
-
object_not_found error
If you get
object_not_founderror, please check if you have given your integration access to your Notion Page. See here.
Support me
If you want to support me, buy me a coffee via Binance.
TODO
- Add Tests
- Add more features to cover all Notion API endpoints
zlt/laravel-notion-viewer 适用场景与选型建议
zlt/laravel-notion-viewer 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 10 次下载、GitHub Stars 达 0, 最近一次更新时间为 2022 年 12 月 08 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 zlt/laravel-notion-viewer 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 zlt/laravel-notion-viewer 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 10
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 9
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-12-08