core45 / coreshop-videocore
VideoCore integration for Coreshop shops: manage videos hosted on a VideoCore platform from the shop admin
Requires
- php: ^8.4
- laravel/framework: ^13.0
- league/uri: ^7.10
- psr/clock: ^1.0
Requires (Dev)
- astrotomic/laravel-translatable: ^11.17
- filament/filament: ^5.0
- larastan/larastan: ^3.0
- laravel/pint: ^1.0
- livewire/livewire: ^4.0
- mcamara/laravel-localization: ^2.4
- orchestra/testbench: ^11.0
- pestphp/pest: ^4.0
- pestphp/pest-plugin-laravel: ^4.0
- spatie/laravel-permission: ^6.25 || ^8.0
- yajra/laravel-datatables-oracle: ^13.0
Suggests
- astrotomic/laravel-translatable: ^11.17 - translatable content models (lesson video lookup, videocore:adopt --fix)
- filament/filament: ^5 - for the Filament admin driver (videocore.admin.driver = filament)
- mcamara/laravel-localization: ^2.4 - localized package routes (videocore.localization) and lesson video locales
- spatie/laravel-permission: ^6.25 || ^8.0 - for the spatie permission driver
- yajra/laravel-datatables-oracle: ^13 - required by the Blade admin driver (library table)
Provides
None
Conflicts
- filament/filament: <5.0 || >=6.0
Replaces
None
README
VideoCore integration for Coreshop shops. VideoCore is an external video hosting platform; this package lets the shop owner manage the videos hosted there from the shop admin.
Features: the API v1 client with a fake (docs/client.md); the connection page and videocore:doctor
(including a sync freshness check); the video library with poster, state, "used in" and broken-reference
warnings (docs/library.md); the video page with details, player options, allowed websites, protection,
embed code and danger zone (docs/video-page.md); the upload button and modal (docs/uploads.md); the
background sync of the local mirror (docs/sync.md); the analytics dashboards and the per-video summary
(docs/analytics.md); the library picker for the video fields of webinars, parts, elements, products and posts, with
validation and canonical storage (docs/attachment.md); the lesson and public player with the two protection
levels and the customer sign endpoint (docs/player.md); and videocore:adopt, which reports and fixes the
content that already holds video URLs. In the host shop, the MCP and REST writers and the host command
videos:replace-vimeo recognise and check VideoCore links through VideoCoreUrl::tryParse() and
VideoAttachment::normalize() and call afterStored() after their commit, like the admin forms
(docs/host-integration-map.md; command order in docs/rollout.md, step 6). Who signs lesson embeds: docs/server-side-signing.md. Rolling the package out and back: docs/rollout.md, docs/rollback.md.
Where each kind of file goes, the discovery mechanisms and the cross-area seams: docs/architecture.md.
Webhooks: optionally VideoCore pushes a signed call when a video becomes ready, fails, is archived or deleted, or
a quota threshold is reached. The shop verifies it, drops replays and duplicates, and re-reads the video from the
API, so changes show up sooner; the scheduled sync stays on as the safety net. Off by default; setup, signature
scheme and failure behaviour: docs/webhooks.md.
Two protection levels. Level 1 (every video): the video plays only on the shop's allowed websites. Level 2
(opt-in per video): the player also needs a signature that only the shop can make, and the shop signs only for a
customer who owns the lesson. Level 2 needs VIDEOCORE_EMBED_SECRET; without it the shop works at level 1.
Requirements
- PHP
^8.4and Laravel 13 (laravel/framework^13.0). - A CoreShop shop schema (webinars, parts, elements, posts, products with Astrotomic translations). Everything
shop-specific is configuration: the content catalogue, the admin driver (Blade or Filament), the permission
driver (CoreShop 9 tables, spatie/laravel-permission or none), route prefixes and middleware, and the lesson
access rule. See
docs/configuration.mdfor every key and the CoreShop 9 and Filament profiles. - Filament 5 shops: register
Core45\VideoCore\Filament\VideoCorePluginin the panel and useVideoCoreFieldfor the video inputs (docs/filament.md).
What the package registers
One provider, Core45\VideoCore\VideoCoreServiceProvider, is auto-discovered
(extra.laravel.providers); do not add it to bootstrap/providers.php. It registers:
- the config
videocore(merged; publish withphp artisan vendor:publish --tag=videocore-config); - the view namespace
videocore, the translation namespacevideocore(one file per area:videocore::connection.*,videocore::common.*, ...); - the migrations of the package (
database/migrations); - the customer routes (
routes/customer.php, files inroutes/customer/), the same way; - console commands, doctor checks and scheduled tasks, discovered from their directories (
docs/architecture.md); - the admin routes, loaded in
boot()so they come before a host catch-allRoute::any('{link}'): the Blade pages (routes/admin.php, files inroutes/admin/, name prefixadmin.videocore., Blade admin driver only) and the shared endpoints (routes/endpoints.php, name prefixvideocore.api., Blade and Filament drivers), with the prefixes and middleware ofvideocore.admin.*(docs/configuration.md); bindIf()for the contracts a host may override:Core45\VideoCore\Contracts\VideoCoreApi(defaultCore45\VideoCore\Api\VideoCoreClient; seeregisterDefaultBindings()) andCore45\VideoCore\Contracts\VideoCoreAnalyticsApi(defaultCore45\VideoCore\Api\VideoCoreAnalyticsClient);- the console commands
videocore:doctor,videocore:permissions,videocore:adopt,videocore:sync,videocore:sync-poll,videocore:webhooks:register,videocore:webhooks:status,videocore:webhooks:test(discovered fromsrc/Console); - the Blade components
<x-videocore::picker>and<x-videocore::player>.
Install on a host
-
Require the package from Packagist (Laravel auto-discovers it):
composer require core45/coreshop-videocore:^1.0A host that installed it earlier through a
vcsentry forhttps://github.com/core45/coreshop-videocore.gitinrepositoriescan remove that entry and runcomposer update core45/coreshop-videocore. -
Set the environment keys (every variable is listed in
docs/configuration.md):Key Meaning VIDEOCORE_URLBase URL of the VideoCore platform. VIDEOCORE_API_KEYServer-side API key of the shop's VideoCore account. VIDEOCORE_EMBED_SECRETSigning secret for protected embeds. Empty means the shop offers protection level 1 only. VIDEOCORE_ORIGINSComma separated public origins of the shop. Empty means the origin of APP_URL.The other settings (timeouts, cache lifetimes, sync, uploads, signing, webhooks, permissions, admin and player routes) are in
config/videocore.php; seedocs/configuration.md. -
Run
php artisan migrate. The migrationadd_videocore_permissionscreatesvideocore_access(view) andvideocore_manage(change) through the permission driver (videocore.permissions.driver): CoreShop 9 grants both to every role that holdssetting_access, spatie to the roles invideocore.permissions.spatie.roles. It is idempotent, and rolling it back removes only those two permissions. -
Grant the permissions to other roles on the admin roles screen if needed. The sidebar dropdown "Videos" / "Wideo" (guarded by
videocore_access) holds Library, Analytics and Connection. -
The scheduler keeps the mirror fresh (
php artisan schedule:runevery minute);php artisan videocore:doctorreports problems, including a stale sync. Sync details and manual commands:docs/sync.md.
Configuration
config/videocore.php (publish with php artisan vendor:publish --tag=videocore-config). Secrets come from the
environment only. Every key and every environment variable, with defaults and recommendations, is documented in
docs/configuration.md.
A missing URL or key never breaks boot: the client raises VideoCoreNotConfigured when it is used and
the Connection page says so.
Connection page and doctor
"Videos" in the sidebar opens the Connection page. Below the configured/missing table it shows the
live status from GET /account: connection state, account, plan, subscription state, billing
period, and storage and transfer with a progress bar. Every failure (not configured, rejected,
revoked or expired key, suspended account, billing inactive, rate limit, unreachable server) has its
own translated message and never a stack trace. "Check again" (permission videocore_manage) forgets
the cache and asks the server again.
php artisan videocore:doctor
prints OK, WARN, FAIL or SKIP per check (configuration, https, reachability, key, key abilities,
clock difference against the API's Date header, origins, embed secret, signing origin, protected videos that the lesson page cannot sign, sync freshness, admin permissions, webhooks) and exits 1 on any FAIL.
Run it after changing the environment. Details: docs/client.md.
php artisan videocore:permissions
creates the admin permissions videocore_access and videocore_manage when they are missing and grants them
through the permission driver (CoreShop 9: every role that holds setting_access). Safe to run any number of times; it never removes anything. Run it when
the shop's database is seeded after the package migrations (the host seeders rebuild the permission tables), or
when the doctor's "Admin permissions" line fails.
Webhook commands (the API key needs webhooks:manage; details: docs/webhook-commands.md):
| Command | What it does |
|---|---|
php artisan videocore:webhooks:register [--rotate] |
Registers this shop's receiver (APP_URL plus the receiver route) at VideoCore and prints the signing secret once with the .env lines to add; never writes .env. An address already registered is not duplicated; --rotate replaces its secret. |
php artisan videocore:webhooks:status |
Read-only: lists the account's webhook endpoints with their state, and the latest deliveries to this shop. |
php artisan videocore:webhooks:test |
Asks VideoCore to send a test event and waits up to 20 seconds for the receiver to accept it; on a timeout it says what VideoCore saw. |
Faking the API in host tests
use Core45\VideoCore\Contracts\VideoCoreApi; use Core45\VideoCore\Testing\FakeVideoCoreApi; $fake = new FakeVideoCoreApi; app()->instance(VideoCoreApi::class, $fake); $fake->seedVideo(['title' => 'Lesson 1']); $fake->failNextAsUnavailable(); // the next API call throws VideoCoreUnavailable
The fake keeps the contract's rules (404 for unknown ids, tombstones in updated_since listings,
already_archived, already_deleted, ...). See docs/client.md for the full list.
Tests
The package tests run with Orchestra Testbench (see tests/README.md): vendor/bin/pest.