chubbyphp / chubbyphp-typescript
Typescript classes ported to PHP
dev-master / 1.0.x-dev
2026-05-23 08:09 UTC
Requires
- php: ^8.3
Requires (Dev)
- chubbyphp/chubbyphp-dev-helper: dev-master
- infection/infection: ^0.32.7
- php-coveralls/php-coveralls: ^2.9.1
- phpstan/extension-installer: ^1.4.3
- phpstan/phpstan: ^2.1.54
- phpunit/phpunit: ^12.5.25
This package is auto-updated.
Last update: 2026-05-23 08:09:41 UTC
README
Description
A PHP implementation of JavaScript's Array API with TypeScript-style generics and Test262-inspired coverage.
Requirements
- php: ^8.3
Installation
Through Composer as chubbyphp/chubbyphp-typescript.
composer require chubbyphp/chubbyphp-typescript "^1.0"
Usage
Arr (Array)
A PHP implementation of the JavaScript Array class, including sparse-array semantics and chainable methods. See the full documentation for API reference and examples.
use Chubbyphp\Typescript\Arr; $arr = new Arr(1, 2, 3, 4, 5); $arr->shift(); $arr->pop(); $arr = $arr->map(static fn (int $v): int => $v * 2); $arr->push(10); // iterator_to_array($arr->values()) => [4, 6, 8, 10] $arr = Arr::from([1, 2, 3, 4, 5], static fn (int $v): int => $v * 2); // iterator_to_array($arr->values()) => [2, 4, 6, 8, 10]
Copyright
2026 Dominik Zogg