kidran / event-schedule-schema
Laravel package for generating and validating Barq-compatible furry event schedule JSON.
Requires
- php: ^8.2
- ext-json: *
- illuminate/console: ^11.0|^12.0|^13.0
- illuminate/contracts: ^11.0|^12.0|^13.0
- illuminate/support: ^11.0|^12.0|^13.0
- justinrainbow/json-schema: ^6.10
Requires (Dev)
- orchestra/testbench: ^9.0|^10.0|^11.0
- phpunit/phpunit: ^11.5|^12.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
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:
EventScheduleEventInfoMembershipLevelTrackSessionTypeLabelVenueRoomHostSessionTimeSlotExternalLink
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[*].venueIdreferences an existing venue.sessions[*].typeIdreferences an existing session type.sessions[*].trackIdreferences 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[*].endTimeis afterstartTime.
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.