m2collective / laravel-value-types
Package info
github.com/m2collective/laravel-value-types
pkg:composer/m2collective/laravel-value-types
0.1.1
2026-07-31 14:00 UTC
Requires
- php: ^8.3
- laravel/framework: ^13.0
This package is not auto-updated.
Last update: 2026-07-31 20:24:25 UTC
README
Installation
You can install the package via composer:
composer require m2collective/laravel-value-types
The package will automatically register itself.
Usage
An example of using a package with the facades:
use Illuminate\View\View; use M2Collective\ValueTypes\Contracts\ArrayValue; use M2Collective\ValueTypes\Contracts\StringValue; use M2Collective\ValueTypes\Facades\ArrayValue as ArrayValueFacade; use M2Collective\ValueTypes\Facades\StringValue as StringValueFacade; final class Example { /** * @var ArrayValue */ protected ArrayValue $title; /** * @var StringValue */ protected StringValue $subtitle; /** * @param string|null $titleText * @param string|null $titleHref */ public function __construct( ?string $titleText = null, ?string $titleHref = null, ?string $subtitle = null ) { $this->title = ArrayValueFacade::set([ 'href' => $titleHref ?? '#', 'text' => $titleText ?? 'Text' ]); $this->subtitle = StringValueFacade::set($subtitle ?? 'Subtitle') } /** * @return View */ public function render(): View { return view('example', [ 'title' => $this->title, 'subtitle' => $this->subtitle, ]); } }
<a class="title" href="{{ $title->get('href') }}" title="{{ $title->get('text') }}">
{{ $title->get('text') }}
</a>
<p class="subtitle">
{{ $subtitle->get() }}
</p>
License
The MIT License (MIT). Please see the License file for more information.