Search by

core45 / coreshop-videocore

core45

VideoCore integration for Coreshop shops: manage videos hosted on a VideoCore platform from the shop admin

Package info

github.com/core45/coreshop-videocore

pkg:composer/core45/coreshop-videocore

Statistics

Installs: 1

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v1.0.0 2026-11-28 22:46 UTC

This package is auto-updated.

Last update: 2026-11-29 19:28:02 UTC


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.4 and 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.md for every key and the CoreShop 9 and Filament profiles.
  • Filament 5 shops: register Core45\VideoCore\Filament\VideoCorePlugin in the panel and use VideoCoreField for 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 with php artisan vendor:publish --tag=videocore-config);
  • the view namespace videocore, the translation namespace videocore (one file per area: videocore::connection.*, videocore::common.*, ...);
  • the migrations of the package (database/migrations);
  • the customer routes (routes/customer.php, files in routes/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-all Route::any('{link}'): the Blade pages (routes/admin.php, files in routes/admin/, name prefix admin.videocore., Blade admin driver only) and the shared endpoints (routes/endpoints.php, name prefix videocore.api., Blade and Filament drivers), with the prefixes and middleware of videocore.admin.* (docs/configuration.md);
  • bindIf() for the contracts a host may override: Core45\VideoCore\Contracts\VideoCoreApi (default Core45\VideoCore\Api\VideoCoreClient; see registerDefaultBindings()) and Core45\VideoCore\Contracts\VideoCoreAnalyticsApi (default Core45\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 from src/Console);
  • the Blade components <x-videocore::picker> and <x-videocore::player>.

Install on a host

  1. Require the package from Packagist (Laravel auto-discovers it):

    composer require core45/coreshop-videocore:^1.0
    

    A host that installed it earlier through a vcs entry for https://github.com/core45/coreshop-videocore.git in repositories can remove that entry and run composer update core45/coreshop-videocore.

  2. Set the environment keys (every variable is listed in docs/configuration.md):

    Key Meaning
    VIDEOCORE_URL Base URL of the VideoCore platform.
    VIDEOCORE_API_KEY Server-side API key of the shop's VideoCore account.
    VIDEOCORE_EMBED_SECRET Signing secret for protected embeds. Empty means the shop offers protection level 1 only.
    VIDEOCORE_ORIGINS Comma 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; see docs/configuration.md.

  3. Run php artisan migrate. The migration add_videocore_permissions creates videocore_access (view) and videocore_manage (change) through the permission driver (videocore.permissions.driver): CoreShop 9 grants both to every role that holds setting_access, spatie to the roles in videocore.permissions.spatie.roles. It is idempotent, and rolling it back removes only those two permissions.

  4. 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.

  5. The scheduler keeps the mirror fresh (php artisan schedule:run every minute); php artisan videocore:doctor reports 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.