Horizon Blocks is a versatile library designed to integrate seamlessly with Horizon Tools, enabling you to create and reuse blocks across multiple sites with ease.
- Automatic Block Management: Effortlessly list and import blocks into your project using the
import:block
command. - Simplified Block Creation: Easily define new base blocks by adding class and template files.
To set up Horizon Blocks in your project, follow these steps:
-
Configure Composer Repository:
Update your
composer.json
file to include Horizon Blocks as a repository. Make sure to add the appropriate repository configuration under the"repositories"
section.
{
"type": "vcs",
"url": "git@github.com:agence-adeliom/horizon-blocks.git"
}
- Install the Package:
composer require agence-adeliom/horizon-blocks
- Import Existing Blocks: Use the
import:block
command to view and import blocks available for your project.
Here’s a quick guide to setting up a new block:
-
Define a Block Class:
- Path:
src/Blocks/MyCustomBlock.php
- Content:
<?php namespace App\Blocks; class MyCustomBlock { // Define block logic here }
- Path:
-
Create a Block Template:
- Path:
resources/views/blocks/my-custom-block.blade.php
- Content:
<div> <!-- Block content goes here --> </div>
- Path: