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)2200MITPHPCI passing

Since Feb 18Pushed 1mo 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 3w ago

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

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

[](#type-converter)

[![Tests](https://github.com/fishingboy/Type-Converter/actions/workflows/ci.yml/badge.svg)](https://github.com/fishingboy/Type-Converter/actions/workflows/ci.yml)[![Packagist Version](https://camo.githubusercontent.com/4c41707645ba800eaac5b36f68ad32fb75e262cd032e56aaac30b3f6e0356896/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f66697368696e67626f792f747970652d636f6e7665727465722e737667)](https://packagist.org/packages/fishingboy/type-converter)[![Downloads](https://camo.githubusercontent.com/989319f90827694fbca8674e9076b621af8986f5e1c849e8fbfd67c34d10801a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f66697368696e67626f792f747970652d636f6e7665727465722e7376673f6c6162656c3d446f776e6c6f616473)](https://packagist.org/packages/fishingboy/type-converter)[![License: MIT](https://camo.githubusercontent.com/fdf2982b9f5d7489dcf44570e714e3a15fce6253e0cc6b5aa61a075aac2ff71b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d79656c6c6f772e737667)](LICENSE)

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

License
-------

[](#license)

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

###  Health Score

38

—

LowBetter than 83% of packages

Maintenance60

Regular maintenance activity

Popularity13

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity59

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

2306d 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 (22 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

[phundament/p3extensions

Phundament 3 Core Extensions

112.0k3](/packages/phundament-p3extensions)

PHPackages © 2026

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