PHP code example of vizor-vr / laravel-vizor
1. Go to this page and download the library: Download vizor-vr/laravel-vizor 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/ */
vizor-vr / laravel-vizor example snippets
use Vizor\Laravel\Facades\Vizor;
// List content
$items = Vizor::content()->list(search: 'ocean', limit: 10);
// CRUD
$item = Vizor::content()->create('New Video', 'MONO_360', ['src' => '...']);
$item = Vizor::content()->get($id);
Vizor::content()->update($id, ['title' => 'Updated Title']);
Vizor::content()->delete($id);
$overview = Vizor::analytics()->overview(days: 30);
$views = Vizor::analytics()->viewsOverTime(days: 7);
$top = Vizor::analytics()->topContent(days: 30, limit: 5);
$engagement = Vizor::analytics()->engagement(days: 30);
$summary = Vizor::analytics()->contentSummary($contentId);
$gaze = Vizor::analytics()->gazeData($contentId);
$keys = Vizor::apiKeys()->list();
$key = Vizor::apiKeys()->create('Production Key', domains: ['example.com']);
$valid = Vizor::apiKeys()->validate($keyString); // bool
Vizor::apiKeys()->revoke($id);
$keys = Vizor::licenseKeys()->list();
$key = Vizor::licenseKeys()->generate(domains: ['example.com'], tier: 'pro');
$valid = Vizor::licenseKeys()->validate($keyString); // bool
Vizor::licenseKeys()->revoke($id);
$status = Vizor::billing()->status();
$plans = Vizor::billing()->plans();
Route::middleware('vizor.license')->group(function () {
Route::get('/vr/{id}', [VrController::class, 'show']);
});
use Vizor\Laravel\Filament\VizorPlugin;
public function panel(Panel $panel): Panel
{
return $panel
->plugins([
VizorPlugin::make(),
]);
}
bash
php artisan vizor:install
blade
<x-vizor-video
src="/videos/ocean.mp4"
:format="\Vizor\Laravel\Support\FormatEnum::STEREO_360_TB"
title="Ocean Dive"
poster="/images/ocean-thumb.jpg"
:autoplay="true"
:loop="true"
/>
blade
<x-vizor-playlist :autoplay="true" :loop-playlist="true">
<x-vizor-video
src="/videos/clip-1.mp4"
:format="\Vizor\Laravel\Support\FormatEnum::MONO_360"
title="Clip 1"
/>
<x-vizor-video
src="/videos/clip-2.mp4"
:format="\Vizor\Laravel\Support\FormatEnum::MONO_360"
title="Clip 2"
/>
</x-vizor-playlist>
blade
<x-vizor-video
src="/videos/tour.mp4"
:format="\Vizor\Laravel\Support\FormatEnum::MONO_360"
>
<x-vizor-annotation
:lat="15.5"
:lon="-42.3"
title="Look here"
icon="info"
:time-start="10.0"
:time-end="30.0"
/>
</x-vizor-video>
bash
php artisan vizor:component MyCustomPlayer
bash
php artisan vendor:publish --tag=vizor-config # config/vizor.php
php artisan vendor:publish --tag=vizor-assets # resources/js/vizor-alpine.js
php artisan vendor:publish --tag=vizor-views # Blade views
php artisan vendor:publish --tag=vizor-migrations # Database migrations