PHPackages                             fishingboy/type-converter - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. fishingboy/type-converter

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

fishingboy/type-converter
=========================

convert php value type for api output

1.0.2(6y ago)2200MITPHP

Since Feb 18Pushed 5y ago1 watchersCompare

[ Source](https://github.com/fishingboy/Type-Converter)[ Packagist](https://packagist.org/packages/fishingboy/type-converter)[ RSS](/packages/fishingboy-type-converter/feed)WikiDiscussions master Synced today

READMEChangelog (3)DependenciesVersions (4)Used By (0)

Type-Converter
==============

[](#type-converter)

Language
--------

[](#language)

[en-us](README.md) / [zh-tw](README-zh-tw.md)

Introduce
---------

[](#introduce)

Because when the app (Android and iOS) is connected to the api written in php, there are often confusing or flashbacks in the connection because the php data type is not fixed, so I hope to do a type conversion before outputting the api.

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

[](#installation)

```
composer require fishingboy/type-converter

```

Usage
-----

[](#usage)

Import class

```
use fishingboy\type_converter\Type_Converter;
```

convert data before api output

```
$converter = new Type_Converter(
'{
    "users":[
        {
            "name":"str",
            "height":"float",
            "age":"int",
            "adult":"bool"
        }
    ]
}');
$response = $converter->convert([
    "users" => [
        ["name" => "leo", "height" => 173.5, "age" => "12", "adult" => false],
        ["name" => "rain"],
        ["name" => 819040, "age" => 14],
    ]
]);
```

output your api

```
echo json_encode($response);
```

type
----

[](#type)

1. int
2. float
3. bool
4. str

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

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 ~10 days

Total

3

Last Release

2250d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/45bf9bc379ef669c12d4f474f48d65b40cc371652e668ec213954817a048309d?d=identicon)[fishingboy](/maintainers/fishingboy)

---

Top Contributors

[![fishingboy](https://avatars.githubusercontent.com/u/4921524?v=4)](https://github.com/fishingboy "fishingboy (16 commits)")

---

Tags

api outputtype convert

### Embed Badge

![Health badge](/badges/fishingboy-type-converter/health.svg)

```
[![Health](https://phpackages.com/badges/fishingboy-type-converter/health.svg)](https://phpackages.com/packages/fishingboy-type-converter)
```

###  Alternatives

[t3docs/examples

This extension packages a number of code examples from the Core Documentation.

3120.2k](/packages/t3docs-examples)

PHPackages © 2026

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