PHPackages                             secondnetwork/voyager-page-blocks - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. secondnetwork/voyager-page-blocks

ActiveLibrary

secondnetwork/voyager-page-blocks
=================================

Ahoy! - A package to implement page blocks into Voyager

0.3.0(1mo ago)0261MITPHPPHP ^8.1

Since May 10Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/secondnetwork/voyager-page-blocks)[ Packagist](https://packagist.org/packages/secondnetwork/voyager-page-blocks)[ RSS](/packages/secondnetwork-voyager-page-blocks/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (5)Dependencies (4)Versions (6)Used By (0)

Voyager Page Blocks for Laravel 10
==================================

[](#voyager-page-blocks-for-laravel-10)

This repository is only Voyager Page Blocks not the Voyager Frontend Package

Prerequisites
-------------

[](#prerequisites)

- [Install Laravel 10](https://laravel.com/docs/installation)
- [Install Voyager 1.6](https://github.com/the-control-group/voyager)
- [Install Voyager Themes](https://github.com/thedevdojo/themes)

Installation
------------

[](#installation)

**1. Require this Package in your fresh Laravel/Voyager project**

```
composer require secondnetwork/voyager-page-blocks
```

**2. Run the Installer**

```
php artisan voyager-page-blocks:install
```

**3. (Optional) Seed the database with example page blocks.**

```
php artisan voyager-page-blocks:seed
```

Creating &amp; Modifying Blocks
-------------------------------

[](#creating--modifying-blocks)

Page blocks are created &amp; configured in 2 steps:

1. **Define** the block - in `/config/page-blocks.php`
2. **Build** the block's HTML layout - create the template in `/resources/views/vendor/voyager-page-blocks/blocks`

### 1. Define a Block

[](#1-define-a-block)

Familiarize yourself with `/config/page-blocks.php`. This is where you'll define each block - you'll tell it which fields the block should have (for the admin to manage) and which Blade template it should use on the frontend.

- Each array inside this configuration file is a page block
- Each block contains **fields**
- Each field contains a unique **field** key
- Each field is based on a **Voyager Data Type**

The below table explains what each property does and how it is relevant to the block itself:

KeyPurpose**Root key**This is the name of your page block, used to load the configurationnameThis is the display name of your page block, used in the block 'adder'fieldsThis is where your page block fields live (text areas, images etc)fields =&gt; fieldThe content name of your field, used to store/load its contentfields =&gt; display\_nameThe display name of this field in the back-endfields =&gt; typeThe data row type that this field will use (check `TCG\Voyager\FormFields`)fields =&gt; requiredSelf-explanatory, marks this field as required or not (not available for all partials)fields =&gt; placeholderSelf-explanatory, adds a placeholder to the field (not available for all partials)fields =&gt; detailsUsed for selects/checkboxes/radios to supply optionstemplateThis points to your blade file for your block templatecompatibleTBA### 2. Build the HTML

[](#2-build-the-html)

When you're ready to start structuring the display of your block, you'll need to create (or override our defaults) your blade template (located at `/resources/views/vendor/voyager-page-blocks/blocks/your_block.blade.php`) and use the accessors you defined in your module's configuration file to fetch each fields data (`{!! $blockData->image_content !!}`).

---

Example. Putting it all together
--------------------------------

[](#example-putting-it-all-together)

Let's say we want to create a new block with 1 WYSIWYG editor, called 'Company Overview'.

**Step 1. Define the new block**

In `/config/page-blocks.php`, we'll add:

```
$blocks['company_overview'] = [
    'name' => 'Company Overview',
    'template' => 'voyager-page-blocks::blocks.company_overview',
    'fields' => [
        'content' => [
            'field' => 'content',
            'display_name' => 'Company Overview Content',
            'type' => 'rich_text_box',
            'required' => 1,
            'placeholder' => 'Lorem ipsum dolor sit amet. Nullam in dui mauris.',
        ],
    ],
];
```

**Step 2. Build the Controller and Blade View**

**PagesController**

```
class PagesController extends Controller
{
    protected $theme = '';

    public function index()
    {
        $page = Page::where('slug', 'startseite');
        $page = $page->firstOrFail();
        $block = DB::table('page_blocks')
            ->where('page_id', '=', $page->id)
            ->where('is_hidden', '=', '0')
            ->orderBy('order', 'asc')
            ->get();
        return view('theme::pages.default', compact('page', 'block', 'posts'));
    }
```

**Blade View Template**

```
@if (!empty($block))
@foreach($block as $blockTemp)
    @if (!empty($blockTemp->type))
        @php
        $template = $blockTemp->path;
        $blockData = json_decode($blockTemp->data);
        @endphp

        @include('theme::blocks.'.$template)

    @else

                    >

    @endif
@endforeach
@else

  {{ $page->title }}

  {!! $page->body !!}

@endif
```

**Step 3. Add the block to a page**

Next, jump into the Voyager Admin &gt; Pages and click 'Content' next to a page. You'll now be able to select `Company Overview` from the 'Add Block' section. Add the block to the page, drag/drop it into place, edit the text etc.

---

Troubleshooting
---------------

[](#troubleshooting)

**It is important to sanitise your field output, null values will cause errors**.

It is very important that you follow the naming scheme that is setup in the example page blocks as the keys reference other cogs in the system to stitch the blocks together. There are example blocks already set up in the `resources/views` directory and configuration file for you to get started.

###  Health Score

41

—

FairBetter than 89% of packages

Maintenance89

Actively maintained with recent releases

Popularity13

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity47

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~261 days

Total

5

Last Release

57d ago

PHP version history (2 changes)0.1.0PHP ^7.4|^8.0

0.3.0PHP ^8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/6e64b418775fddc54a61b1e86ba0c71be539ff8cbe7016fd43c1c8acda647201?d=identicon)[secondnetwork](/maintainers/secondnetwork)

---

Top Contributors

[![secondnetwork](https://avatars.githubusercontent.com/u/13808106?v=4)](https://github.com/secondnetwork "secondnetwork (8 commits)")

---

Tags

laravellaravel-packagelaravel9phpvoyagerlaravelpageblocksfrontendvoyager

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/secondnetwork-voyager-page-blocks/health.svg)

```
[![Health](https://phpackages.com/badges/secondnetwork-voyager-page-blocks/health.svg)](https://phpackages.com/packages/secondnetwork-voyager-page-blocks)
```

###  Alternatives

[spatie/laravel-ignition

A beautiful error page for Laravel applications.

566146.7M471](/packages/spatie-laravel-ignition)[classiebit/eventmie

Run your own Events business with Eventmie Pro. Use it as event ticket selling website or event management platform on your own domain.

1872.0k](/packages/classiebit-eventmie)[joy/voyager-datatable

joy voyager datatable

1538.1k43](/packages/joy-voyager-datatable)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
