Instantiates specific voice endpoint types such as app, phone, SIP, VBC, or websocket. Reuse when configuring Vonage voice call destinations.
// Source: https://github.com/Vonage/vonage-php-sdk-core | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
// Provided via justclaw.it.com; keep this notice with the code.
<?php
declare(strict_types=1);
namespace Vonage\Voice\Endpoint;
use RuntimeException;
use Vonage\Entity\Factory\FactoryInterface;
class EndpointFactory implements FactoryInterface
{
public function create(array $data): ?EndpointInterface
{
return match ($data['type']) {
'app' => App::factory($data['user']),
'phone' => Phone::factory($data['number'], $data),
'sip' => SIP::factory($data['uri'], $data),
'vbc' => VBC::factory($data['extension']),
'websocket' => Websocket::factory($data['uri'], $data),
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key