Website profiles · Technology insights · Alternatives

valinor-php.dev

PHP library that helps to map any input into a strongly-typed value object structure.

No paid content found
Visit website
Profile views 11 Outbound visits 2 Normal
Valinor Full homepage screenshot

At a glance

Category
Development
Language
English
Paid-content signal
No paid content foundObserved
Registered
2026
Hosting
FastlyInferred
HTTPS certificate trusted
PassedObserved
Last updated

Website review

This review may include AI-generated content and is not individually verified. Domain, certificate and other facts come from the observed data on this page.

What is Valinor?

Valinor is a PHP library for mapping arbitrary input into strongly-typed value objects. Instead of hand-writing validation and hydration code that turns raw arrays or decoded JSON into objects, you describe the target structure with PHP types, and Valinor performs the conversion and type checking for you.

Its practical value shows up when input arrives as loosely typed data but your application logic wants real objects with typed properties. A typical case: an HTTP request body decoded to an array, mapped into a CreateOrder object with an int $customerId, a DateTimeImmutable $placedAt, and a list of OrderLine objects. Valinor handles nested objects and collections so you do not write recursive array-walking code.

Who it suits

  • Backend PHP developers building APIs or command handlers that consume JSON or form data.
  • Teams that want type errors surfaced at the mapping boundary rather than deep inside business logic.
  • Codebases already using typed properties and constructor promotion, where a mapper fits naturally.

Trade-offs to weigh

  • You take on a dependency and its conventions; simple one-off casts may not justify it.
  • Mapping behavior depends on how precisely you express types, so vague type hints produce weak guarantees.
  • Very dynamic or schema-less input still needs custom handling.

A useful next step is to try one real payload: define a small value object with a nested object and a collection, map an array into it, and see what happens when you pass a wrong type. That single experiment tells you quickly whether Valinor fits your codebase better than manual hydration or a framework's built-in serializer. For context, comparable mapping and serialization tools exist in the wider PHP ecosystem, such as Symfony's Serializer component.

How does Valinor map array or JSON input into a strongly-typed PHP object?

Valinor is a PHP mapping library that takes array or JSON-shaped input and constructs strongly-typed value objects from it. Instead of manually reading keys, casting scalars, and instantiating nested objects, you define the target class structure and let the mapper handle the conversion.

How the mapping generally works

  1. Decode input into arrays. For JSON, you typically run json_decode($json, true) to get a nested associative array. Valinor works on that array structure.
  2. Describe the target type. You map to a class with typed constructor parameters or typed properties. The types drive the conversion.
  3. Let Valinor construct the object. The mapper inspects the class, matches input keys to parameters, converts values, and recursively maps nested arrays into nested objects.
  4. Fail loudly on invalid input. If a value cannot be converted to the declared type, mapping throws an exception rather than silently producing a wrong-typed object.

A concrete example

Suppose you have a User class with a string $name, int $age, and an Address $address, where Address has string $city. Given:

$data = [
    'name' => 'Ada',
    'age' => 36,
    'address' => ['city' => 'London'],
];

Valinor maps name and age to their scalar types and recursively turns the address array into an Address instance. The result is a real User object, not an array.

Where it fits

  • API request handling: Convert decoded request bodies into command or DTO objects before passing them into your domain layer.
  • Config loading: Turn configuration arrays into typed config objects so mistakes surface at load time.
  • Message/queue consumers: Map incoming message payloads into typed objects before processing.

Trade-offs to weigh

Approach Strength Cost
Hand-written hydration Full control, no dependency Repetitive, easy to miss nested cases
Valinor-style mapper Type-driven, recursive, fails on bad input Requires clear type definitions; some learning curve
Plain json_decode Trivial No type safety; errors appear later

If your classes are already well-typed and you want validation and nested mapping without writing boilerplate, a mapper like Valinor is a good fit. If your input shapes are highly irregular or you need very custom per-field logic, hand-written hydration may be simpler.

Next step: start with one DTO that has a scalar field and a nested object, decode a sample JSON payload to an array, and map it. If the nested object is built correctly and a wrong-typed value throws, the setup is working as intended.

How do I install and configure Valinor in a PHP project?

Valinor is a PHP library for mapping raw input (arrays, JSON-decoded data, request payloads) into strongly typed value objects. The site itself currently just redirects to its documentation, so the practical starting point is Composer and the official docs.

The usual path is:

  1. Add the package with Composer in your project root.
  2. Require Composer's autoloader if your project does not already.
  3. Build a mapper instance and point it at your target class.
  4. Feed it the input array and let it construct the typed object, throwing on invalid data.
composer require cuyz/valinor
use CuyZ\Valinor\MapperBuilder;

$mapper = (new MapperBuilder())->mapper();

$user = $mapper->map(
    User::class,
    ['name' => 'Ada', 'age' => 36]
);

Configuration is mostly done through MapperBuilder rather than a config file. Typical adjustments: enabling flexible/lenient handling for imperfect input, registering constructors for classes you cannot change, and adding custom exception messages so validation failures are readable in logs or API responses.

A useful decision criterion: use Valinor when you want one consistent, type-driven boundary between untrusted input and your domain objects. If you only need to validate a flat form and never build objects, a plain validator may be lighter. For the exact builder methods and supported types, check the documentation linked from Valinor.

How does Valinor compare to manual array-to-object mapping or other PHP mapping libraries?

Valinor is a PHP library for mapping arbitrary input into strongly typed value objects. It sits between two extremes: hand-written mapping code and full-featured serialization frameworks.

Manual array-to-object mapping

You write constructors or static factory methods that pull each key, cast it, validate it, and handle missing or nested data yourself.

  • Full control over every rule and error message.
  • No dependency, no configuration, no learning curve.
  • Cost: repetitive per-class code, easy to forget edge cases, and type safety only as good as your manual checks.
  • Nested structures and collections multiply the boilerplate quickly.

Valinor

Per the project's own description, it maps any input into a strongly typed value object structure. That means the library infers the target shape from your class — constructor parameters, property types, nested classes, collections — and constructs valid objects, reporting errors when input doesn't fit.

  • Less glue code: you define the value object, not the mapping routine.
  • Types are enforced at construction, so downstream code can trust the object.
  • Error reporting is centralized rather than scattered through your mapper.
  • Trade-off: you adopt its conventions and its type system, and you need to learn how it handles edge cases such as unions, nullable fields, or custom scalar types.

Other PHP mapping libraries

The wider ecosystem includes tools with different focal points — for instance, Symfony's Serializer Symfony for normalization/denormalization across formats, or CuyZ/Valinor GitHub if you want to read the source and issue history. Compare on:

Criterion Manual mapping Valinor General serializers
Boilerplate High Low Low to medium
Type enforcement As written Built in Depends on config
Error detail You design it Provided Varies
Config surface None Moderate Often large
Format support N/A Input to objects Often JSON/XML/CSV

Decision guide

Choose manual mapping when the shapes are few, stable, and trivial. Choose Valinor when you have many value objects, nested structures, and want construction-time type guarantees without writing each mapper. Choose a general serializer when you also need to emit multiple formats or integrate with an existing framework's normalization pipeline.

Next step: take one representative payload and one target class, and write the mapping three ways — by hand, with Valinor, and with your framework's serializer. Compare lines of code, error messages on a deliberately malformed field, and how each handles a nested collection. That small experiment will tell you more than feature lists.

Can Valinor handle nested objects, collections, and custom value object types?

Yes. Valinor is built for exactly that: it maps arbitrary input into a strongly-typed value object structure, which means nested objects, collections of objects, and your own custom value object classes are the intended use cases rather than edge cases.

What each case looks like in practice

  • Nested objects: A top-level value object whose properties are themselves typed objects. Valinor walks the type tree and constructs each level, so you don't hand-write recursive hydration.
  • Collections: Typed arrays/iterables of objects (for example a list of line items or a list of tags). The element type is part of the declared property type, so each item is mapped individually.
  • Custom value objects: Your own classes — a Money, Email, UserId or similar — are treated as mapping targets, provided Valinor can construct them (a usable constructor, or a named/static constructor it can find).

How to decide whether it fits

