getExperimentId

Learn how to read the ID of the experiment.

This method gives you the ID of the experiment.

Signature

This method has the following signature:

public function getExperimentId(): string

This method returns the ID of the experiment.

Example

Here is a basic example of how to use this method:

<?phpuse Croct\Plug\Croct;use Croct\Plug\FetchOptions;
$croct = Croct::fromDotenv();$options = FetchOptions::defaults()->withSchema();$experiment = $croct->fetchContent('home-banner', $options)->getMetadata()->getExperience()->getExperiment();$experimentId = $experiment->getExperimentId();