Search by

patrickzuurbier / velor-cms-site-information

patrickzuurbier

Site Information resource package for Velor.

Package info

github.com/patrickzuurbier/velor-cms-site-information

pkg:composer/patrickzuurbier/velor-cms-site-information

Statistics

Installs: 0

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

1.6.1 2026-11-24 11:48 UTC

This package is auto-updated.

Last update: 2026-11-24 11:50:14 UTC


README

Velor

Velor Site Information

Site Information is a first-party Velor content-management package for structured, website-facing data such as company details, contact information, locations, social links, and reusable SVG assets. It is separate from authenticated user settings and from application configuration.

Contents

Requirements

  • PHP ^8.4.1
  • Velor ^1.26

Installation

Install the package through Composer:

composer require patrickzuurbier/velor-cms-site-information:^1.6

Laravel discovers SiteInformationServiceProvider automatically. Run the package migrations with the host application migrations:

php artisan migrate

Package Registration

The package service provider registers:

  • the Site Information subject and field resources;
  • their policies and role privileges;
  • the authenticated Velor routes and sidebar item, which is appended unless velor-menu.php assigns it a fixed position;
  • repository interface bindings;
  • package migrations, translations, and views.

Installing the package always enables these integrations. The package has no enable/disable configuration option.

Standard subject and field resource routes use their registered policies through Velor's central resource authorization. Parent-subject access, value management, reordering, and contextual delete actions retain their explicit policy checks.

Data Model

Site Information uses two Eloquent models:

Model Purpose
Velor\SiteInformation\Models\SiteInformationSubject An ordered group with a stable key and default collapsed state.
Velor\SiteInformation\Models\SiteInformation An ordered, typed, nullable value inside a subject.

Subjects may be roots or children of a root subject. The package only accepts root subjects as parents, which limits the managed hierarchy to two levels. Subject ordering is scoped by parent_id; field ordering is scoped by site_information_subject_id.

Deleting a subject cascades to its child subjects and fields. Both models use UUID primary keys and participate in Velor auditing and row ordering.

Field Types

Velor\SiteInformation\Enums\SiteInformationFieldTypeEnum defines the supported value types:

Type Validation
text Nullable string with a maximum of 255 characters.
textarea Nullable string with a maximum of 255 characters.
email Nullable email address with a maximum of 255 characters.
url Nullable URL with a maximum of 2048 characters.
svg Nullable SVG markup accepted by the core SvgMarkup rule.

Phone numbers, postal codes, and other organization-specific formats use text.

Reading Site Information

Application code can inject Velor\SiteInformation\Repositories\Contracts\SiteInformationRepositoryInterface. Its all() method returns all SiteInformation models; use each model's stable key, cast type, nullable value, and subject relationship to map the package data into website view data.

use Velor\SiteInformation\Repositories\Contracts\SiteInformationRepositoryInterface;

final class SiteInformationViewData
{
    public function __construct(
        private SiteInformationRepositoryInterface $siteInformation,
    ) {
    }

    public function values(): array
    {
        return $this->siteInformation
            ->all()
            ->pluck('value', 'key')
            ->all();
    }
}

The repository contract is bound by the package service provider; consumers do not need to bind its concrete implementation.

Default Structure

The package migrations create an idempotent default structure with these root subjects:

  • Company;
  • Contact Information, with Location 1, Location 2, and Location 3 children;
  • Social Media.

The structure includes common company, address, contact, and social fields. Existing field values are preserved when the default-structure migration finds matching records.

SVG Storage

SVG values remain in the site_information.value database column. The package also writes each non-empty SVG value to the Laravel s3 filesystem disk at:

svgs/{field-key}.svg

The filename uses a slug of the final dot-separated segment of the field key. For the default company-logo key, the path is svgs/company-logo.svg.

Clearing or deleting an SVG field removes its file. Changing a field away from the SVG type removes its previous file. Deleting a subject also removes SVG files owned by that subject and its direct children before database cascades remove the records.

Publishing Package Files

The package loads its own migrations, translations, and views by default. Publish only files the host application intentionally needs to own or override:

php artisan vendor:publish --tag=velor-site-information-migrations
php artisan vendor:publish --tag=velor-site-information-lang
php artisan vendor:publish --tag=velor-site-information-views

Published files become application-owned copies and no longer receive package changes automatically.

License

Velor Site Information is open-sourced software licensed under the MIT license.