Situation Valinor is a good fit Look elsewhere
Input shape is untrusted or loosely typed (JSON, form data, arrays) Yes — validation and mapping happen together —
You want strict types at the boundary of your app Yes —
You mostly map flat scalars with no object graph Works, but the benefit is smaller A simple manual cast may be enough
You need a full ORM with persistence and lazy loading No — this is mapping, not persistence A database/ORM layer
You want attribute-driven mapping on the domain classes themselves Depends on your style preference A mapper that relies on PHP attributes

The main trade-off is that you must declare your types accurately; the library's value comes from those declarations. If your classes are permissive (mixed properties, no constructor), you lose much of the safety.

A concrete next step

Take one real payload from your app — say an order with a customer, a list of items, and a total — and write the corresponding PHP classes with explicit property types. Then map the payload once and see whether the errors you get are the ones you'd want to see for bad input. That single experiment tells you more than any feature list.

For the authoritative details on supported type syntax and extension points, start at Valinor.

How does Valinor validate input and report mapping errors?

Valinor validates input by mapping it into a strongly-typed PHP value object structure, then reporting anything that fails to fit that structure. The validation isn't a separate rule engine you call first; it's the mapping process itself. You define classes with typed properties (and constructor parameters), and Valinor attempts to fill them from a source such as an array, JSON payload, or request data. A value that can't be coerced or matched to the declared type produces an error rather than a partially built object.

Valinor

What the validation covers

  • Type correctness — each input value must be compatible with the target property's declared type.
  • Nested structures — arrays of objects and object-valued properties are mapped recursively, so errors point at the specific nested path.
  • Missing or extra data — absent required values and unexpected fields are handled according to the mapper's configuration rather than silently ignored.

How errors are reported

Because the output is a typed tree, Valinor can collect failures as structured messages tied to the path where they occurred, instead of throwing on the first problem. That means you get a list of issues in one pass — useful when you want to return several validation messages to a client rather than one at a time. The exact error object shape and message formatting come from the library's mapper settings, so check the current documentation for the precise API.

Practical example

Imagine an endpoint that accepts a JSON body for a User object with an email string and an age integer. If age arrives as "unknown", mapping fails at age and Valinor reports that path; if email is missing, that path is flagged too. You can then translate those paths into a 422 response without writing per-field checks by hand.

Choosing this approach

Consideration Mapping-based validation Hand-written checks
Boilerplate Low — types define the rules High — one check per field
Nested data Handled recursively Often manual
Error detail Path-aware, collected Depends on your code

If your application already models data as typed classes, mapping validation removes duplicated checks. If your validation rules are mostly cross-field business logic, you'll still write those separately — Valinor handles structure and types, not arbitrary domain rules.

Next step: define one small value object, feed it a deliberately broken payload, and inspect the error output. That shows you the reporting format before you commit the pattern across a larger API.

Related questions

More questions →
Where to Find Valinor's Documentation or Latest Version

The official entry point is valinor-php.dev. Visiting the root domain redirects to a latest/ path, which is where the current documentation lives. If you want the newest usage instructions, start there rather than at the bare hostname.

What happens when you visit the site

The root URL does not serve content directly. According to the site itself, it issues a redirect:

Redirecting to latest/ ...

So valinor-php.dev and valinor-php.dev/latest/ lead to the same place in practice. The redirect exists so that the root address always points at the current version instead of a frozen snapshot.

Why the latest/ path matters

Valinor is described as a PHP library that maps any input into a strongly-typed value object structure. Documentation for a library like this changes as the API evolves, so the site keeps a versioned structure with latest/ as the moving pointer.

You want Go to
Current documentation valinor-php.dev/latest/
Root domain (redirects) valinor-php.dev
A specific pinned version A versioned path under the same domain, if one is published

The practical consequence: bookmark the latest/ URL if you want to stay on current docs, or pin a versioned URL if you need docs that match a specific release in your composer.json.

How to confirm you are on the right version

  1. Open valinor-php.dev and let it redirect.
  2. Check the URL in the address bar — it should end in latest/ (or a version segment).
  3. Compare the documented API against the version constraint you installed, for example the valinor requirement in your composer.json.
  4. If they differ, look for the matching versioned documentation path instead of latest/.

