Download the PHP package b3co/notion-mirror without Composer

On this page you can find all versions of the php package b3co/notion-mirror. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package notion-mirror

📰 README

A PHP way to read Notion pages and (optionally) upload images and videos to an S3 bucket (and link accordingly).

This is my first package distributed through composer, bare with me.

Operation

Prepare Services

Notion

  1. you have to create a Notion integration here.
  2. since we’re not writing to Notion, at this time only read access is necessary
  3. grab the notion_token, something like secret_xxxxxxxxxx
  4. on every page you want to be read by this script, you need to share it with the integration as shown in the image, quite easy part but tricky to find

inline

my Notion integration is called page mirror, use your own, the one created on the first step ☝️

S3

  1. create an AWS S3 bucket
  2. grab the AWS_KEY, AWS_SECRET, AWS_REGION and BUCKET_NAME Note that by default, images will be uploading using the following structure: s3.AWS_REGION.amazonaws.com/BUCKET_NAME/PAGE_ID/public/image/IMAGE_ID.jpg

CLI Invocation

You have to create a $config object with the previously created services’ access variables as follows:

You now can invoke the Notion object.

Yii Invocation

First, on the config file either web.php or console.php add

Second, use the YiiNotion object to get a Notion object and execute accordingly.

Templates (work in progress)

By default, three different export templates are set to each object:

  1. HTML with $page→toHtml()
  2. MarkDown with $page→toMd()
  3. Plain text with $page→toString()

Template families

Optionally you can use the template factory and create a template family under $config->templates_dir/TEMPLATE_FAMILY/ so if you invoke $page->toTemplate(TEMPLATE_FAMILY)
system will check for each block type template there, named as BLOCK_TYPE.template. For instance, for a template family called basic, you’ll have:

inline

Where image and page are block types.

Each template can use any given format/language and use objects’ attributes to be printed like [:ATTRIBUTE], for example an image with url and caption.

A complete list of objects and attributes is available here.

Important 🚨: If a template file is not found, that block will not be processed.

A note on toHtml method

HTML templating can be overwritten by creating a template family called html, if a block item template is found, will be used, if not, fail back will use the hardcoded HTML template.

Notion Objects

Supported Objects List


This very README file is created and stored in Notion and converted to MD using this script, last update 2022-08-24 → .


All versions of notion-mirror with dependencies

PHP Build Version
Package Version
Requires php Version >7.3
guzzlehttp/guzzle Version ^7.4
aws/aws-sdk-php Version ^3.231
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package b3co/notion-mirror contains the following files

Loading the files please wait ....