PHPackages                             wtframework/types - 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. [Framework](/categories/framework)
4. /
5. wtframework/types

ActiveLibrary[Framework](/categories/framework)

wtframework/types
=================

What the Framework?! types

v0.4.1(1y ago)162271MITPHPPHP ^8.2

Since Jan 20Pushed 1y ago1 watchersCompare

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

READMEChangelog (8)Dependencies (1)Versions (9)Used By (1)

What the Framework?! types
==========================

[](#what-the-framework-types)

This library provides a fluent interface for manipulating strings, arrays, and numbers.

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

[](#installation)

```
composer require wtframework/types
```

Documentation
-------------

[](#documentation)

Each of the classes provided in this library is a wrapper for the relevant native functions. Method names mostly use the native function names but with underscores and certain prefixes like `str*` and `array*` removed. Most methods are chainable, even when switching from strings to arrays and vice versa.

```
use function WTFramework\Types\arr;
use function WTFramework\Types\num;
use function WTFramework\Types\str;

str('reverse me')
->explode(' ')  // returns arr(['reverse', 'me'])
->reverse()
->implode(' '); // returns str('me reverse')
```

Some methods, where appropriate, are not chainable by default.

```
str('example')
->len(); // returns 7
```

In these cases a final `$return` argument can be passed by reference. The default return value will be assigned to this variable and the method will return the current object.

```
str('example')
->len(return: $length); // returns $this

// $length = 7
```

Each class provides an `extract` method to extract a clone of the current object.

```
str('eXaMpLe')
->toupper()
->extract($uppercase)
->tolower()
->extract($lowercase);

// $uppercase = str('EXAMPLE');
// $lowercase = str('example');
```

The `Str` and `Num` classes provide an `echo` method to echo the current value. This method has optional `$prefix` and `$suffix` arguments.

```
str('example')
->echo(
  prefix: 'this is an ',
  suffix: '.'
);

// this is an example.
```

Whereas most method names are based on the native function names, there are two notable exceptions in the `Arr` class: `advance` is used to call `next` and `contains` is used to call `in_array`.

```
arr([1, 2, 3])->contains(1); // returns true
arr([1, 2, 3])->advance(); // advances the internal pointer
```

Where appropriate the functions are called using static methods. These are:

```
use WTFramework\Types\Arr;
use WTFramework\Types\Num;
use WTFramework\Types\Str;

Str::httpbuildquery($data);
Str::unserialize($data);

Arr::fill($start_index, $count, $value);
Arr::range($start, $end);

Num::max(...$values);
Num::min(...$values);
Num::pi();
```

To return the current value you can either call the `return` method or invoke the object as a function.

```
str('example')->return(); // returns 'example'
arr([1, 2, 3])(); // returns [1, 2, 3]
```

The `Str` and `Num` classes implement `Stringable` and the `Arr` class implements `ArrayAccess`, `Countable`, `Iterator`, and `Serializable`.

Extending the library
---------------------

[](#extending-the-library)

To extend the library you can use the static `macro` method, passing the new method name and a closure to call. This works for both static and non-static methods.

```
use WTFramework\Types\Str;

Str::macro('camelCase', function ()
{

  return $this->ucwords()
  ->replace(' ', '')
  ->lcfirst();

});
```

```
// Returns 'camelCase'
str('camel case')->camelCase()();
```

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance35

Infrequent updates — may be unmaintained

Popularity22

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 72.7% 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 ~35 days

Recently: every ~61 days

Total

8

Last Release

601d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/593fc3635659d661daf87a3debf99abd502bc0f7e4cce916319d37143775c8da?d=identicon)[wtframework](/maintainers/wtframework)

---

Top Contributors

[![MichaelRushton](https://avatars.githubusercontent.com/u/49325097?v=4)](https://github.com/MichaelRushton "MichaelRushton (8 commits)")[![wtframework](https://avatars.githubusercontent.com/u/120370615?v=4)](https://github.com/wtframework "wtframework (3 commits)")

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/wtframework-types/health.svg)

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

###  Alternatives

[laravel/passport

Laravel Passport provides OAuth2 server support to Laravel.

3.4k85.0M532](/packages/laravel-passport)[nolimits4web/swiper

Most modern mobile touch slider and framework with hardware accelerated transitions

41.8k177.2k1](/packages/nolimits4web-swiper)[laravel/dusk

Laravel Dusk provides simple end-to-end testing and browser automation.

1.9k36.7M259](/packages/laravel-dusk)[laravel/prompts

Add beautiful and user-friendly forms to your command-line applications.

712181.8M596](/packages/laravel-prompts)[cakephp/chronos

A simple API extension for DateTime.

1.4k47.7M121](/packages/cakephp-chronos)[laravel/pail

Easily delve into your Laravel application's log files directly from the command line.

91545.3M590](/packages/laravel-pail)

PHPackages © 2026

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