Common snags

  • Assuming the root URL is the docs. It is only a redirect; the real content is one level down.
  • Reading latest/ docs against an older installed release. Methods and signatures may not match what your locked version supports.
  • Treating a redirect as an error. A Redirecting to latest/ ... message is expected behavior, not a broken page.

If you only need one takeaway: use valinor-php.dev/latest/ for current documentation, and switch to a version-specific path when your installed release differs from the latest.

What is Valinor (valinor-php.dev)?

Valinor is a PHP library that maps arbitrary input into a strongly-typed value object structure. You reach for it when data arrives as loose arrays or decoded JSON and you want it to land in real PHP objects with typed properties, instead of passing arrays around and validating them by hand. It is a library you integrate into an existing application, not a framework or a standalone app.

The problem it addresses

PHP gives you no built-in way to say "this array must become a User with an int id and a DateTimeImmutable birthday." The usual workarounds are:

  • Reading $data['id'] and casting it, hoping the key exists and holds the right type.
  • Writing validation rules separately from the object that consumes the data.
  • Letting arrays flow through the codebase, so type errors surface late, at the point of use.

Valinor targets that gap: input goes in, a typed object structure comes out, and mismatches are reported rather than silently accepted.

What "strongly-typed value object structure" means in practice

The mapping is not limited to flat scalars. A value object can contain nested objects, collections, and union types, and the library resolves the input into that shape. Conceptually:

final class User
{
    public function __construct(
        public readonly int $id,
        public readonly string $name,
        public readonly DateTimeImmutable $birthday,
    ) {}
}

Given input such as ['id' => 42, 'name' => 'Ada', 'birthday' => '1990-01-01'], the library's job is to produce a User instance — converting the date string, enforcing int and string, and failing loudly if the input cannot satisfy the constructor.

Where it fits in a PHP project

Aspect What Valinor is
Form A Composer-installable library
Role Data mapping / hydration into typed objects
Scope One concern — turning input into typed values
Not A framework, router, ORM, or full application skeleton

Because it is scoped to mapping, it composes with whatever else you use: a framework's request handling, a queue consumer, an API client, or a plain script.

When it is a good fit

  • You decode JSON or receive arrays from an external boundary and want typed objects immediately.
  • You want type errors to appear at the mapping step rather than deep inside business logic.
  • You already define value objects with constructors and want input to conform to them.

When it is not the right tool

  • You only need to validate a form and return error messages — a validation library may be a closer match.
  • Your data is already typed objects and needs no conversion.
  • You want an all-in-one framework; Valinor is deliberately just the mapping layer.

Getting oriented

The site itself is a redirect: visiting valinor-php.dev forwards to a latest/ path, which is where the current documentation lives. Start there for installation and the mapping API, since the exact method names and configuration options are version-specific and belong to the docs rather than to a summary.

What Does Mapping Input into a Strongly-Typed Value Object Structure Mean in Valinor?

Valinor is a PHP library that maps arbitrary input—arrays, JSON-decoded data, or other sources—into strongly-typed PHP value objects. "Mapping" means taking raw, loosely-typed data and producing a fully constructed object whose properties have declared types (e.g., int, string, DateTimeImmutable, nested objects). "Strongly-typed" means those declared types are enforced during construction, so type errors surface at the mapping boundary rather than later in your application logic.

The core idea

In plain PHP, input usually arrives as an array or stdClass:

$data = json_decode($request->getBody(), true);
// ['id' => '42', 'name' => 'Ada', 'created_at' => '2024-01-15']

Every value is a string or a nested array. Nothing stops you from passing '42' where an int is expected, or forgetting a key entirely.

Valinor lets you declare a target class and maps the input into an instance of it:

final class User
{
    public function __construct(
        public readonly int $id,
        public readonly string $name,
        public readonly DateTimeImmutable $createdAt,
    ) {}
}

The mapper reads the input, matches keys to constructor parameters, converts compatible values (like the string '42' to int), and constructs the object. If a value cannot be converted or a required field is missing, mapping fails instead of silently producing a broken object.

What "strongly-typed" changes in practice

Concern Manual array handling Valinor mapping
Field types Untyped; checked only if you write checks Declared on the object; enforced at mapping
Missing keys null or undefined-index warnings Mapping error you can catch
Nested structures Manual recursion Nested objects mapped from nested input
Conversion Hand-written casts Built-in conversion where types allow
Failure point Anywhere the value is later used At the mapping boundary

