Core Integration

Laravel Bootstrap and Configuration

Configure contexts, middleware, custom modules, custom PropTypes, and key runtime options.

Bootstrap and Configuration

ccast/tagixo integrates with Laravel through standard package auto-discovery. This page covers publishing the config file, every real top-level key in config/tagixo.php, the Tagixo facade API, registration patterns, model and renderer overrides, and the TagixoInstalled event.

If you are using an admin panel SDK, refer to the Filament or Primix SDK documentation sections.


Publishing and Initial Setup

After adding the package via Composer, publish the artefacts you need:

# Publishes config/tagixo.php
php artisan vendor:publish --tag=tagixo-config

# Publishes public/vendor/tagixo/ (JS + CSS bundles)
php artisan vendor:publish --tag=tagixo-assets

# Optional: copies migrations into database/migrations/
# Only needed when you want to customise column types before running them.
php artisan vendor:publish --tag=tagixo-migrations

# Run migrations (or rely on auto_load_migrations — see below)
php artisan migrate

Commit public/vendor/tagixo/. Production Docker images typically run composer install --no-scripts, which skips vendor:publish. Commit the published assets so the image ships the correct JS and CSS without a post-install hook. Re-run vendor:publish --tag=tagixo-assets --force locally after every package version bump, then commit the result.

The package is auto-discovered via Laravel's package discovery. No manual entry in config/app.php is required.


config/tagixo.php — Top-Level Sections

After publishing, the file lives at config/tagixo.php. The sections below match the actual keys in that file.

contexts

Defines the builder contexts available in this installation. Each context has a label, icon, description, and enabled flag. The default set is page, form, mail, and pdf. You can disable contexts by setting enabled => false or add custom entries.

pdf

PDF engine capabilities. The only key is text_gradient (default false). Set to true only when you render PDFs through a Chromium-based engine (e.g. Spatie Browsershot) that can paint gradient text fills — dompdf cannot.

styling

Static palette used to populate styling controls: padding and margin (arrays of step values) and colors (a map of role → hex). These are defaults for the builder UI, not CSS custom properties.

auto_discover

Boolean (default true). Controls automatic component discovery.

models

Array of Eloquent model registrations available for dynamic data bindings. Equivalent to calling Tagixo::registerModels([...]) at runtime. See Data Models and Global Variables for the full registration format (short form, long form with relationships, only, except, aliases).

core_models

Map of internal entity keys to Eloquent class names. Swap any built-in model with your own subclass here. Every internal service resolves models through this map, so the switch is transparent. Keys: page, mail, pdf, slider, popup, global_block, form_schema, layout, menu.

renderers

Map of renderer keys to renderer class names. Swap PageRenderer, MailRenderer, or PdfRenderer with your own subclass. Keys: page, mail, pdf.

policies

Map of Tagixo model class → policy class. Entries are registered via Gate::policy() at boot. Leave an entry as null to keep that model unrestricted.

modules

Array of additional module class names to register globally. Equivalent to Tagixo::registerModules([...]).

prop_types

Array of custom PropType class names. Equivalent to Tagixo::registerPropTypes([...]).

builder_types

Map of URL-segment key → handler class (must implement BuilderTypeContract). The package exposes a generic CRUD set under /tagixo/manage/{type}. Equivalent to Tagixo::registerBuilderTypes([...]).

enable_default_types

Boolean (env('TAGIXO_ENABLE_DEFAULT_TYPES', false)). When true, auto-registers DefaultPageType (under pages), DefaultMailType, and DefaultPdfType — providing a zero-config admin UI. Keep false when using the Filament or Primix SDK, which provide their own CRUD resources.

route_middleware

Middleware applied to all visual builder API routes (default ['web', 'auth']). Override to add tenant-aware or custom authentication middleware.

public_route_middleware

Middleware for routes reachable by anonymous visitors — currently the public form submission endpoint (default ['web']). Add throttling here to contain spam, e.g. ['web', 'throttle:10,1'].

routes

Boolean toggles for each route group. All default to true (via env()). Available keys:

builder, builder_types, library, templates, cloud, layouts, menus,
form_builder, media_gallery, icons, fonts, module_render, frontend, testing

The frontend group also requires tagixo.frontend.enabled; the testing group also requires tagixo.testing_routes. Both flags must be on for the group to register. SDK adapters (Filament, Primix) typically disable builder_types since the host framework provides its own page/mail/pdf CRUD.

cloud

