PHP code example of tohyo / open-graph-bundle
1. Go to this page and download the library: Download tohyo/open-graph-bundle 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/ */
tohyo / open-graph-bundle example snippets
// config/bundles.php
return [
Tohyo\OpenGraphBundle\TohyoOpenGraphBundle::class => ['all' => true],
];
public function index(OpenGraph $openGraph): Response
{
dd($openGraph->getData('https://symfony.com'));
}
Tohyo\OpenGraphBundle\Dto\OpenGraphData {#12498 ▼
+title: "Symfony, High Performance PHP Framework for Web Development"
+url: null
+type: "website"
+image: Tohyo\OpenGraphBundle\Dto\OpenGraphImageData {#13207 ▶
+url: "https://symfony.com/images/opengraph/symfony.png"
+secureUrl: null
+type: null
+width: ""
+height: ""
+alt: ""
}
+video: Tohyo\OpenGraphBundle\Dto\OpenGraphVideoData {#12615 ▶
+url: null
+secureUrl: null
+type: null
+width: ""
+height: ""
+alt: ""
}
+audio: Tohyo\OpenGraphBundle\Dto\OpenGraphAudioData {#12534 ▶
+url: null
+secureUrl: null
+type: null
}
+description: "Symfony is a set of reusable PHP components and a PHP framework to build web applications, APIs, microservices and web services."
+locale: null
+determiner: null
+siteName: null
}
tohyo_open_graph:
validate_graph_data: true