Search by

kidran / event-schedule-schema

Kidran

Laravel package for generating and validating Barq-compatible furry event schedule JSON.

Package info

github.com/kidran/event-schedule-schema

pkg:composer/kidran/event-schedule-schema

Statistics

Installs: 6

Dependents: 0

Suggesters: 0

Stars: 1

Open Issues: 0

v0.1.0 2026-07-29 22:51 UTC

This package is auto-updated.

Last update: 2026-10-06 21:23:14 UTC


README

Laravel/PHP Composer package for generating and validating Kidran-compatible furry event schedule JSON.

The package keeps the original JSON Schema files in schema/ and adds PHP DTOs, a fluent factory API, Laravel bindings, a validation rule, an Artisan command, and optional domain validation for cross-reference checks.

Installation

composer require kidran/event-schedule-schema

Laravel discovers the service provider automatically. To publish the config:

php artisan vendor:publish --tag=event-schedule-schema-config

To publish the bundled schema files into resources/event-schedule-schema/schema:

php artisan vendor:publish --tag=event-schedule-schema

Generate A Schedule

use Kidran\EventScheduleSchema\Facades\EventScheduleSchema as Schedule;

$event = Schedule::event(
    id: 'example-con',
    displayName: 'Example Convention',
    startTime: '3030-08-01T00:00:00Z',
    endTime: '3030-08-03T23:59:59Z',
    timezone: 'Europe/Berlin',
)->description('A generated event schedule.');

$schedule = Schedule::schedule($event, updatedAt: '3030-07-01T12:00:00Z')
    ->addVenue(Schedule::venue('venue-1', 'Convention Center'))
    ->addRoom(Schedule::room('room-1', 'Main Hall', 'venue-1'))
    ->addHost(Schedule::host('host-1', 'Host Name'))
    ->addSession(
        Schedule::session('session-1', 'Opening Ceremony')
            ->addTimeSlot(
                Schedule::timeSlot('3030-08-01T10:00:00+02:00', '3030-08-01T11:00:00+02:00')
                    ->rooms(['room-1'])
                    ->hosts(['host-1'])
            )
    );

$array = $schedule->toArray();
$json = $schedule->toJson();

Localized fields accept either a map like ['en-US' => 'Opening Ceremony'] or a string. Strings are stored under the configured default_locale, which defaults to en-US.

Validate

use Kidran\EventScheduleSchema\Validation\EventScheduleValidator;

$result = app(EventScheduleValidator::class)->validateFile(
    base_path('schedule.json'),
    domain: true,
);

if($result->fails()) {
    foreach ($result->errors() as $error) {
        echo "{$error->property}: {$error->message}".PHP_EOL;
    }
}

The validator accepts files, JSON strings, arrays, and EventSchedule objects.

Artisan Command

php artisan event-schedule:validate schedule.json
php artisan event-schedule:validate schedule.json --domain

Laravel Validation Rule

use Kidran\EventScheduleSchema\Rules\ValidEventSchedule;

$request->validate([
    'schedule' => [new ValidEventSchedule(domain: true)],
]);

DTOs

Available data objects:

  • EventSchedule
  • EventInfo
  • MembershipLevel
  • Track
  • SessionType
  • Label
  • Venue
  • Room
  • Host
  • Session
  • TimeSlot
  • ExternalLink

Each object supports fromArray() and toArray(). EventSchedule also supports fromJson() and toJson().

Validation Modes

JSON Schema validation checks the structural format from schema/furry-event-schedule-schema.json, including required fields, types, URI formats, date-time formats, and rejected additional properties.

Domain validation is optional and checks relationships that the current JSON Schema does not enforce:

  • rooms[*].venueId references an existing venue.
  • sessions[*].typeId references an existing session type.
  • sessions[*].trackId references an existing track.
  • sessions[*].labelIds[*] references existing labels.
  • sessions[*].allowedMembershipLevelIds[*] references existing membership levels.
  • sessions[*].timeSlots[*].roomIds[*] references existing rooms.
  • sessions[*].timeSlots[*].hostIds[*] references existing hosts.
  • timeSlots[*].endTime is after startTime.

Development

composer install
composer test
composer check-style

The old Node/AJV validation tooling has been removed. Composer/PHP is now the source of truth for tests, validation, and CI.