Tagixo Cloud Template Library settings. Keys: url (default https://api.tagixo.com) and license_key (env('TAGIXO_LICENSE_KEY')).

testing_routes

Boolean (env('TAGIXO_TESTING_ROUTES', false)). Registers /tagixo-test/* harness endpoints for the Playwright e2e suite. Never registers in the production environment regardless of this flag.

icons

Icon picker configuration. Keys: auto_discover (default true), cache (default true), disabled_sets (array of set names to hide), variant_schemes (map of set name → filename-prefix variants). Any Blade Icons package you composer require is discovered automatically.

frontend

Auto-exposed public routes that serve builder pages. Keys:

Key Default Description
enabled true Master switch for the frontend layer.
auto_routes false Register the catch-all /{path?} route automatically.
prefix '' URL prefix for the catch-all route.
middleware ['web'] Middleware applied to the public page route.
layout tagixo::frontend.page Full-document Blade view.
embed_view tagixo::frontend.embed Partial Blade view used by <x-tagixo-page>.
home_slug home Slug resolved when visiting /.
model Page::class Page model class (override to extend).

cache

Output caching. Keys: enabled (env('TAGIXO_CACHE', true)) and ttl in seconds (env('TAGIXO_CACHE_TTL', 3600)). Set enabled to false during development for immediate updates.

preview

Signed preview URL behaviour. Key: url_ttl_seconds (env('TAGIXO_PREVIEW_URL_TTL', 300)). Preview URLs bypass the "published" gate behind a short-lived signed URL that requires auth and a _preview=1 flag.

media_gallery

Integrated media library. Most-used keys: disk (env('MEDIA_GALLERY_DISK', 'public')), storage_path, allowed_types, max_file_size (in KB, default 102400), thumbnail, model (defaults to the built-in Media class).

auto_load_migrations

Boolean (default true). When true, the plugin loads its migrations directly from the package path — no publish step needed. Set to false if you have published the migrations and need to modify column types before running them.

scaffolding

Used by make:tagixo-* artisan generators. Keys: path (relative to base_path(), default app/tagixo) and namespace (derived automatically from path if null). Override per-command with --path / --namespace.

templates

Template versioning settings: versioning (bool), max_versions, auto_save (bool), auto_save_interval (seconds).

code_snippet

Languages offered in the Code Snippet module's dropdown, as a value => label map. Defaults to PHP, JavaScript, HTML, and CSS. Add any language supported by tempest/highlight.

mail

Key: restrict_adhoc_smtp_to_public_hosts (env('TAGIXO_MAIL_RESTRICT_ADHOC_SMTP', true)). When true, caller-supplied SMTP hosts that resolve to private/loopback/reserved addresses are refused — guards the test-send path against SSRF. Set to false only when that path is never fed untrusted input.


Service Provider Registration

Register custom types inside a service provider's boot() method, after the plugin has booted:

// app/Providers/AppServiceProvider.php

use Ccast\Tagixo\Facades\Tagixo;

public function boot(): void
{
    Tagixo::registerModules([MyModule::class, AnotherModule::class]);
    Tagixo::registerPropTypes([MyPropType::class]);

    // Data model bindings for dynamic content
    Tagixo::registerModels([
        'products' => [
            'class'         => \App\Models\Product::class,
            'label'         => 'Products',
            'relationships' => ['category', 'tags'],
            'only'          => ['id', 'name', 'price', 'slug'],
        ],
    ]);

    // Custom builder type (standalone, no SDK)
    Tagixo::registerBuilderType('blog-posts', BlogPostType::class);

    // Form actions and hooks
    Tagixo::registerFormAction(SendContactEmailAction::class);
    Tagixo::registerFormHook(NotifySlackHook::class);

    // App-form previewer (callable, not a class name)
    Tagixo::registerAppFormPreviewer(function (int|string $formId): ?string {
        return route('admin.forms.preview', $formId);
    });
}

registerAppFormPreviewer accepts a callable (closure or invokable), not a class name implementing an interface. The callable receives the form ID and must return a preview URL string or null.


Listening to the TagixoInstalled Event

After php artisan tagixo:install completes, the package fires Ccast\Tagixo\Events\TagixoInstalled. Use it to conditionally seed content:

use Ccast\Tagixo\Events\TagixoInstalled;

Event::listen(TagixoInstalled::class, function (TagixoInstalled $event) {
    if ($event->starterContentSeeded) {
        // starter content was already inserted; skip your own seeder
        return;
    }

    // seed custom pages or global variables
});

Swapping Core Models

To extend the built-in Page model with your own attributes or scopes:

// app/Models/Page.php
namespace App\Models;

class Page extends \Ccast\Tagixo\Models\Page
{
    protected $appends = ['reading_time'];

    public function getReadingTimeAttribute(): int
    {
        // ...
    }
}

Then point core_models.page to your class:

// config/tagixo.php
'core_models' => [
    'page' => \App\Models\Page::class,
    // other entries remain unchanged
],

The DefaultPageType, frontend auto-routes, and all internal services resolve the new class automatically. The same pattern applies to mail, pdf, slider, popup, global_block, form_schema, layout, and menu.


Swapping Renderers

Extend PageRenderer to customise the HTML output pipeline:

// app/Renderers/PageRenderer.php
namespace App\Renderers;

class PageRenderer extends \Ccast\Tagixo\Renderers\PageRenderer
{
    public function renderWithLayout(\Ccast\Tagixo\Models\Page $page): string
    {
        $html = parent::renderWithLayout($page);
        return $this->injectAnalyticsSnippet($html);
    }
}

Register it via config:

// config/tagixo.php
'renderers' => [
    'page' => \App\Renderers\PageRenderer::class,
],

All app(PageRenderer::class) calls inside the plugin resolve your subclass.


See also