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

Serializer Laravel Package

botanick/serializer

Laravel/PHP serializer package for converting objects and arrays to structured formats and back. Aims to simplify data transformation with configurable normalization/denormalization for APIs, DTOs, and persistence layers.

View on GitHub
Deep Wiki
Context7

ScalarSerializer

ScalarSerializer can convert only PHP scalars.

Usage

$scalarSerializer = new \Botanick\Serializer\Serializer\DataSerializer\ScalarSerializer();
$scalarSerializer->setDefaultOptions($defaultOptions);
if ($scalarSerializer->supports($data)) {
    $serializedData = $scalarSerializer->serialize($data, null, $options);
}

Options

array(
    'type' => 'bool', // supports: 'bool', 'boolean', 'int', 'integer', 'number', 'float', 'double', 'real', 'string'
    'format' => 'anything processable by sprintf() containing one and only one placeholder (e.g. %s)'
)

Supports

is_scalar($data)

Serialize

When type is provided and is one of supported ones, then an argument will be converted using (casting) (e.g. return (bool)$data;).

If format option is provided, then sprintf($format, $data) is used.

If neither supported type nor format is provided, then serializer returns an argument itself.

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.
terminal42/code-quality-tools
codifyo/ts-generator-bundle
andydefer/laravel-cluster
testo/fiber
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