1. Go to this page and download the library: Download mariosimao/notion-sdk-php library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
mariosimao / notion-sdk-php example snippets
use Notion\Blocks\Heading1;
use Notion\Blocks\ToDo;
use Notion\Common\Emoji;
use Notion\Notion;
use Notion\Pages\Page;
use Notion\Pages\PageParent;
$notion = Notion::create("secret_token");
$parent = PageParent::page("c986d7b0-7051-4f18-b165-cc0b9503ffc2");
$page = Page::create($parent)
->changeTitle("Shopping list")
->changeIcon(Emoji::fromString("🛒"));
$content = [
Heading1::fromString("Supermarket"),
ToDo::fromString("Tomato"),
ToDo::fromString("Sugar"),
ToDo::fromString("Apple"),
ToDo::fromString("Milk"),
Heading1::fromString("Mall"),
ToDo::fromString("Black T-shirt"),
];
$page = $notion->pages()->create($page, $content);
bash
$ composer
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.