Skip to content

Laravel plugin

diazoma/laravel serves a cursor feed, the /.well-known/wall.json manifest and an optional /xr embed page from a Laravel 12 or 13 app. It needs PHP 8.4 or newer.

In your composer.json:

"repositories": [{"type": "vcs", "url": "https://github.com/escapeboy/diazoma-laravel"}]

Then:

composer require diazoma/laravel:^0.1
php artisan vendor:publish --tag=diazoma-config

Once it is on Packagist, composer require diazoma/laravel works without the repositories entry. The package is Apache-2.0.

The service provider is auto-discovered. Routes are registered only when diazoma.enabled is true.

Implement Diazoma\Laravel\Contracts\WallFeed, or use the trait for an Eloquent model:

use Diazoma\Laravel\Concerns\ProducesWallFeed;
use Diazoma\Laravel\Contracts\WallFeed;
use Diazoma\Laravel\Support\WallItem;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
class ListingFeed implements WallFeed
{
use ProducesWallFeed;
protected function wallQuery(): Builder { return Listing::query()->where('published', true); }
protected function wallSort(): array { return ['created_at' => 'desc']; }
protected function wallItem(Model $m): WallItem
{
return new WallItem(id: (string) $m->getKey(), link: "/listing/{$m->getKey()}", image: $m->thumb_url, aspect: 1.5, title: $m->title);
}
protected function wallSearchColumns(): array { return ['title']; } // optional, enables ?q=
protected function wallFilters(): array { return ['type' => 'kind']; } // optional, ?type=video (also list it in diazoma.manifest.filters)
}

wallFilters() filters the query on the server. The wall shows a filter only when the manifest declares it, so add the same filter to diazoma.manifest.filters too.

Register it in config/diazoma.php:

'feeds' => ['latest' => ['class' => ListingFeed::class, 'title' => 'Latest', 'search' => true]],

A list with no pictures (laws, council decisions, news) is a list of text cards: leave out image and aspect, and give the item a title. excerpt, date and accent fill the rest of the card. See Text cards.

protected function wallItem(Model $m): WallItem
{
return new WallItem(
id: (string) $m->getKey(),
link: "/act/{$m->ref}",
title: $m->title,
subtitle: $m->issuer, // under the title
badges: [$m->type], // the first badge is the kicker on the card
excerpt: $m->summary, // plain text, cut to 500 characters
date: $m->published_at, // a DateTimeInterface or an ISO 8601 string
accent: '#7a1f2b', // optional: the colour of the top band
);
}

WallItem throws when an item has an image and no aspect, or neither an image nor a title. Text cards and picture cards can be mixed in one feed.

The feed is served at GET /wall/feed/latest?cursor=&q=&limit=. The prefix comes from route_prefix.

Paging is keyset-based over the sort columns plus the primary key, so UUID and integer keys both work and rows that share a sort value are not repeated or skipped. A malformed cursor returns the first page.

Give video (an mp4/webm file, an HLS .m3u8 or a DASH .mpd) and the item is a video card: WallItem sets media_type to video and video_type from the path. More named arguments: mediaType, videoType, videoSources (up to 8 renditions), duration (seconds) and unplayable.

return new WallItem(
id: (string) $m->getKey(),
link: "/clip/{$m->getKey()}",
image: $m->poster_url,
aspect: 16 / 9,
video: $m->hls_url,
videoSources: [
['src' => $m->mp4_480, 'height' => 480],
['src' => $m->mp4_1080, 'height' => 1080, 'codecs' => 'avc1.640028'],
],
duration: $m->seconds,
);

A YouTube or Vimeo URL in video becomes media_type: video and unplayable with the embed URL, and a YouTube item with no image gets YouTube’s thumbnail. Invalid video input (a non-web URL, a ninth source, a negative duration) is dropped. See Video.

/.well-known/wall.json is built from diazoma.manifest and the feeds list. It is not behind diazoma.middleware, so other programs can discover the site. The feed and embed routes do run through diazoma.middleware, for example your age gate.

Set diazoma.manifest.view to change how the wall looks for your site. It is copied into the manifest as it is, and an empty view is left out. The shape and limits are in View customization.

To serve the Level 3 page at /xr, set diazoma.embed.enabled (env DIAZOMA_EMBED=true). DIAZOMA_BASE_URL is the directory that holds diazoma-embed.js, wall.iife.js and loader.js, plus wall-hls.js and wall-dash.js for HLS and DASH video (without them such videos offer “watch in the browser”; mp4 still plays). It defaults to https://diazoma.app/wall/0.1.0, so a fresh install needs no hosting. Set it to host the files yourself. To advertise a wall that your host serves itself, leave embed.enabled off and set embed.advertise to true. The manifest then carries embed.route and the package does not register the route. Override the Blade view with the embed.view setting, or with your own resources/views/vendor/diazoma/embed.blade.php.

Diazoma\Laravel\Contracts\DeviceLink is an interface only. There is no implementation and no route. Its docblock lists the security rules an implementation must keep. See Actions and login.