I want to use Open Graph metadata from websites for my scraper .
I know I can use get_meta_tags()
for regular metadata, but I didn't find anything similar for og tags.
I can parse it manually or use some external tool from github but is there any 'proper' way to do it? Any library that is considered default? Especially for Laravel.
I think your best option is fusonic/opengraph. Since it uses guzzle, and some symphony components. Although, as with most under-used PHP projects, check out a fork for updated dependencies, such as benallfree/opengraph.
You can add it via composer using require with a git url:
{
"require": {
"fusonic/opengraph": "dev-master"
},
"repositories": [
{
"type": "vcs",
"url": "https://github.com/benallfree/opengraph.git"
}
]
}