sohophp / schema-org
schema.org php library
Installs: 278
Dependents: 0
Suggesters: 0
Security: 0
Stars: 3
Watchers: 2
Forks: 0
Open Issues: 0
pkg:composer/sohophp/schema-org
Requires
- php: ^8.1.0
 - ext-curl: *
 - ext-json: *
 
Requires (Dev)
- doctrine/inflector: *
 - friendsofphp/php-cs-fixer: *
 - monolog/monolog: *
 - phpunit/phpunit: ^10.0
 - symfony/console: ^6.0
 - twig/twig: ^3.3
 
- dev-master
 - v4.1.2
 - v4.1.0
 - v4.0.2
 - v4.0.0
 - v3.3.2
 - v3.3.1
 - v3.3.0
 - v3.2.1
 - v3.2.0
 - v3.1.2
 - v3.1.1
 - v3.1.0
 - v2.0.0
 - v1.5.0
 - v1.4.10
 - v1.4.9
 - v1.4.8
 - v1.4.7
 - v1.4.6
 - v1.4.5
 - v1.4.4
 - v1.4.3
 - v1.4.2
 - v1.4.1
 - v1.4.0
 - v1.3.1
 - v1.3.0
 - v1.2.2
 - v1.2.1
 - v1.2.0
 - v1.1.9
 - v1.1.8
 - v1.1.7
 - v1.1.6
 - v1.1.5
 - v1.1.4
 - v1.1.3
 - v1.1.2
 - v1.1.1
 - v1.0.2
 - v1.0.1
 - v1.0
 
This package is auto-updated.
Last update: 2025-10-10 16:03:03 UTC
README
schema.org PHP library
- @since 2025/03/10 v4.0.0 v28.1/schemaorg-all-https.jsonld
 - @since 2021/12/23 v3.0.0 升级至 PHP8.1
 - @since 2020/03/12 v1.5.0 加入 set 和 get 方法
 - @since 2019/08/13 updated 3.9 , 800 classes
 
特点:
- 支持自动生成类目PHP类文件,现schema.org版本v3.4有598个类,877个属性,136个其它
 - 强类型检查
 - 自定命名空间
 - PHP CS Fixer 代码格式化符合PSR标准
 - IDE中类与方法可自动完成.
 
安装方法 / installation:
Composer:
$ composer require sohophp/schema-org
Git:
$ git clone https://github.com/sohophp/schemaorg.git
使用方法 / Usage:
use Sohophp\SchemaOrg\Thing\CreativeWork\WebPage; $Page = new WebPage(); $Page->name("test one")->text('content'); $script = $Page->toScript(); echo $script;
输出结果 / output:
<script type="application/ld+json"> { "@context": "https:\/\/schema.org", "@type": "WebPage", "name": "test one", "text": "content" } </script>