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 4w ago

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

[fideloper/proxy

Set trusted proxies for Laravel

7.3k174.4M550](/packages/fideloper-proxy)[fakerphp/faker

Faker is a PHP library that generates fake data for you.

3.9k358.5M3.4k](/packages/fakerphp-faker)[consolidation/robo

Modern task runner

2.7k62.9M408](/packages/consolidation-robo)[brick/money

Money and currency library

1.9k37.9M102](/packages/brick-money)[jetbrains/phpstorm-stubs

PHP runtime &amp; extensions header files for PhpStorm

1.4k27.7M67](/packages/jetbrains-phpstorm-stubs)[illuminate/support

The Illuminate Support package.

583107.1M34.3k](/packages/illuminate-support)

PHPackages © 2026

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