1. Go to this page and download the library: Download raqmeyat/webrtc 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/ */
use Raqmeyat\WebRtc\Contracts\InvitationPolicy;
use Raqmeyat\WebRtc\DTOs\CreateSessionData;
use Raqmeyat\WebRtc\DTOs\ParticipantRef;
final class TripCallPolicy implements InvitationPolicy
{
public function allows(ParticipantRef $initiator, ParticipantRef $invitee, CreateSessionData $data): bool
{
return $data->subject?->type === 'trip'
&& Trip::query()->whereKey($data->subject->id)->involving($initiator, $invitee)->exists();
}
}
use Raqmeyat\WebRtc\IceProviders\IceServerManager;
app(IceServerManager::class)->extend('twilio', fn ($app) => new TwilioIceProvider(...));
use Raqmeyat\WebRtc\Actions\CreateSessionAction;
use Raqmeyat\WebRtc\DTOs\CreateSessionData;
use Raqmeyat\WebRtc\DTOs\ParticipantRef;
use Raqmeyat\WebRtc\Enums\SessionType;
$session = app(CreateSessionAction::class)->handle(new CreateSessionData(
initiator: new ParticipantRef('user', (string) $authUserId),
invitees: [new ParticipantRef('user', (string) $calleeId)],
type: SessionType::Video,
));
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.