Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Php Types Laravel Package

tdn/php-types

A small PHP utility for working with types: safely cast values, validate data against expected types, and normalize scalars, arrays and objects. Lightweight and framework-agnostic, it drops easily into Laravel or any Composer project.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Build vs. buy on domain primitives: This package is best treated as a reference design for encapsulating primitive obsession (money, email addresses, phone numbers, order IDs) in typed value objects rather than a runtime dependency. Its real product value is in answering "should we introduce value objects, and what does a minimal implementation look like?" — not in shipping it.
  • Roadmap input for a PHP/Laravel modernization track: The package's existence reflects a pre-PHP 7/8 world where native scalar type declarations, readonly properties (8.1), enums (8.1), and constructor promotion did not exist. Use it as a baseline to argue that most of what it wraps is now free in the language, and scope the remaining gap (validation messages, casting into Eloquent, serialization) as the actual build work.
  • Feature scoping for validation and API boundaries: Reviewing how it wraps primitives helps decide where validation belongs — in a value object, in a Laravel FormRequest, or in a cast — which directly affects API error-shape consistency and test strategy.
  • Architecture standards: It supports writing an internal convention ("no raw strings for domain identifiers") without adopting an unmaintained third-party library to enforce it.
  • Explicit non-decision: It supports rejecting a dependency. With 7 stars, 0 dependents, an archived repo, a last release in September 2015, and an ambiguous NOASSERTION license, the correct product call is to not add this to any dependency manifest.

When to Consider This Package

Consider reading it — not installing it — only when:

  • You are on a legacy PHP 5.x codebase that genuinely cannot use native typing, and you want a compact example of wrapper classes to adapt in-house.
  • You are drafting an internal value-object standard and want a small, readable example to circulate among engineers for critique.
  • You are doing due-diligence documentation on prior art for a build-vs-buy write-up.

Look elsewhere — clearly — when:

  • Any production use is contemplated. Archived status means no security patches, no PHP 8.x compatibility guarantees, and no maintainer response. There are zero dependents, so there is no real-world validation and no community to inherit maintenance.
  • Licensing must be cleared. NOASSERTION means the license is not machine-identifiable; legal review would be required before vendoring, and the effort is not justified for the value delivered.
  • You need value objects that integrate with Laravel — Eloquent casts, validation rule objects, form requests, API resources. Modern options (spatie/laravel-data, brick/math for numeric precision, ramsey/uuid, or plain PHP 8.1 enums and readonly classes) cover this with maintained support.
  • You need numeric precision, money handling, or ID semantics — use purpose-built libraries rather than a generic primitive wrapper.

How to Pitch It (Stakeholders)

To executives: This is a small, abandoned, seven-star PHP library last released in 2015 with no known users and an unclear license. We are not proposing to adopt it. We reviewed it as a free source of prior art while deciding whether to build typed value objects in-house. Recommendation: build our own thin wrapper layer (roughly a sprint of work, owned internally) or use a maintained package — no procurement, no licensing cost, no vendor risk either way. The only cost of the review is engineering reading time.

To engineering: Read it, don't require it. It is a 2015-era answer to primitive obsession that PHP 8.1 has largely solved natively — enums, readonly classes, and promoted constructors remove most of the boilerplate it existed to hide. Where it still adds ideas worth stealing: consistent validation-error surfaces, immutability by construction, and preventing raw scalars from crossing domain boundaries. Where it fails: unmaintained since 2015, unverifiable license, zero dependents, no PHP 8 support guarantees. Concretely, the proposal is an internal app/Domain/ValueObjects layer with Eloquent casts and matching validation rules, covered by unit tests — and a written convention that domain identifiers and money are never plain strings or floats. If anyone wants to cite prior art in the design doc, link this repository as background only; it must not appear in composer.json.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
novasa/laravel-language-center
opencage/geocode
adolfoholzer/parameters
livenetworks/ln-starter
shitoudev/permissionmanager
johannesclimacus/laravel-tui
hocvt/seotools
vitalybaev/sypexgeo
amphibee/themosis-ignition
gito-me/fast-excel
frankyso/laravel-ipaymu
geolize-studio/laravel-chile
boomerangui/chat
jinas/dhivatar
store-doc/laravel-storage-driver
plus-it/laravel-translation-manager
diephp/perhaps
diephp/telegraph
osmaviation/spreadsheet
microsoft/fluentui-system-icons