Download the PHP package m6web/draftjs-bundle without Composer

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

build:started

DraftjsBundle

This Symfony bundle aims to convert Draft.js state into an equivalent PHP object model and providing necessary tools for rendering html.

Installation

This library can be easily installed via composer

composer require m6web/draftjs-bundle

Then register the bundle:

YAML configuration reference

The configuration allow you to customize class names of blocks, inline styles and text alignment.

The inline key allow any string to customize class name of inline style text, for example, if you want to define the class name of BOLD style, just define your configuration as below:

Objects model

DraftjsBundle follow the Draft.js object model.

ContentState : Represent the document
ContentBlock : Represent a single block
DraftEntity : Represent a Draft.js entity
CharacterMetadata : Represent a character with style and entity

Draft.js supports

DraftjsBundle supports default Draft.js blocks type, has listed below:

- atomic
- unstyled
- paragraph
- unordered-list-item
- ordered-list-item
- header-one
- header-two
- header-three
- header-four
- header-five
- header-six
- blockquote

You can extends this list by implementing custom renderer has show in section Renderers

Exception

ContentStateConverter

Convert a Draft.js state into php model object.

m6_web_draftjs.content_state_converter

HtmlBuilder

Build html from a ContentState object.

m6_web_draftjs.html_builder

HtmlRenderer

Object for converting and rendering a Draft.js state into html.

m6_web_draftjs.html_renderer

Renderers

In addition to the global HtmlRenderer, we provide the possibility to extends rendering engine by adding new renderers.

We distinguished 3 types of renderer, depending on what you we want to customize,

There is also another renderer not listed here, the ContentRenderer responsible of rendering the HTML within a block from text and inline style.

The only things you have to do is to create a service then tagged it as expected.

Adding custom block renderer

First define your service:

In order to be fully support by our rendering engine, you must tag your service with draftjs.block_renderer and you must extend AbstractBlockRenderer who implement the BlockRendererInterface interface.

Illustration with the AcmeBlockRenderer class:

Adding custom inline entity renderer

Inline renderer are used for displaying entity information in block content has string.

First define your service:

In order to be fully support by our rendering engine, you must tag your service with draftjs.inline_entity_renderer and you must extend AbstractInlineEntityRenderer who implement the InlineEntityRendererInterface interface.

Illustration with the LinkInlineEntityRenderer class:

Notice the use of InlineRendererHelperTrait

Adding custom block entity renderer

Entity block renderer are used for displaying entity information as a block.

First define your service:

In order to be fully support by our rendering engine, you must tag your service with draftjs.block_entity_renderer and you must extend AbstractBlockEntityRenderer who implement the BlockEntityRendererInterface interface.

Illustration with the LinkInlineEntityRenderer class:

Helpers

Inline renderer helper

Block renderer helper


All versions of draftjs-bundle with dependencies

PHP Build Version
Package Version
Requires php Version >=5.6
symfony/framework-bundle Version ~2.7|~3.0
symfony/templating Version ~2.8|~3.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 m6web/draftjs-bundle contains the following files

Loading the files please wait ....