Download the PHP package ueberdosis/tiptap-php without Composer

On this page you can find all versions of the php package ueberdosis/tiptap-php. 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 tiptap-php

Tiptap for PHP

Latest Version on Packagist GitHub Tests Action Status Total Downloads License Chat Sponsor

A PHP package to work with Tiptap content. You can transform Tiptap-compatible JSON to HTML, and the other way around, sanitize your content, or just modify it.

Installation

You can install the package via composer:

Usage

The PHP package mimics large parts of the JavaScript package. If you know your way around Tiptap, the PHP syntax will feel familiar to you.

Convert Tiptap HTML to JSON

Let’s start by converting a HTML snippet to a PHP array with a Tiptap-compatible structure:

You can get a JSON string in PHP, too.

Convert Tiptap JSON to HTML

The other way works aswell. Just pass a JSON string or an PHP array to generate the HTML.

This doesn’t fully adhere to the ProseMirror schema. Some things are supported too, for example aren’t marks allowed in a CodeBlock.

If you need better schema support, create an issue with the feature you’re missing.

Syntax highlighting for code blocks with highlight.php

The default CodeBlock extension doesn’t add syntax highlighting to your code blocks. However, if you want to add syntax highlighting to your code blocks, there’s a special CodeBlockHighlight extension.

Swapping our the default one works like that:

This is still unstyled. You need to load a CSS file to add colors to the output, for example like that:

Boom, syntax highlighting! By the way, this is powered by the amazing scrivo/highlight.php.

Syntax highlighting for code blocks with Shiki (Requires Node.js)

There is an alternate syntax highlighter that utilizes Shiki. Shiki is a beautiful syntax highlighter powered by the same language engine that many code editors use. The major differences from the CodeBlockHighlight extensions are, 1) you must install the shiki npm package, 2) Shiki code highlighting works by injecting inline styles so pulling in a external css file is not required, 3) you can use most VS Code themes to highlight your code.

To use the Shiki extension, first install the npm package

Then follow the example below:

To configure the theme or default language for code blocks pass additonal configuration into the constructor as show below:

Under the hood the Shiki extension utilizes Shiki PHP by Spatie, so please see the documentation for additional details and considerations.

Convert content to plain text

Content can also be transformed to plain text, for example to put it into a search index.

What’s coming between blocks can be configured, too.

Sanitize content

A great use case for the PHP package is to clean (or “sanitize”) the content. You can do that with the sanitize() method. Works with JSON strings, PHP arrays and HTML.

It’ll return the same format you’re using as the input format.

Modifying the content

With the descendants() method you can loop through all nodes recursively as you are used to from the JavaScript package. But in PHP, you can even modify the node to update attributes and all that.

Warning: You need to add & to the parameter. Thats keeping a reference to the original item and allows to modify the original one, instead of just a copy.

Configuration

Pass the configuration to the constructor of the editor. There’s not much to configure, but at least you can pass the initial content and load specific extensions.

The StarterKit is loaded by default. If you just want to use that, there’s no need to set it.

Extensions

By default, the StarterKit is loaded, but you can pass a custom array of extensions aswell.

Configure extensions

Some extensions can be configured. Just pass an array to the constructor, that’s it. We’re aiming to support the same configuration as the JavaScript package.

You can pass custom HTML attributes through the configuration, too.

For the StarterKit, it’s slightly different, but works as you are used to from the JavaScript package.

Extend existing extensions

If you need to change minor details of the supported extensions, you can just extend an extension.

Custom extensions

You can even build custom extensions. If you are used to the JavaScript API, you will be surprised how much of that works in PHP, too. 🤯 Find a simple example below.

Make sure to dig through the extensions in this repository to learn more about the PHP extension API.

Extension priority

Extensions are evaluated in the order of descending priority. By default, all Nodes, Marks, and Extensions, have a priority value of 100.

Priority should be defined when creating a Node extension to match markup that could be matched be other Nodes - an example of this is the ListItem Node.

Testing

You can install nodemon (npm install -g nodemon) to keep the test suite running and watch for file changes:

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.


All versions of tiptap-php with dependencies

PHP Build Version
Package Version
Requires php Version ^7.4|^8.0
scrivo/highlight.php Version ^9.18
spatie/shiki-php Version ^2.0
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 ueberdosis/tiptap-php contains the following files

Loading the files please wait ....