eder / jsonid
PHP Laravel JSON ID
dev-master
2018-08-14 13:24 UTC
Requires
- php: >=5.6.4
- laravel/framework: 5.4.*
- laravel/tinker: ~1.0
Requires (Dev)
- fzaninotto/faker: ~1.4
- mockery/mockery: 0.9.*
- phpunit/phpunit: ~5.7
This package is not auto-updated.
Last update: 2024-09-29 03:31:18 UTC
README
生成JSON LD的简单方法
配置
Setting up you information on config/jsonLd.php
示例
SearchAction
$this->jsonLd = new JsonLd;
$context = ['@context' => 'http://schema.org'];
$type = ['@type' => 'WebSite'];
$data = [
'url' => $this->companyUrl,
'potentialAction' => [
'@type' => 'SearchAction',
'target' => 'https://www.bookmarc.com.au/au/search/{search_term_string}',
'query-input' => 'required name=search_term_string'
]
];
社交档案
$this->jsonLd = new JsonLd;
$context = ['@context' => 'http://schema.org'];
$type = ['@type' => 'Organization'];
$data = [
'url' => $this->companyUrl,
'sameAs' => config('companyInfo.socialProfile')
];
$script = $this->jsonLd
->context($context)
->type($type)
->data($data)
->getScriptJsonLd();