-
-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a64c105
commit 73dd1ae
Showing
2 changed files
with
46 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,44 @@ | ||
[![Codecov](https://img.shields.io/codecov/c/github/mariosimao/notion-sdk)](https://app.codecov.io/gh/mariosimao/notion-sdk) | ||
[![Type coverage](https://shepherd.dev/github/mariosimao/notion-sdk/coverage.svg)](https://shepherd.dev/github/mariosimao/notion-sdk) | ||
[![Notion API version](https://img.shields.io/badge/API%20Version-2021--08--16-blue)](https://developers.notion.com/reference/versioning) | ||
[![Notion API version](https://img.shields.io/badge/API%20Version-2021--08--16-blue)](https://developers.notion.com/reference/versioning) | ||
|
||
# notion-sdk-php | ||
|
||
A complete Notion SDK for PHP developers. | ||
## Installation | ||
|
||
``` | ||
composer require mariosimao/notion-php | ||
``` | ||
|
||
## Getting started | ||
|
||
A Notion token will be needed to fully use this library. If you don't have one, | ||
please refer to [Authorization section](https://developers.notion.com/docs/authorization) from the [Notion API documentation](https://developers.notion.com/). | ||
|
||
A simple example on how to create a page with some content: | ||
|
||
```php | ||
<?php | ||
|
||
use Notion\Client; | ||
use Notion\Blocks\Paragraph; | ||
use Notion\Pages\Page; | ||
use Notion\Pages\PageParent; | ||
|
||
$token = getenv("NOTION_TOKEN"); | ||
$client = Client::create($token); | ||
|
||
$parent = PageParent::page("c986d7b0-7051-4f18-b165-cc0b9503ffc2"); | ||
$page = Page::create($parent) | ||
->withTitle("Sample page") | ||
->withIcon("⭐"); | ||
|
||
$content = Paragraph::fromString("This is a simple paragraph."); | ||
|
||
$client->pages()->create($page, $content); | ||
``` | ||
|
||
## Documentation | ||
|
||
Further documentation can be found [here](./docs/README.md). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,7 @@ | ||
# Documentation | ||
|
||
## Installation | ||
## Blocks | ||
|
||
``` | ||
composer require mariosimao/notion-php | ||
``` | ||
|
||
## Getting started | ||
|
||
A Notion token will be needed to fully use this library. If you don't have one, | ||
please refer to [Authorization section](https://developers.notion.com/docs/authorization) from the [Notion API documentation](https://developers.notion.com/). | ||
|
||
A simple example on how to create a page with some content: | ||
|
||
```php | ||
<?php | ||
|
||
$token = getenv("NOTION_TOKEN"); | ||
$client = \Notion\Client::create($token); | ||
|
||
$parent = PageParent::page("c986d7b0-7051-4f18-b165-cc0b9503ffc2"); | ||
$page = Page::create($parent) | ||
->withTitle("Sample page") | ||
->withIcon("⭐"); | ||
|
||
$content = Paragraph::fromString("This is a simple paragraph."); | ||
|
||
$client->pages()->create($page, $content); | ||
``` | ||
- [Bookmark](./blocks/Bookmark.md) | ||
- [Bulleted list item](./blocks/BulletedListItem.md) | ||
- [Paragraph](./blocks/Paragraph.md) |