PHPackages                             maxlcoder/data-type - 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. maxlcoder/data-type

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

maxlcoder/data-type
===================

data-type transformer

06PHP

Since Oct 19Pushed 8y ago1 watchersCompare

[ Source](https://github.com/maxlcoder/data-type)[ Packagist](https://packagist.org/packages/maxlcoder/data-type)[ RSS](/packages/maxlcoder-data-type/feed)WikiDiscussions master Synced 4d ago

READMEChangelogDependenciesVersions (1)Used By (0)

### 数组或对象属性类型转换

[](#数组或对象属性类型转换)

#### 配置

[](#配置)

> 需要转换的属性与类型
>
> 支持类型有
>
> - "boolean" or "bool"
> - "integer" or "int"
> - "float" or "double"
> - "string"
> - "array"
> - "object"
> - "null"

#### 示例

[](#示例)

```
// 举例
$configs = [
  'username' => 'string',
  'age' => 'int',
];
$datas = [
  'username' => 'Lily', // string
  'age' => '12', // string
];
var_dump($datas);
/*
array(2) {
  ["username"]=>
  string(4) "Lily"
  ["age"]=>
  string(2) "12"
}
*/
$app = new DataType($configs);
$results = $app->convert($datas);
var_dump($results);
/*
array(2) {
  ["username"]=>
  string(4) "Lily"
  ["age"]=>
  int(12)
}
*/
```

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/254eba782942f65c462f2cbc324a17de7064d5eca75f7f1f0fda82942931f261?d=identicon)[maxlcoder](/maintainers/maxlcoder)

---

Top Contributors

[![maxlcoder](https://avatars.githubusercontent.com/u/18546126?v=4)](https://github.com/maxlcoder "maxlcoder (2 commits)")

---

Tags

data-type

### Embed Badge

![Health badge](/badges/maxlcoder-data-type/health.svg)

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

###  Alternatives

[cwspear/bootstrap-hover-dropdown

An unofficial Bootstrap plugin to enable Bootstrap dropdowns to activate on hover and provide a nice user experience.

1.3k153.1k](/packages/cwspear-bootstrap-hover-dropdown)[jeroendesloovere/distance

Get distance between two locations using PHP.

3462.8k](/packages/jeroendesloovere-distance)[dintel/php-github-webhook

Simple class for handling GitHub webhook calls

5115.5k](/packages/dintel-php-github-webhook)[spatie/filament-simple-stats

Opinionated prebuilt stat widgets to quickly add to your Filament dashboards.

2317.9k](/packages/spatie-filament-simple-stats)

PHPackages © 2026

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