承接 dknx01/rsl-lib 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

dknx01/rsl-lib

最新稳定版本:0.2

Composer 安装命令:

composer require dknx01/rsl-lib

包简介

RSL generation lib

README 文档

README

This is a library for creating an XML string of the RSL standard to be used in your application. It has only dependencies for testing purpose and for PHP (DOM extension).

RSL = Really Simple Licensing

The open content licensing standard for the AI-first Internet

RSL is an open, XML-based document format for defining machine-readable licensing terms for digital assets, including web pages, books, videos, images, and proprietary datasets.

Website: https://rslstandard.org/guide/what-is-rsl

Installation:

composer require dknx01/rsl-lib

Usage

You can have a look into the test/Integration/RslBuilderTest class. The result is like the test example under tests/Integration/expected.xml.

This is an example with all fields filled:

$builder = new RslBuilder();
        $content = new Content('/', 'https://api.example.com');
        $content->addLicense(
            new License(
                permits: [
                    Usage::new(UsageAssets::ALL),
                    User::new(UserAssets::EDUCATION),
                    Geo::new(['EU']),
                ],
                prohibits: [
                    \Dknx01\RslLib\Elements\Probihits\User::new(UserAssets::EDUCATION),
                    \Dknx01\RslLib\Elements\Probihits\Usage::new(UsageAssets::AI_INPUT),
                    \Dknx01\RslLib\Elements\Probihits\Geo::new(['AF']),
                ],
                payments: [
                    PurchasePayment::new([
                        new Amount('EUR', '49.00'),
                        new Accepts('{"json": true}'),
                        new Standard('https://creativecommons.org/licenses/by/4.0/'),
                        new Custom('https://creativecommons.org/licenses/by/4.0/'),
                    ]),
                    SubscriptionPayment::new([new Amount('EUR', '49.00')]),
                    TrainingPayment::new([new Amount('EUR', '49.00')]),
                    CrawlPayment::new([new Amount('EUR', '49.00'), new Accepts('{"json": true}')]),
                    UsePayment::new([new Amount('EUR', '49.00')]),
                    ContributionPayment::new([new Amount('EUR', '49.00')]),
                    AttributionPayment::new([new Amount('EUR', '49.00')]),
                    FreePayment::new([new Amount('EUR', '0.00')]),
                ],
                legals: [
                    Warranty::new('ownership authority no-infringement'),
                    Disclaimer::new('as-is no-liability'),
                    Attestation::new(true),
                    Contact::new('https://example.com/contact'),
                    Proof::new('https://blockscan.example/tx/0x9aBcD123... '),
                ]
            )
        )
            ->addAlternate(new Alternate('/exports/site-2025-10-20.warc', 'application/warc'))
            ->addAlternate(new Alternate('/exports/site-2025-10-20.json', 'application/json'))
            ->addSchema(new Schema(value: '/metadata/books/moby-dick.jsonld'))
            ->addCopyright(new Copyright(value: 'Example Media LLC', type: 'organization', contactUrl: 'https://example.com/contact.html'))
            ->addTerms(new Terms('https://example.com/legal/data-terms.html'));

        $builder->addContent($content);
        $result = $builder->getXml();

TO see which parameters are available and needed, have a look on the RSL website. The naming is the same for the elements.

For example: addCopyright(new Copyright(value: 'Example Media LLC', type: 'organization', contactUrl: 'https://example.com/contact.html')) is not needed if you don't provide this information

ToDo

[] improve test coverage [] add more examples

统计信息

  • 总下载量: 0
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-12-17

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固