mesilov / kinescope-php-sdk
Unofficial PHP SDK for Kinescope API - video management platform
Installs: 2
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/mesilov/kinescope-php-sdk
Requires
- php: >=8.4
- ext-json: *
- nesbot/carbon: ^3.0
- php-http/discovery: ^1.14
- php-http/httplug: ^2.2
- psr/http-client: ^1.0
- psr/http-factory: ^1.0
- psr/http-message: ^1.0|^2.0
- psr/log: ^1.1|^2.0|^3.0
- symfony/event-dispatcher: ^5.4|^6.0|^7.0|^8.0
- symfony/filesystem: ^5.4|^6.0|^7.0|^8.0
- symfony/mime: ^5.4|^6.0|^7.0|^8.0
- symfony/uid: ^5.4|^6.0|^7.0|^8.0
Requires (Dev)
- fakerphp/faker: ^1.20
- friendsofphp/php-cs-fixer: ^3.0
- guzzlehttp/guzzle: ^7.10
- monolog/monolog: ^3.0
- nyholm/psr7: ^1.5
- php-http/mock-client: ^1.5
- phpstan/phpstan: ^2.0
- phpstan/phpstan-phpunit: ^2.0
- phpstan/phpstan-strict-rules: ^2.0
- phpunit/phpunit: ^10.0|^11.0
- rector/rector: ^2.0
Suggests
- guzzlehttp/guzzle: For HTTP client implementation
- nyholm/psr7: For PSR-7/PSR-17 implementation
- symfony/http-client: For HTTP client implementation
README
Unofficial PHP SDK for Kinescope API — a video management platform for uploading, transcoding (up to 4K), protection, and delivery of video content.
Requirements
- PHP >= 8.4
- Extensions:
ext-json,ext-curl,ext-mbstring - A PSR-18 HTTP client (e.g., Guzzle or Symfony HTTP Client)
- A PSR-7/PSR-17 implementation (e.g.,
nyholm/psr7) - Symfony components compatibility:
^5.4|^6.0|^7.0|^8.0
Installation
composer require mesilov/kinescope-php-sdk
You also need an HTTP client and PSR-7 implementation. For example, with Guzzle:
composer require guzzlehttp/guzzle nyholm/psr7
Quick Start
use Kinescope\Core\Credentials; use Kinescope\Services\ServiceFactory; // Create factory with API key $factory = new ServiceFactory(Credentials::fromString('your-api-key')); // Or read from KINESCOPE_API_KEY environment variable $factory = ServiceFactory::fromEnvironment(); // Use services $videos = $factory->videos()->list(); $projects = $factory->projects()->list(); $folders = $factory->folders()->list(); $playlists = $factory->playlists()->list();
Available Services
| Service | Access | Description |
|---|---|---|
| Videos | $factory->videos() |
Read/list/search videos |
| Projects | $factory->projects() |
Read/list projects |
| Folders | $factory->folders() |
Folder listing and tree navigation |
| Playlists | $factory->playlists() |
Playlist and playlist-entities listing |
Video Downloader + Events
VideoDownloader supports event subscriptions for the download lifecycle:
DownloadStartedEventDownloadProgressEventDownloadCompletedEventDownloadFailedEvent
use Http\Discovery\Psr17FactoryDiscovery; use Http\Discovery\Psr18ClientDiscovery; use Kinescope\Enum\QualityPreference; use Kinescope\Event\Download\DownloadProgressEvent; use Kinescope\Services\Videos\VideoDownloader; use Symfony\Component\Filesystem\Filesystem; $downloader = new VideoDownloader( $factory->videos(), Psr18ClientDiscovery::find(), Psr17FactoryDiscovery::findRequestFactory(), new Filesystem(), ); $downloader->on(DownloadProgressEvent::class, function (DownloadProgressEvent $event): void { printf("Progress: %.1f%%\n", $event->percent); }); $filePath = $downloader->downloadVideo( videoId: 'your-video-id', destinationDir: __DIR__ . '/downloads', quality: QualityPreference::BEST, );
Development
Setup
# Initialize project (first run) make docker-init # Start Docker environment make docker-up # Install dependencies make composer-install
Testing
# Unit tests make test-unit # Integration tests (requires API key) make test-integration # Full test suite make test
Code Quality
# Run all linters make lint-all # Static analysis make lint-phpstan # Code style check (dry-run) make lint-cs-fixer # Fix code style make lint-cs-fixer-fix
License
MIT. See LICENSE for details.
Changelog
See CHANGELOG.md for release history and migration notes.