PHP code example of devinow / phpagebuilder

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

    

devinow / phpagebuilder example snippets




$config =  new PHPageBuilder\PHPageBuilder($config);
$builder->handleRequest();

$installationFolder = __DIR__ . '/phpagebuilder';
= );
$builder->handleRequest();

/**
 * @param string $slug - A Unique identifier for the block. Prefix author to avoid conflict.
 * @param string $directoryPath - Path to the directory of the Block.
 */
\PHPageBuilder\Extensions::registerBlock($slug, $directoryPath);

// Registering an example block:

\PHPageBuilder\Extensions::registerBlock('foo-navbar', MY_PLUGIN_DIRECTORY . '/blocks/foo-navbar');

/**
 * @param string $slug - A Unique identifier for the layout. Prefix author to avoid conflict.
 * @param string $directoryPath - Path to the directory of the Layout.
 */
\PHPageBuilder\Extensions::registerLayout($slug, $directoryPath);

// Registering an example layout:

\PHPageBuilder\Extensions::registerLayout('foo-master', MY_PLUGIN_DIRECTORY . '/layouts/foo-master');

/**
 * @param string $src                           - URL of the Asset file.
 * @param string $type                          - 'style' or 'script' 
 * @param string $location                      - 'header' or 'footer'
 * @param array['$key' => '$value'] $attributes - Array of attributes to add to the tag.
 */
\PHPageBuilder\Extensions::registerAsset($src, $type, $location, $attributes = []);

// Registering assets:

\PHPageBuilder\Extensions::registerAsset('/assets/bootstrap.css', 'style', 'header');
\PHPageBuilder\Extensions::registerAsset('/assets/alpine.min.js', 'script', 'header', [
    'defer' => true
]);