tobento/service-support
Interfaces and classes for supporting applications.
Maintainers
2.0.3
2025-12-08 17:32 UTC
Requires
- php: >=8.4
- psr/http-message: ^2.0
Requires (Dev)
- phpunit/phpunit: ^12.3
- vimeo/psalm: ^6.13
Suggests
None
Provides
None
Conflicts
None
Replaces
None
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)
