anhnguyenbk / php-livestream
PHP Livestream
dev-main
2021-06-02 10:39 UTC
Requires
- firebase/php-jwt: ^v5.2.1
- guzzlehttp/guzzle: ^6.3
This package is not auto-updated.
Last update: 2024-05-02 23:22:22 UTC
README
Laravel package for managing livestream events with the associated streaming platform. Currently the package only supports Zoom platform.
Installation
1. Via Private Packagist
2. Via github
Structure
Database migrations
database\migrations\create_live_event_table
database\migrations\create_register_event_table
Model
Model\LiveEvent
Model\RegisterEvent
Usages
With Zoom platform (currently supports)
-
Create your Zoom JWT application
https://marketplace.zoom.us/docs/guides/build/jwt-app
. Store your apiKey and apiSecret, the package will use that later for authentication. -
Run
php artisan migrate
to generate package's tables (live_events
andregister_event
table). -
Create an livestream event example in
routes\web.php
use anhnguyenbk\PHPLivestream\LivestreamServiceFactory;
Route::get('/createLiveStream', function () { $livestreamServiceFactory = new LivestreamServiceFactory(); $apiKey = 'your-api-key'; $apiSecret = 'your-api-sercret'; $zoomService = $livestreamServiceFactory->createZoomService ($apiKey, $apiSecret); $livestream = new \stdClass(); $livestream->topic = "Example livestream topic"; $livestream->startTime = "2021-05-31T20:30:00"; $livestream->duration = "60"; $livestream->password = "111111"; $userId= 1; $classId = 5; $response = $zoomService->createLivestream($userId, $classId, $livestream); return $response->toJson(); });
If the process is successful, a new record with be added to the
live_events
table.