PHP code example of kidran / event-schedule-schema
1. Go to this page and download the library: Download kidran/event-schedule-schema library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
kidran / event-schedule-schema example snippets
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();
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;
}
}
use Kidran\EventScheduleSchema\Rules\ValidEventSchedule;
$request->validate([
'schedule' => [new ValidEventSchedule(domain: true)],
]);
bash
php artisan vendor:publish --tag=event-schedule-schema-config
bash
php artisan vendor:publish --tag=event-schedule-schema
bash
php artisan event-schedule:validate schedule.json
php artisan event-schedule:validate schedule.json --domain