PHP code example of germania-kg / google-structured-data

1. Go to this page and download the library: Download germania-kg/google-structured-data 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/ */

    

germania-kg / google-structured-data example snippets



use Germania\GoogleStructuredData\GoogleFaqQuestion;
use Germania\GoogleStructuredData\GoogleFaqAnswer;
use Germania\GoogleStructuredData\GoogleFaqCollection;

$answer = GoogleFaqAnswer::create("This is the answer.");
$answer = $answer->setText("No, another answer.");

// Answer is optional
$question = GoogleFaqQuestion::create("So, what is the answer?", $answer);
$question = GoogleFaqQuestion::create("So, what is the answer?");
$question->setAcceptedAnswer($answer)
  
$faq = GoogleFaqCollection::createFromArray([
	$question,
  ...
]);