PHPackages                             superinteractive/super-structured-data - 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. superinteractive/super-structured-data

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

superinteractive/super-structured-data
======================================

Structured data schema orchestration for Laravel with optional Statamic support.

2.0.0(2mo ago)022↓66.7%[1 PRs](https://github.com/superinteractive/super-structured-data/pulls)MITPHPPHP ^8.4CI passing

Since Feb 24Pushed 2mo agoCompare

[ Source](https://github.com/superinteractive/super-structured-data)[ Packagist](https://packagist.org/packages/superinteractive/super-structured-data)[ RSS](/packages/superinteractive-super-structured-data/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (20)Versions (6)Used By (0)

Super Structured Data
=====================

[](#super-structured-data)

`superinteractive/super-structured-data` provides a small schema runtime for JSON-LD in Laravel applications, with optional Statamic-aware context support.

Features
--------

[](#features)

- Auto-discovers schema classes from `app/Schemas` or a configured schema path.
- Renders JSON-LD with a zero-prop Blade component: ``.
- Supports three schema styles: `BaseSchema`, `ModelSchema`, and `StatamicSchema`.
- Ships with optional config publishing and homepage schema stubs.
- Includes `make:schema`, `make:schema --model`, and `make:schema --statamic`.

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

[](#installation)

```
composer require superinteractive/super-structured-data
```

Optional Configuration
----------------------

[](#optional-configuration)

```
php artisan vendor:publish --tag=structured-data-config
```

Publish the config only if you want to disable rendering or move schemas out of `app/Schemas`.

Publish Homepage Schema Stubs
-----------------------------

[](#publish-homepage-schema-stubs)

```
php artisan vendor:publish --tag=structured-data-homepage-schemas
```

This publishes:

- `app/Schemas/HomepageOrganizationSchema.php`
- `app/Schemas/HomepageWebsiteSchema.php`

If you changed `structured-data.schema_path`, the stubs publish into that configured schema directory instead.

Rendering
---------

[](#rendering)

Render structured data in Blade with no props:

```

```

The package resolves the current request context automatically.

Create a New Schema
-------------------

[](#create-a-new-schema)

Artisan:

```
php artisan make:schema Home
php artisan make:schema Product --model
php artisan make:schema Article --statamic
```

Statamic please:

```
php please make:schema Home
php please make:schema Product --model
php please make:schema Article --statamic
```

The command appends `Schema` automatically. The `--model` and `--statamic` flags are mutually exclusive.

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

[](#configuration)

Default package config:

```
return [
    'enabled' => true,
    'schema_path' => 'Schemas',
];
```

### Advanced: Override the Context Factory Binding

[](#advanced-override-the-context-factory-binding)

If you need app-specific context resolution, bind your own factory in a service provider:

```
$this->app->singleton(
    \Superinteractive\StructuredData\Contracts\SchemaContextFactoryContract::class,
    \App\StructuredData\CustomContextFactory::class,
);
```

Your custom factory must implement `Superinteractive\StructuredData\Contracts\SchemaContextFactoryContract` and return a context implementing `SchemaContextContract`. If you want it to work with `StatamicSchema`, return a context that also implements `StatamicContextContract`.

Writing Schemas
---------------

[](#writing-schemas)

Reference material:

- Spatie schema-org GitHub: [spatie/schema-org](https://github.com/spatie/schema-org)
- Schema.org reference types: [schema.org/docs/full.html](https://schema.org/docs/full.html)

### BaseSchema

[](#baseschema)

Use `BaseSchema` when route-level metadata is enough.

```
