tobento/service-support
最新稳定版本:2.0.3
Composer 安装命令:
composer require tobento/service-support
包简介
Interfaces and classes for supporting applications.
README 文档
README
The Support Service provides interfaces and classes supporting applications.
Table of Contents
Getting started
Add the latest version of the support service running this command.
composer require tobento/service-support
Requirements
- PHP 8.4 or greater
Documentation
Interfaces
Arrayable
use Tobento\Service\Support\Arrayable; interface Arrayable { /** * Get the object as an array. * * @return array */ public function toArray(): array; }
Htmlable
use Tobento\Service\Support\Htmlable; interface Htmlable { /** * Get content as a string of HTML. * * @return string */ public function toHtml(): string; }
Jsonable
use Tobento\Service\Support\Jsonable; interface Jsonable { /** * Get the object as a JSON string. * * @param int $options * @return string */ public function toJson(int $options = 0): string; }
Renderable
use Tobento\Service\Support\Renderable; interface Renderable { /** * Get the evaluated contents of the object. * * @return string */ public function render(): string; }
Responsable
use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ServerRequestInterface; use Tobento\Service\Support\Responsable; interface Responsable { /** * Create a HTTP response that represents the object. * * @param ServerRequestInterface $request * @return ResponseInterface */ public function toResponse(ServerRequestInterface $request): ResponseInterface; }
Html String
The HtmlString::class can be useful in certain situations where a string should not be escaped by another function.
use Tobento\Service\Support\HtmlString; $htmlString = new HtmlString('<h1>foo</h1>'); // you may check if the string is empty or not: var_dump($htmlString->isEmpty()); // bool(false)
Credits
统计信息
- 总下载量: 438
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 17
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-06-23