Search by

patrickzuurbier / velor-cms-pages

patrickzuurbier

Pages and paragraphs content-management package for Velor.

Package info

github.com/patrickzuurbier/velor-cms-pages

pkg:composer/patrickzuurbier/velor-cms-pages

Statistics

Installs: 0

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

1.8.1 2026-11-24 11:37 UTC

README

Velor

Velor CMS Pages

Pages is a first-party content-management package for Velor. It owns the page and paragraph vertical slice and uses Velor extension points for resources, routes, menu items, policies, privileges, translations, migrations, and tests.

This package owns Page and Paragraph models, factories, migrations, seeders, controllers, form requests, resource classes, policies, resource translations, resource registration, policy registration, Velor menu registration, and Velor routes.

Contents

Installation

Install the package in a Velor application:

composer require patrickzuurbier/velor-cms-pages:^1.8

This package requires PHP ^8.4.1 and Velor ^1.26.

The package service provider is auto-discovered by Laravel. It registers resources, policies, Velor menu items, Velor routes, translations, and migrations.

Link Targets

The package exposes active pages and active paragraph anchors to Velor Link fields. Page targets use /{slug} and paragraph targets use /{slug}#{anchor} for each available translation. Selecting a target stores only those URLs in the resource using the Link field.

Publish the package migrations when the application should own them:

php artisan vendor:publish --tag=velor-pages-migrations

Then run the database migrations:

php artisan migrate

Optionally run the package seeders for local data:

php artisan db:seed --class='Velor\Pages\Database\Seeders\PagesTableSeeder'
php artisan db:seed --class='Velor\Pages\Database\Seeders\ParagraphsTableSeeder'

The seeders do not need to be published before running them. Publish them only when the host application should customize the seed data; after publishing, adjust the seeder namespace to the host application's seeder namespace before running the published copies.

Package Contents

src/Models/Page.php
src/Models/Paragraph.php
src/Resources/PageResource.php
src/Resources/ParagraphResource.php
src/Http/Controllers/PageController.php
src/Http/Controllers/ParagraphController.php
src/Http/Requests/PageRequest.php
src/Http/Requests/ParagraphRequest.php
src/Policies/PagePolicy.php
src/Policies/ParagraphPolicy.php
database/migrations
database/seeders
lang/en/resources.php
lang/nl/resources.php
routes/velor.php
tests

Routes

Velor routes live in routes/velor.php. The service provider loads that file through Velor's route registrar, so this package does not define the global velor prefix or middleware itself. The route names and URLs remain the same as the original host application routes.

Paragraphs use Velor core row ordering:

POST /velor/resource-row-order/paragraphs

The package marks the Paragraph model as row-orderable and scopes ordering by page_id, so paragraphs can only be reordered inside the current page. The endpoint is protected by the Paragraph policy's reorder ability.

Models And Factories

The package models extend Velor's AbstractModel and explicitly resolve their package factories, so Page::factory() and Paragraph::factory() keep working while the package is developed through a Composer path repository.

Controllers

The package controllers declare their resource classes through Velor's AbstractResourceController, so the shared resource middleware authorizes standard actions through the registered Page and Paragraph policies before the controllers render the generic index, show, and form views.

Form Requests

The package form requests use Velor's resource validation factories so validation remains defined by the package resources.

Resources

The service provider registers the package Page and Paragraph resource classes through Velor's ResourceRegistryInterface.

The Paragraph resource uses Velor's core RichText field for textual content and a separate core ImageUpload field for one optional contextual image. Its position can be set above, left, or right of the paragraph text.

Velor Menu

The package registers its menu item through Velor's VelorMenuItemRegistryInterface. Newly registered package items are appended by default; the consuming application determines their fixed grouping and position through velor-menu.php.

Policies

The service provider registers the package Page and Paragraph policies through Velor's PolicyRegistryInterface. Registered policies are also exposed to role privileges by default.

Publishing

The package should remain in vendor by default. Publish only project-owned files:

php artisan vendor:publish --tag=velor-pages-migrations
php artisan vendor:publish --tag=velor-pages-seeders
php artisan vendor:publish --tag=velor-pages-lang

Optional override tags can be added later when a package-owned customization surface is intentionally designed.

Testing

Package tests live in tests and verify provider boot, resource, policy, and Velor-menu registration, routes, translations, factories, and migrations against a consuming Velor test application.

Uninstalling

The package can be removed from a consuming application with Composer:

composer remove patrickzuurbier/velor-cms-pages

Velor core should continue to boot without this package. Package-owned routes, resources, policies, Velor menu items, translations, and loaded migrations disappear with the package. Existing database tables and published files are project data and are not deleted automatically by Composer.

License

This package is open-sourced software licensed under the MIT license.

Development Notes

Pages and paragraphs belong together. The package owns their models, factories, migrations, seeders, relationship, tabs, ordering, translated fields, slugs, anchors, and rich text configuration.

Velor core must not contain page-specific route, menu, or field logic after this package is installed.