PHPackages                             sirgrimorum/pages - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. sirgrimorum/pages

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

sirgrimorum/pages
=================

Content manager by pages for Laravel 5.6

1.3.3(2mo ago)0239↓50%MITPHPPHP ^8.2CI failing

Since Apr 6Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/sirgrimorum/pages)[ Packagist](https://packagist.org/packages/sirgrimorum/pages)[ Docs](https://github.com/sirgrimorum/pages)[ RSS](/packages/sirgrimorum-pages/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (11)Versions (20)Used By (0)

Pages
=====

[](#pages)

[![Latest Version on Packagist](https://camo.githubusercontent.com/d10760e464c33234ef96ea6724c79f279a0b901b2cbe1f4b3e6744226463268a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7369726772696d6f72756d2f70616765732e7376673f7374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/d10760e464c33234ef96ea6724c79f279a0b901b2cbe1f4b3e6744226463268a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7369726772696d6f72756d2f70616765732e7376673f7374796c653d666c61742d737175617265)[![PHP Version](https://camo.githubusercontent.com/75d4692f683a548b8105174be27e0eaaa671629a15d3f3bc5bf0d0713867cfab/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f7369726772696d6f72756d2f70616765732e7376673f7374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/75d4692f683a548b8105174be27e0eaaa671629a15d3f3bc5bf0d0713867cfab/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f7369726772696d6f72756d2f70616765732e7376673f7374796c653d666c61742d737175617265)[![Total Downloads](https://camo.githubusercontent.com/80b1166a1fcda17441aa63e7b84824698c8b1c9152f414860acee74dd130c139/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7369726772696d6f72756d2f70616765732e7376673f7374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/80b1166a1fcda17441aa63e7b84824698c8b1c9152f414860acee74dd130c139/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7369726772696d6f72756d2f70616765732e7376673f7374796c653d666c61742d737175617265)[![License](https://camo.githubusercontent.com/2d40a6dc7dae890e75c0e7af894c4b24315c5471d7517b1091b12e64ef601930/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f7369726772696d6f72756d2f70616765732e7376673f7374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/2d40a6dc7dae890e75c0e7af894c4b24315c5471d7517b1091b12e64ef601930/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f7369726772696d6f72756d2f70616765732e7376673f7374796c653d666c61742d737175617265)

Database-driven page and section manager for Laravel. Define structured pages composed of independent sections, control access per page or section via policy closures, inject dynamic content from Eloquent collections, and wire everything into AutoMenu navigation — all from configuration.

Features
--------

[](#features)

- **Database-backed pages and sections** — manage content via CRUD admin (requires sirgrimorum/crudgenerator)
- **Composable sections** — pages are assembled from ordered, independently-controlled sections
- **Policy-based access control** — flexible wildcard pattern rules per page and section name
- **Special sections** — inject dynamic content (Blade templates, model collections, method results) into page content via `{%%name%%}` placeholders
- **AutoMenu integration** — automatically populate a menu with all accessible pages
- **Localized routes** — optional URL localization out of the box
- **Blade directives** — render pages and sections from any template
- **Seeder generation** — dump pages/sections to a seed file with one command

Requirements
------------

[](#requirements)

- PHP &gt;= 8.2
- Laravel &gt;= 9.0
- sirgrimorum/transarticles ^1.3
- sirgrimorum/crudgenerator ^3.8

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

[](#installation)

```
composer require sirgrimorum/pages
```

### Run migrations

[](#run-migrations)

```
php artisan migrate
```

Creates the `paginas` (pages) and `sections` tables.

### Publish configuration

[](#publish-configuration)

```
php artisan vendor:publish --provider="Sirgrimorum\Pages\PagesServiceProvider" --tag=config
```

Publishes `config/sirgrimorum/pages.php`.

### Publish language files (optional)

[](#publish-language-files-optional)

```
php artisan vendor:publish --provider="Sirgrimorum\Pages\PagesServiceProvider" --tag=lang
```

### Publish views (optional)

[](#publish-views-optional)

```
php artisan vendor:publish --provider="Sirgrimorum\Pages\PagesServiceProvider" --tag=views
```

### Register CRUD configurations

[](#register-crud-configurations)

```
php artisan pages:registercrud
```

Registers the `Pagina` and `Section` models with CrudGenerator so they can be managed via the admin interface.

Configuration
-------------

[](#configuration)

`config/sirgrimorum/pages.php`

### Routing

[](#routing)

```
'with_routes' => true,   // Auto-register package routes
'localized'   => true,   // Prefix routes with locale: /{locale}/...
'group_name'  => 'paginas.',
'group_prefix' => '',    // Additional URL prefix
```

### View layout

[](#view-layout)

```
'extends' => 'layouts.app',  // Parent Blade layout
'content' => 'content',      // @section name for page content
```

### Asset injection

[](#asset-injection)

```
'js_section'  => 'scripts',  // @push stack name for JS
'css_section' => 'styles',   // @push stack name for CSS
```

### Access control policies

[](#access-control-policies)

Define access rules using name patterns. More specific patterns take precedence.

```
'paginas_policies' => [
    '_general' => fn() => true,                         // all pages (default)
    'admin*'   => fn() => Auth::user()?->isAdmin(),     // pages starting with "admin"
    '*private' => fn() => Auth::check(),                // pages ending with "private"
    '*secret*' => fn() => false,                        // pages containing "secret"
    'dashboard' => fn() => Auth::check(),               // exact match
],
'sections_policies' => [
    '_general' => fn() => true,
],
```

Pattern matching rules (in order of precedence):

1. `pageName` — exact match
2. `*name` — ends with "name"
3. `name*` — starts with "name"
4. `*name*` — contains "name"
5. `_general` — catch-all

### Special sections

[](#special-sections)

Special sections let you inject dynamic content into pages using `{%%name%%}` placeholders in page templates.

```
'special_sections' => [
    'featured_posts' => [
        'type'      => 'collection',             // 'simple', 'collection', or 'model'
        'isModel'   => App\Models\Post::class,
        'function'  => 'getFeatured',            // Method to call on the model
        'template'  => 'partials.featured_post', // Blade template for each item
    ],
    'site_notice' => [
        'type'     => 'simple',
        'template' => 'partials.site_notice',   // Just renders a Blade view
    ],
],
```

In your page template (stored in the database):

```
{%%content%%}
{%%featured_posts%%}
{%%site_notice%%}
```

Usage
-----

[](#usage)

### Render a page

[](#render-a-page)

```
{{-- Render the first accessible page --}}
@load_page()

{{-- Render a specific page by name --}}
@load_page('home')

{{-- Render a page with custom config --}}
@load_page('home', 'sirgrimorum/pages')
```

### Render a single section

[](#render-a-single-section)

```
@load_section('hero-banner')
```

### Build an AutoMenu config with pages

[](#build-an-automenu-config-with-pages)

```
use Sirgrimorum\Pages\Pages;

// Inject all accessible pages into position 2 of the left nav
$menuConfig = Pages::getAutoMenuConfig(2, 'izquierdo', config('sirgrimorum/menus/main'));
echo AutoMenu::buildAutoMenu('main-nav', '', $menuConfig);
```

### Check access programmatically

[](#check-access-programmatically)

```
use Sirgrimorum\Pages\Pages;

if (Pages::hasAccessToPagina($page)) {
    // user can see this page
}

if (Pages::hasAccessToSection($section)) {
    // user can see this section
}
```

API Reference
-------------

[](#api-reference)

### `Pages::buildPage()`

[](#pagesbuildpage)

```
Pages::buildPage(
    mixed  $name   = '',  // Page name, ID, object, or '' for first allowed
    mixed  $config = '',  // Config array or path
    mixed  $sections = '' // Sections array override
): string
```

Returns the rendered HTML for the page, including all its sections.

### `Pages::buildSection()`

[](#pagesbuildsection)

```
Pages::buildSection(mixed $name, mixed $config = ''): string
```

Returns the rendered HTML for a single section.

### `Pages::getFirstAllowedPage()`

[](#pagesgetfirstallowedpage)

```
Pages::getFirstAllowedPage(): ?Pagina
```

Returns the first page the current user is allowed to view.

### `Pages::getAutoMenuConfig()`

[](#pagesgetautomenuconfig)

```
Pages::getAutoMenuConfig(
    int    $offset,   // Position to insert pages in the menu array
    string $lado,     // Menu side: 'izquierdo' or 'derecha'
    array  $automenu  // Existing menu structure to inject into
): array
```

### Blade directives

[](#blade-directives)

```
@load_page(string $name = '', mixed $config = '')
@load_section(string $name, mixed $config = '')
```

Artisan Commands
----------------

[](#artisan-commands)

CommandDescription`pages:registercrud`Register Pagina and Section models with CrudGenerator`pages:createseed`Generate a seed file from the current pages/sections data`pages:registermiddleware`Register package middleware in the applicationLicense
-------

[](#license)

The MIT License (MIT). See [LICENSE.md](LICENSE.md).

###  Health Score

52

—

FairBetter than 96% of packages

Maintenance85

Actively maintained with recent releases

Popularity15

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity84

Battle-tested with a long release history

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 ~160 days

Recently: every ~456 days

Total

19

Last Release

78d ago

Major Versions

0.9.1 → 1.0.12018-04-06

PHP version history (3 changes)0.9.1PHP &gt;=7.0

1.3.0PHP ^8.0

1.3.3PHP ^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/38ced8f27be30def379c1900bf2a56c7e682180f6a693f17d8168e4e74b8ca82?d=identicon)[sirgrimorum](/maintainers/sirgrimorum)

---

Tags

cmspagessirgrimorum

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/sirgrimorum-pages/health.svg)

```
[![Health](https://phpackages.com/badges/sirgrimorum-pages/health.svg)](https://phpackages.com/packages/sirgrimorum-pages)
```

###  Alternatives

[winter/storm

Winter CMS Storm Library

46239.3k6](/packages/winter-storm)

PHPackages © 2026

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