https://github.com/beapi/gutenberg-serializer
Package to transform Gutenberg block array to a Gutenberg firendly string
https://github.com/beapi/gutenberg-serializer
Last synced: 8 months ago
JSON representation
Package to transform Gutenberg block array to a Gutenberg firendly string
- Host: GitHub
- URL: https://github.com/beapi/gutenberg-serializer
- Owner: BeAPI
- Created: 2020-02-12T17:42:17.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2020-12-02T11:10:42.000Z (about 5 years ago)
- Last Synced: 2025-04-22T15:12:17.541Z (8 months ago)
- Language: PHP
- Size: 144 KB
- Stars: 5
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# gutenberg-serializer
Package to transform Gutenberg block array to a Gutenberg firendly string
# Purpose
This package allows you to use a block array from "parse_blocs" for example, and serialize it into Gutenberg compatible content.
This can be used to migrate content from blocs or programmatically generate content for Gutenberg.
The library supports innerBlocs.
# Example
```php
$bloc = [
[
'blockName' => 'core/paragraph',
'attrs' =>
[
'id' => 4
],
'innerBlocks' => [],
'innerHTML' => '
This is a content
',
'innerContent' => [
0 => '
This is a content
',
],
]
];
$content = BlocksSerializer::from_array( $bloc );
```
Will become :
```
This is a content
```
# Commands
You have commands into the project :
- `composer cs` : Check the coding standards
- `composer cbf` : Beautify automatically all the files of the project
- `composer test` : Launch the tests
- `composer psalm`: Launch psalm on the files