Google\Cloud\PubSub\PubSubClient::createTopic PHP Method

createTopic() public method

Unlike {@see \Google\Cloud\PubSub\PubSubClient::topic()}, this method will send an API call to create the topic. If the topic already exists, an exception will be thrown. When in doubt, use {@see \Google\Cloud\PubSub\PubSubClient::topic()}. Example: $topic = $pubsub->createTopic('my-new-topic'); echo $topic->info()['name']; // projects/my-awesome-project/topics/my-new-topic
See also: https://cloud.google.com/pubsub/docs/reference/rest/v1/projects.topics/create Create Topic
public createTopic ( string $name, array $options = [] ) : Topic
$name string The topic name
$options array [optional] Configuration Options
return Topic
    public function createTopic($name, array $options = [])
    {
        $topic = $this->topicFactory($name);
        $topic->create($options);
        return $topic;
    }