The practical benefit: by the time your code receives the object, its shape and types are already guaranteed. Downstream code can rely on $user->id being an int without defensive checks.

Where the input comes from

The input is not limited to JSON. Anything that can be represented as arrays or scalar values—decoded request bodies, configuration arrays, database rows, or test fixtures—can be mapped, as long as it matches the structure your target class expects.

When this matters

Mapping to typed objects is most useful at boundaries: HTTP request handling, API response parsing, config loading, or any place where external data enters your application. It moves validation and conversion to one predictable location instead of scattering casts and isset() checks throughout your code.

For the exact API, supported types, and configuration options, refer to the library's current documentation, since the site redirects to a versioned path and details may change between releases.

What PHP Use Cases Is Valinor Designed For?

Valinor is a PHP library that maps any input into a strongly-typed value object structure. It fits best when you receive loosely-typed data (JSON payloads, request bodies, arrays, configuration) and want it to become typed PHP objects instead of staying as arrays you validate by hand. The core use cases are API input mapping, domain-layer value objects, and any place where you need input validation plus type conversion in one step.

Turning API requests and JSON into typed objects

The most direct use case is taking raw input from an HTTP request or a decoded JSON body and constructing typed objects from it.

A typical flow looks like this:

  1. Input: you have decoded JSON, e.g. {"id": 42, "name": "Ada", "active": true}.
  2. Action: you hand that array to Valinor and tell it the target class — a value object with typed properties such as int $id, string $name, bool $active.
  3. Expected result: you get back an instance of that class with correctly typed properties, or a clear error if the input doesn't match.

This replaces the common pattern of manually reading array keys, casting values, and checking types one by one. If your controllers currently do $data['id'] and cast it, Valinor moves that work into a single mapping step.

When this is worth it

  • Your endpoints accept structured payloads that map to known classes.
  • You want type errors surfaced at the boundary, not deep inside business logic.
  • You have several endpoints doing similar manual array-to-object conversion.

When it may be overkill

  • The input is a single scalar or a trivial two-field array.
  • You have no target class and genuinely want to keep working with arrays.

Using value objects in the domain layer instead of loose arrays

Valinor's description emphasizes a strongly-typed value object structure. That points at a second use case: keeping arrays out of your domain layer.

Instead of passing array $user through services and repositories, you define a value object and map incoming data into it once. Downstream code then depends on typed properties and methods rather than on array keys that can be misspelled or missing.

This matters when:

  • The same data shape is passed across multiple layers.
  • You want static analysis and IDE completion to work on the data.
  • You want a single place where the shape is defined and enforced.

Where input validation and type conversion are needed together

Valinor's role sits at the intersection of two jobs that are often done separately: checking that input is valid, and converting it into the type you actually want.

Because mapping and validation happen in the same step, you avoid the split where one library validates an array and separate code then casts it. If a value can't be converted to the declared type, the mapping fails rather than producing a silently wrong object.

A concrete scenario: an API accepts a status field as a string, but your domain wants an enum. Rather than validating the string and then converting it in a second pass, you declare the target type and let the mapping handle both.

Projects where Valinor is a good fit

Valinor is aimed at PHP projects that care about type safety. It tends to make sense when:

  • You use typed properties and value objects as a normal part of your design.
  • You have clear boundaries where external data enters the system (HTTP, queues, config, third-party responses).
  • You want mapping logic to be declarative — describing the target structure — rather than a sequence of manual casts.
  • You already rely on static analysis and want runtime data to match the types your code assumes.

It is less compelling for small scripts, prototypes, or codebases that intentionally work with arrays throughout.

What to check before adopting it

The library's own description is the reliable starting point: it maps any input into a strongly-typed value object structure. To decide whether it fits your project, look at:

  • Your entry points: how many places convert external data into objects today?
  • Your target classes: do you already have value objects, or would you need to introduce them?
  • Your error handling: do you want mapping failures to be explicit and centralized?

If most of your data already arrives as typed objects, or if your input is unstructured and unpredictable, the benefit is smaller. If you repeatedly convert arrays into typed objects at the edges of your application, that is exactly the case Valinor is designed for.

