承接 amgrade/notion-api 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

amgrade/notion-api

最新稳定版本:v0.2

Composer 安装命令:

composer require amgrade/notion-api

包简介

PHP client for interaction with Notion API

README 文档

README

Installation

composer require amgrade/notion-api

Usage

Authorization

<?php

declare(strict_types=1);

use AMgrade\NotionApi\NotionAuthorizationClient;

require __DIR__.'/vendor/autoload.php';

$clientId = 'XXXXXX';
$clientSecret = 'XXXXXX';
$redirectUri = 'https://your-site.com';

$client = new NotionAuthorizationClient($clientId, $clientSecret, $redirectUri);

$url = $client->getAuthorizeUrl();

// Redirect user to the url

// After that exchange your "code" and get "access_token"
$response = $client->createToken('CODE');

$accessToken = $response['access_token'];

API usage

<?php

declare(strict_types=1);

use AMgrade\NotionApi\NotionClient;

require __DIR__.'/vendor/autoload.php';

// Read more about how you can get token here:
// https://developers.notion.com/docs/authorization
$token = 'secret_XXXXXXX';
$notionVersion = '2022-06-28';

$client = new NotionClient($token, $notionVersion);

$me = $client->user()->me();

$pages = $client->search()->search([
    'filter' => [
        'value' => 'page',
        'property' => 'object',
    ],
]);

$databases = $client->search()->search([
    'filter' => [
        'value' => 'database',
        'property' => 'object',
    ],
]);

统计信息

  • 总下载量: 2
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-10-22