PHP code example of beapi / gutenberg-serializer

1. Go to this page and download the library: Download beapi/gutenberg-serializer 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/ */

    

beapi / gutenberg-serializer example snippets


$bloc = [
		[
			'blockName'    => 'core/paragraph',
			'attrs'        =>
				[
					'id' => 4
				],
			'innerBlocks'  => [],
			'innerHTML'    => '
				<p>This is a content</p>
			',
			'innerContent' => [
				0 => '
				<p>This is a content</p>
				',
			],
		]
];
$content = BlocksSerializer::from_array( $bloc );