PHPackages                             ducks-project/spl-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. [Utility &amp; Helpers](/categories/utility)
4. /
5. ducks-project/spl-types

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

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

v7.0.0(1y ago)1032.4k↓50%2[2 PRs](https://github.com/ducks-project/spl-types/pulls)MITPHPPHP &gt;=7.4CI passing

Since Nov 25Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/ducks-project/spl-types)[ Packagist](https://packagist.org/packages/ducks-project/spl-types)[ Docs](https://github.com/ducks-project/spl-types/)[ GitHub Sponsors](https://github.com/donaldinou)[ Fund](https://opencollective.com/ducks-project)[ RSS](/packages/ducks-project-spl-types/feed)WikiDiscussions 7.x Synced 1mo ago

READMEChangelogDependencies (8)Versions (21)Used By (0)

SplTypes
========

[](#spltypes)

[![Github Action Status](https://github.com/ducks-project/spl-types/actions/workflows/php.yml/badge.svg)](https://github.com/ducks-project/spl-types)[![Coverage Status](https://camo.githubusercontent.com/c47f88934501970e065cd35c6df0ed9357ab4dc4f7940f521f537c381a3fdc43/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f6475636b732d70726f6a6563742f73706c2d74797065732f62616467652e737667)](https://coveralls.io/github/ducks-project/spl-types)[![CircleCI](https://camo.githubusercontent.com/fdfe9e0a03ffc3ba8c7c3d69564b17adbeb670ec1636c5ac0146cb1fd9c8f6e1/68747470733a2f2f646c2e636972636c6563692e636f6d2f7374617475732d62616467652f696d672f67682f6475636b732d70726f6a6563742f73706c2d74797065732f747265652f372e782e7376673f7374796c653d737667)](https://dl.circleci.com/status-badge/redirect/gh/ducks-project/spl-types/tree/master)

[![Scrutinizer Code Quality](https://camo.githubusercontent.com/0dae7b97b409d49b08ee9efb3aa124fcfb0b554aa2f64f4b475ad77417e054ed/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6475636b732d70726f6a6563742f73706c2d74797065732f6261646765732f7175616c6974792d73636f72652e706e67)](https://scrutinizer-ci.com/g/ducks-project/spl-types/?branch=master)[![Code Coverage](https://camo.githubusercontent.com/59c1eb982753eeca3454f1ccdafbfbcf41e53061bfb583dfdc40cdd0bf63d733/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6475636b732d70726f6a6563742f73706c2d74797065732f6261646765732f636f7665726167652e706e67)](https://scrutinizer-ci.com/g/ducks-project/spl-types/?branch=master)[![Build Status](https://camo.githubusercontent.com/eda38be16d4f2bd5d2686722d05ee4e2c039730b8692a27dc4b781b17dff25ed/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6475636b732d70726f6a6563742f73706c2d74797065732f6261646765732f6275696c642e706e67)](https://scrutinizer-ci.com/g/ducks-project/spl-types/build-status/master)[![Code Intelligence Status](https://camo.githubusercontent.com/38971c177e07b36c0615f6bd74f82cb3333aa43ed5bcd659a57dc8f25f7636b9/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6475636b732d70726f6a6563742f73706c2d74797065732f6261646765732f636f64652d696e74656c6c6967656e63652e737667)](https://scrutinizer-ci.com/code-intelligence)[![codecov Status](https://camo.githubusercontent.com/fd1bac4bef45b803fe7c6c05c3a2e3be3e04edc67f3f6959cea4b049217ccf3d/68747470733a2f2f636f6465636f762e696f2f6769746875622f6475636b732d70726f6a6563742f73706c2d74797065732f67726170682f62616467652e7376673f746f6b656e3d4d334c42475151364e39)](https://codecov.io/github/ducks-project/spl-types)[![Appveyor status](https://camo.githubusercontent.com/eb69e68d43b2fdbc1d8444aaf912c8cf2706519ead27d2bac9bd0fd24697a211/68747470733a2f2f63692e6170707665796f722e636f6d2f6170692f70726f6a656374732f7374617475732f65646a32616a39346562736c6e6879393f7376673d74727565)](https://ci.appveyor.com/project/donaldinou/spl-types)

[![Psalm Type Coverage](https://camo.githubusercontent.com/c53205d818260e612b0cb9f3d5a002709991f60a063cf9bb6fc1c5ed9046c102/68747470733a2f2f73686570686572642e6465762f6769746875622f6475636b732d70726f6a6563742f73706c2d74797065732f636f7665726167652e737667)](https://shepherd.dev/github/ducks-project/spl-types)[![Psalm Level](https://camo.githubusercontent.com/e5193e46b28c5516f52fa3ee2dd1353e1f251277bea8982d49e2b6609367ee13/68747470733a2f2f73686570686572642e6465762f6769746875622f6475636b732d70726f6a6563742f73706c2d74797065732f6c6576656c2e737667)](https://shepherd.dev/github/ducks-project/spl-types)

[![License](https://camo.githubusercontent.com/2b4dc4578ec9bbaa9470dc46bb8be7ee44aade2b65680443b6891082fbbf164d/68747470733a2f2f706f7365722e707567782e6f72672f6475636b732d70726f6a6563742f73706c2d74797065732f6c6963656e7365)](https://packagist.org/packages/ducks-project/spl-types)[![Latest Stable Version](https://camo.githubusercontent.com/4dd86af92b07f5824fddd1dc2b759abdc85f22510e89815100945983ca33db47/68747470733a2f2f706f7365722e707567782e6f72672f6475636b732d70726f6a6563742f73706c2d74797065732f762f737461626c65)](https://packagist.org/packages/ducks-project/spl-types)[![PHP Version Require](https://camo.githubusercontent.com/d6b78844ac2e3a62cb1d0b66be6d74458a10b13da2840a3ab2029b98413af5de/68747470733a2f2f706f7365722e707567782e6f72672f6475636b732d70726f6a6563742f73706c2d74797065732f726571756972652f706870)](https://packagist.org/packages/ducks-project/spl-types)

[![Total Downloads](https://camo.githubusercontent.com/37b906835148608ce69c1cc482160116569d080e5b9eb6f0d3bdc82f647e962a/68747470733a2f2f706f7365722e707567782e6f72672f6475636b732d70726f6a6563742f73706c2d74797065732f646f776e6c6f616473)](https://packagist.org/packages/ducks-project/spl-types)[![Monthly Downloads](https://camo.githubusercontent.com/d3784d78197c847ecec966434ea6fc2d72fc012d2f32de2b16b85ee7a20e4ad2/68747470733a2f2f706f7365722e707567782e6f72672f6475636b732d70726f6a6563742f73706c2d74797065732f642f6d6f6e74686c79)](https://packagist.org/packages/ducks-project/spl-types)[![Daily Downloads](https://camo.githubusercontent.com/1345bfeb973cc72575da8d5a77084275b7e1a6b07c54ef398c6515cc5f7e0b71/68747470733a2f2f706f7365722e707567782e6f72672f6475636b732d70726f6a6563742f73706c2d74797065732f642f6461696c79)](https://packagist.org/packages/ducks-project/spl-types)

[![Duck's Validated](https://camo.githubusercontent.com/55cd39dc9426a431b51194b4c9c571b67530390634276beab8244297a0d7788d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6475636b2d76616c6964617465642d6c6967687479656c6c6f77)](https://opencollective.com/ducks-project)[![Packagist online](https://camo.githubusercontent.com/f23247436d9616bc9045be6056671e2d96dd152901e3f29d0a8c78f12d96028f/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7061636b61676973742d6f6e6c696e652d627269676874677265656e)](https://opencollective.com/ducks-project)[![Documentation Status](https://camo.githubusercontent.com/c3b89c0f27ad9b442e074d196a90cd5da90da300b32bfab3f56b41d3c89a9fb6/68747470733a2f2f72656164746865646f63732e6f72672f70726f6a656374732f73706c2d74797065732f62616467652f3f76657273696f6e3d6c6174657374)](https://spl-types.readthedocs.io/en/latest/?badge=latest)

[![Contributor Covenant](https://camo.githubusercontent.com/4ae39ae593b602cf0ae07972b61c73728b77ec8e2cf40f579a2441948208036b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f436f6e7472696275746f72253230436f76656e616e742d322e312d3462616161612e737667)](code_of_conduct.md)

- Project page:
- Repository:
- Original PHP extension:

[![CircleCI](https://camo.githubusercontent.com/d9239031a21db3493db7876ac51da99b9b7717bcc56ece4be949d5d7564f1b4c/68747470733a2f2f646c2e636972636c6563692e636f6d2f696e7369676874732d736e617073686f742f67682f6475636b732d70726f6a6563742f73706c2d74797065732f372e782f776f726b666c6f772f62616467652e7376673f77696e646f773d333064)](https://app.circleci.com/insights/github/ducks-project/spl-types/workflows/workflow/overview?branch=7.x&reporting-window=last-30-days&insights-snapshot=true)

Description
-----------

[](#description)

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

It provides classes unavailable if you can't install [SPL Types](http://php.net/manual/en/intro.spl-types.php) extension:

- [`SplType`](/assets/documentation/classes/SplType.md)
- [`SplInt`](/assets/documentation/classes/SplInt.md)
- [`SplFloat`](/assets/documentation/classes/SplFloat.md)
- [`SplEnum`](/assets/documentation/classes/SplEnum.md)
- [`SplBool`](/assets/documentation/classes/SplBool.md)
- [`SplString`](/assets/documentation/classes/SplString.md)

General information
-------------------

[](#general-information)

Since [v7.0.0](./CHANGELOG.md#v700), breaking changes has appeared in relation to the pecl extension. This is mainly due to the lack of maintenance and relevance of the original extension, associated with the strong typing introduced in: [php 7.4](https://www.php.net/manual/en/language.types.declarations.php#language.types.declarations.strict)and the existence of [enums](https://www.php.net/manual/en/language.types.enumerations.php) since php 8.

Glossary
--------

[](#glossary)

- [Changelog](CHANGELOG.md)
- [Lexique](/assets/documentation/Lexique.md)
- [Issues And Limitations](/assets/documentation/IssuesAndLimitations.md)
- [How To](/assets/documentation/HowTo.md)

License
-------

[](#license)

This library is released under the [MIT license](LICENSE).

###  Health Score

49

—

FairBetter than 95% of packages

Maintenance60

Regular maintenance activity

Popularity34

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity72

Established project with proven stability

 Bus Factor1

Top contributor holds 98.2% 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 ~196 days

Recently: every ~30 days

Total

18

Last Release

486d ago

Major Versions

2.x-dev → 3.x-dev2024-09-20

3.x-dev → 4.x-dev2024-09-20

4.x-dev → 5.x-dev2024-09-20

5.x-dev → 6.x-dev2024-09-20

6.x-dev → 7.x-dev2025-01-17

PHP version history (7 changes)1.0.0PHP &gt;=5.3.3

v2.0.0PHP &gt;=5.4

v3.0.0PHP &gt;=7.0

v4.0.0PHP &gt;=7.1

v5.0.0PHP &gt;=7.2

v6.0.0PHP &gt;=7.3

v7.0.0PHP &gt;=7.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/0642cbb897484fb50a72d1c6f9e4ea6f53f776a3bfc0fdb36cd2b1536b0c1872?d=identicon)[donaldinou](/maintainers/donaldinou)

---

Top Contributors

[![donaldinou](https://avatars.githubusercontent.com/u/429269?v=4)](https://github.com/donaldinou "donaldinou (110 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (1 commits)")[![StyleCIBot](https://avatars.githubusercontent.com/u/11048387?v=4)](https://github.com/StyleCIBot "StyleCIBot (1 commits)")

---

Tags

compatcomponentenumenumeratorphppolyfillportabilitypolyfillphpenumenumeratorcompatsplenumSplTypepooSplBoolSplFloatSplIntSplStringSplTypes

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Psalm

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/ducks-project-spl-types/health.svg)

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

###  Alternatives

[php-ds/php-ds

Specialized data structures as alternatives to the PHP array

4108.8M134](/packages/php-ds-php-ds)[garoevans/php-enum

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

19158.8k5](/packages/garoevans-php-enum)[aldemeery/enum-polyfill

A Polyfill for the SplEnum type in PHP

1156.6k](/packages/aldemeery-enum-polyfill)[phpxmlrpc/polyfill-xmlrpc

A pure-php reimplementation of the API exposed by the native XML-RPC extension

12369.8k2](/packages/phpxmlrpc-polyfill-xmlrpc)

PHPackages © 2026

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