Weave Code
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

Util Transformer Laravel Package

phrity/util-transformer

Lightweight PHP utility for transforming values between types. Provides transformers with canTransform()/transform(), plus resolvers to chain and recurse converters. Includes JSON/flatten decoders and converters for basic types, DateTime, enums, Stringable, Throwable and more.

View on GitHub
Deep Wiki
Context7

Documentation / Throwable Converter

Introduction

The ThrowableConverter converts a Throwable Object to Array, Object or String.

Using the converter

$converter = new ThrowableConverter();

// Convert defining type
$converter->canTransform($exception, Type::STRING); // -> bool
$converter->transform($exception, Type::STRING); // -> string output

// Force type conversion
$converter = new ThrowableConverter(Type::OBJECT);
$converter->canTransform($exception); // -> bool
$converter->transform($exception); // -> object output

// Define fields to use on object and array type (see available fields below)
$converter = new ThrowableConverter(Type::OBJECT, ['type', 'message', 'code']);
$converter->transform($exception); // -> object output

Type conversion examples

If type is not specified, the converter return an Object.

Input Type: Array Type: Object Type: String
$exception [type: "RuntimeException", …] {$type: "RuntimeException", …} "My error"

Fields when type is Array or Object

type: Exception class
message: Error message
code: Error code
file: File name where thrown
line: File line number where thrown
trace: Backtrace
previous: Previous Throwable or null
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.
cadot.eu/make
besmartand-pro/php-quality-config
sentix/ai-chatbot
codifyo/ts-generator-bundle
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky