PHPackages                             gulasz101/gettype - 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. gulasz101/gettype

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

gulasz101/gettype
=================

Small quality of live improvement providing gettype function that returns enum.

v1.0.0(2y ago)06Apache-2.0PHPPHP ^8.1

Since Oct 4Pushed 2y ago1 watchersCompare

[ Source](https://github.com/gulasz101/gettype)[ Packagist](https://packagist.org/packages/gulasz101/gettype)[ RSS](/packages/gulasz101-gettype/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)DependenciesVersions (2)Used By (0)

Small quality of live improvement.

Provides small enum and a `gettype` function which instead of set of strings as original `\gettype` does, returns proper enum value.

Especially when you are running with phpstan level max.

So to avoid annoying:

```
Diagnostics:
1. Parameter #1 $externalUrl of class CLI\SayHelloFromExternalServerCommand constructor expects string, string|false given.

```

Do:

```
use function gulasz101\gettype;

$app->add(new SayHalloFromDBCommand(
    new PDO(
        match (gettype($dsn = getenv('CLI_DB_DSN'))) {
            Type::BOOLEAN => throw new RuntimeException('CLI_DB_DSN env is missing'),
            Type::STRING => $dsn,
            default => throw new RuntimeException('CLI_DB_DSN env is setup with wrong type'),
        }
    ))
);
```

Install it with:

```
composer require gulasz101/gettype
```

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity51

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

Unknown

Total

1

Last Release

956d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/d30628bc5ba57f76c9ff47f69a72d37dcdd2004c775fb24969cbee2cae8dbf54?d=identicon)[gulasz101](/maintainers/gulasz101)

---

Top Contributors

[![gulasz101](https://avatars.githubusercontent.com/u/5440332?v=4)](https://github.com/gulasz101 "gulasz101 (1 commits)")

---

Tags

phptypePHPStanenumanalyzergettype

### Embed Badge

![Health badge](/badges/gulasz101-gettype/health.svg)

```
[![Health](https://phpackages.com/badges/gulasz101-gettype/health.svg)](https://phpackages.com/packages/gulasz101-gettype)
```

###  Alternatives

[garoevans/php-enum

Convenient way to always have an Enum object available and utilise Spl Types if available.

19158.8k5](/packages/garoevans-php-enum)[zakirullin/mess

Convenient array-related routine &amp; better type casting

21228.9k2](/packages/zakirullin-mess)[strictus/strictus

Strict Typing for local variables in PHP

1606.9k](/packages/strictus-strictus)[iteks/laravel-enum

A comprehensive Laravel package providing enhanced enum functionalities, including attribute handling, select array conversions, and fluent facade interactions for robust enum management in Laravel applications.

2516.7k](/packages/iteks-laravel-enum)[ducks-project/spl-types

Polyfill Module for SplType PHP extension. This extension aims at helping people making PHP a stronger typed language and can be a good alternative to scalar type hinting. It provides different typehandling classes as such as integer, float, bool, enum and string

1032.4k](/packages/ducks-project-spl-types)

PHPackages © 2026

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