dansup / php-activitystreams
Activity Streams 是一种简单的规范,用于描述网络上的社交行为。http://activitystrea.ms
0.0.2
2017-04-21 01:45 UTC
Requires
- php: ~5.5|~7.0
- league/fractal: ^0.16.0
- nesbot/carbon: ^1.22
Requires (Dev)
- phpunit/phpunit: ~4.0||~5.0
- scrutinizer/ocular: ~1.1
- squizlabs/php_codesniffer: ~2.3
This package is auto-updated.
Last update: 2024-08-29 04:25:31 UTC
README
Activity Streams 2.0 规范的 PHP 实现
此软件包正在积极开发中,这并不是 ActivityStreams 2.0 的完整实现
一个现代的 AS2 PHP 库。目前,只有 对象模型类型 部分实现。我期待在 2017 年夏季结束前完成这个特性。
安装
通过 Composer
$ composer require dansup/php-activitystreams
使用
让我们创建一个 基本的对象模型 并将响应输出为 json 编码的字符串。
use Dansup\ActivityStreams\ServerFactory; $item = ServerFactory::create('object'); $item->type('Note') $item->id('http://example.org/note/123'); $item->name('Our Weather Is Fine'); $item->content('I feel that the weather is appropriate to our season and location.'); $item->attributedTo([ 'id' => 'http://joe.website.example/', 'type' => 'Person', 'name' => 'Joe Smith' ]); $item->addField('url', 'http://example.org/permalink/123'); echo $item->get();
结果
{ "@context": "https:\/\/www.w3.org\/ns\/activitystreams", "type": "Note", "id": "http:\/\/example.org\/note\/123", "name": "Our Weather Is Fine", "attributedTo": { "id": "http:\/\/joe.website.example\/", "type": "Person", "name": "Joe Smith" }, "content": "I feel that the weather is appropriate to our season and location.", "published": "2017-04-21T01:31:20+00:00", "url": "http:\/\/example.org\/permalink\/123" }
更新日志
请参阅 更新日志 了解最近的变化信息。
测试
$ composer test
贡献
安全性
如果您发现任何与安全性相关的问题,请通过电子邮件 danielsupernault@gmail.com 反馈,而不是使用问题跟踪器。
致谢
许可证
MIT 许可证 (MIT)。有关更多信息,请参阅 许可证文件。