PHPackages                             mapado/pretty-types - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. mapado/pretty-types

ActiveLibrary[Database &amp; ORM](/categories/database)

mapado/pretty-types
===================

Doctrine Type storing pretty printed JSON into database

v1.1.0(7mo ago)014.1k↓38.9%MITPHP

Since Feb 22Pushed 7mo ago3 watchersCompare

[ Source](https://github.com/mapado/pretty-types)[ Packagist](https://packagist.org/packages/mapado/pretty-types)[ RSS](/packages/mapado-pretty-types/feed)WikiDiscussions main Synced yesterday

READMEChangelogDependencies (1)Versions (5)Used By (0)

Mapado pretty-types
===================

[](#mapado-pretty-types)

- [Installation](#installation)
- Types:
    - [JSON pretty](#json-pretty)
    - [UTCDateTime](#utcdatetime)
- [License](#license)

Installation
------------

[](#installation)

```
composer require  mapado/pretty-types
```

JSON pretty
-----------

[](#json-pretty)

Based on [`Doctrine DBAL types`](https://github.com/doctrine/dbal/tree/v2.10.0/lib/Doctrine/DBAL/Types).

Will store pretty printed JSON into database.

### Configuration

[](#configuration)

In your config file

```
# Doctrine Configuration
doctrine:
  dbal:
    types:
      json_pretty: Mapado\PrettyTypes\JsonPrettyType
```

### Usage

[](#usage)

In your entities

```
/**
 * ...
 *
 * @ORM\Column(name="column_name", type="json_pretty")
 */
```

UTCDateTime
-----------

[](#utcdatetime)

If you want to store datetime in UTC in your database.

Copied version from [Working with DateTime Instances](https://www.doctrine-project.org/projects/doctrine-orm/en/3.2/cookbook/working-with-datetime.html#handling-different-timezones-with-the-datetime-type).

All credits goes to the doctrine team !

### Configuration

[](#configuration-1)

In your config file

```
# Doctrine Configuration
doctrine:
  dbal:
    types:
      datetime: Mapado\PrettyTypes\UTCDateTimeType
      datetime_immutable: Mapado\PrettyTypes\UTCDateTimeImmutableType
      datetimetz: Mapado\PrettyTypes\UTCDateTimeType
```

Be aware that this will override all datetimes configured with doctrine.

If you do not want to override everything and use a custom types instead:

```
# Doctrine Configuration
doctrine:
  dbal:
    types:
      utcdatetime: Mapado\PrettyTypes\UTCDateTimeType
      utc_datetime_immutable: Mapado\PrettyTypes\UTCDateTimeImmutableType
```

### Usage

[](#usage-1)

In your entities, if you overrode the default datetime types, Doctrine will implicitly use the new types for all datetime fields:

```
#[ORM\Column]
private \DateTime $someDate;

#[ORM\Column]
private \DateTimeImmutable $someDate;
```

You should store the timezone next to the datetime too. Read [the doctrine documentation](https://www.doctrine-project.org/projects/doctrine-orm/en/2.7/cookbook/working-with-datetime.html) for more informations.

If you configured a custom type, use this instead:

```
#[ORM\Column(type: 'utcdatetime')]
private \DateTime $someDate;

#[ORM\Column(type: 'utc_datetime_immutable')]
private \DateTimeImmutable $someDate;
```

License
-------

[](#license)

This project is licensed under the [MIT license](LICENSE).

###  Health Score

45

—

FairBetter than 91% of packages

Maintenance64

Regular maintenance activity

Popularity24

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity66

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~944 days

Total

4

Last Release

219d ago

Major Versions

v0.1.0 → v1.0.02022-11-18

### Community

Maintainers

![](https://www.gravatar.com/avatar/3277986d0e1f93c7e8a58fdaf1b52e3f5a1588e73dfa298d33aafb1ebbde5ef2?d=identicon)[jdeniau](/maintainers/jdeniau)

![](https://www.gravatar.com/avatar/90d135128b469dc38fcf186ac78d0f2cd82fc696ffcf5be8a8c486b7bd911ff6?d=identicon)[mapado](/maintainers/mapado)

---

Top Contributors

[![jdeniau](https://avatars.githubusercontent.com/u/1398469?v=4)](https://github.com/jdeniau "jdeniau (6 commits)")[![bjulien](https://avatars.githubusercontent.com/u/3918730?v=4)](https://github.com/bjulien "bjulien (5 commits)")[![nikophil](https://avatars.githubusercontent.com/u/10139766?v=4)](https://github.com/nikophil "nikophil (3 commits)")[![thomasdiluccio](https://avatars.githubusercontent.com/u/3739767?v=4)](https://github.com/thomasdiluccio "thomasdiluccio (2 commits)")

---

Tags

jsondoctrinepretty

### Embed Badge

![Health badge](/badges/mapado-pretty-types/health.svg)

```
[![Health](https://phpackages.com/badges/mapado-pretty-types/health.svg)](https://phpackages.com/packages/mapado-pretty-types)
```

###  Alternatives

[martin-georgiev/postgresql-for-doctrine

Extends Doctrine with native PostgreSQL support for arrays, JSONB, ranges, PostGIS geometries, text search, ltree, uuid, and 100+ PostgreSQL-specific functions.

4585.8M4](/packages/martin-georgiev-postgresql-for-doctrine)[scienta/doctrine-json-functions

A set of extensions to Doctrine that add support for json query functions.

58825.9M54](/packages/scienta-doctrine-json-functions)[laravel-doctrine/orm

An integration library for Laravel and Doctrine ORM

8465.5M96](/packages/laravel-doctrine-orm)[sonata-project/doctrine-extensions

Doctrine2 behavioral extensions

26822.6M69](/packages/sonata-project-doctrine-extensions)[flow-php/doctrine-dbal-bulk

Bulk inserts and updates for Doctrine DBAL

14385.8k4](/packages/flow-php-doctrine-dbal-bulk)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