Website Overview

Several search or sharing settings need attention. Together they may make snippets, preview images or preferred URLs less consistent across platforms. An active inbound-mail setup with incomplete authentication may leave the domain more open to impersonation. Provider hosting alone does not close that gap.

Domain and Registration

The domain was registered less than a year ago and has limited historical evidence to assess. Transfer-protection status is present, helping reduce the risk of unauthorized domain transfers. The domain uses the common .dev extension, which is not an independent safety signal.

DNS and Email

The observed email authentication setup is incomplete: DMARC is missing. Nameservers are provided by ovh.net, indicating managed DNS hosting. MX records point to the ovh.net email service. DNSSEC is enabled, allowing validating resolvers to authenticate signed DNS data. No CNAME was found; the observed records resolve directly to addresses.

TLS and Certificates

The certificate uses an RSA 2048-bit public key, offering broad client compatibility. The server supplied a complete certificate chain. No organization name is present in the certificate; the available fields are consistent with domain validation. The certificate was issued by Let's Encrypt, commonly associated with automated certificate services. The certificate's total validity is about 89 days, consistent with a short renewal cycle.

HTTP and Browser Security

The checked browser-security headers were not detected, leaving fewer explicit browser-side safeguards. CORS permits any origin to read this response. This is common for public resources; sensitive responses need narrower handling. No X-Powered-By header was found, reducing one common source of backend fingerprinting information. The x-cache, x-served-by, via response header indicates a CDN or caching proxy in the delivery path. No obvious internal addresses or debug information were found in the headers.

Technology Stack Analysis

The public page identifies Fastly without precise versions, leaving fewer clues for version-specific scanning.

Search and Social Sharing

No homepage meta description was detected, leaving snippet selection more dependent on page text. No viewport meta tag was detected, which may affect mobile layout behavior. No homepage canonical URL was detected. If duplicate URLs exist, consolidation may be less explicit. No Open Graph metadata was detected, so social previews may depend on platform inference. The title has 11 characters, within a common display range.

Hosting and Email

DNSovh.net
HostingFastly
Emailovh.net
Approximate IP geolocation (inferred; a CDN or proxy may differ from the origin server) United States flagUnited States Inferred 185.199.108.153

Registration details

RDAP / WHOIS

RegistrarOVH sas
Registered2026-01-26
Expires2028-01-26
Domain statusclient delete prohibited、client transfer prohibited
Nameserversdns110.ovh.net、ns110.ovh.net
DNSSECsigned

DNS records

DNS

TypeNameValueTTLPriority
Avalinor-php.dev185.199.108.1533600—
Avalinor-php.dev185.199.109.1533600—
Avalinor-php.dev185.199.110.1533600—
Avalinor-php.dev185.199.111.1533600—
MXvalinor-php.devmx1.mail.ovh.net36001
MXvalinor-php.devmx2.mail.ovh.net36005
MXvalinor-php.devmx3.mail.ovh.net3600100
NSvalinor-php.devdns110.ovh.net3600—
NSvalinor-php.devns110.ovh.net3600—
TXTvalinor-php.devv=spf1 include:mx.ovh.com -all3600—
DSvalinor-php.dev24859 8 2 c25407c3ade47251b4cfde0e005ad8b1544fb475b8142947e2d5944963f1c6b01800—

TLS and certificates

TLS / SSL

AssessmentNormal configuration
Supported protocolsTLSv1.2、TLSv1.3
Negotiated protocolTLSv1.3
Certificate subjectvalinor-php.dev
IssuerLet's Encrypt
Valid until2026-11-19T13:08 · Remaining when checked: 44 days
Verification detailsCertificate trust: Passed · Hostname match: Passed

HTTP response headers

HTTP

HeaderValue
content-typetext/html; charset=utf-8
cache-controlmax-age=600
serverGitHub.com
access-control-allow-origin*

Identified technologies

Fastly

Pages, Search and Sharing

Meta descriptionNot detected
Canonical URLNot detected
LanguageEnglish (default)
Twitter CardNot detected

Unknown

No rules found

User reviews (0)

  • No reviews yet.