PHPackages                             internations/type-jail - 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. internations/type-jail

ActiveLibrary

internations/type-jail
======================

Enforce type constraints

v3.0.0(4y ago)2252.3k↑485.4%31MITPHPPHP &gt;=7.4

Since Jan 14Pushed 4y ago35 watchersCompare

[ Source](https://github.com/InterNations/type-jail)[ Packagist](https://packagist.org/packages/internations/type-jail)[ RSS](/packages/internations-type-jail/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (5)Versions (19)Used By (1)

Type Jail [![Test](https://github.com/InterNations/type-jail/actions/workflows/tests.yaml/badge.svg)](https://github.com/InterNations/type-jail/actions/workflows/tests.yaml)
=============================================================================================================================================================================

[](#type-jail-)

Enforce super type contract of an object

Usage
-----

[](#usage)

```
use InterNations\Component\TypeJail\Factory\SuperTypeFactory;
use InterNations\Component\TypeJail\Factory\JailFactory;
use InterNations\Component\TypeJail\Factory\SuperTypeJailFactory;

$file = new SplFileObject(__FILE__);

$factory = new JailFactory();
$file = $factory->createInstanceJail($file, 'SplFileInfo');

// Will return true
var_dump($file instanceof SplFileInfo);

// Will return the file path because that method is declared in SplFileInfo
$file->getFilePath();

// Will throw an exception indicating a type violation because that method
// is declared in SplFileObject
$file->flock();

$factory = new SuperTypeJailFactory();
$file = $factory->createInstanceJail($file, 'SplFileInfo');

// Will return false
var_dump($file instanceof SplFileInfo);

// Will return the file path because that method is declared in SplFileInfo
$file->getFilePath();

// Will throw an exception indicating a type violation because that method
// is declared in SplFileObject
$file->flock();

$factory = new SuperTypeFactory();
$file = $factory->createInstanceJail($file, 'SplFileInfo');

// Will return false
var_dump($file instanceof SplFileInfo);

// Will return the file path because that method is declared in SplFileInfo
$file->getFilePath();

// Fatal error: method not found
$file->flock();
```

Acknowledgement
---------------

[](#acknowledgement)

Standing on the shoulders of [ocramius/proxy-manager](https://github.com/Ocramius/ProxyManager/) by Marco Pivetta that makes it super-duper easy to work with proxies.

###  Health Score

41

—

FairBetter than 89% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity36

Limited adoption so far

Community23

Small or concentrated contributor base

Maturity72

Established project with proven stability

 Bus Factor1

Top contributor holds 76.4% 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 ~191 days

Recently: every ~476 days

Total

15

Last Release

1460d ago

Major Versions

v0.5.0 → 1.0.02017-02-15

v0.5.1 → v1.0.12017-02-19

v1.1.1 → v2.0.02020-10-02

v2.0.0 → v3.0.02022-05-10

PHP version history (5 changes)1.0.0PHP &gt;=5.6

v0.5.1PHP ~7

v1.1.1PHP ~7.1

v2.0.0PHP ~7.4

v3.0.0PHP &gt;=7.4

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/79707?v=4)[Lars Strojny](/maintainers/lstrojny)[@lstrojny](https://github.com/lstrojny)

![](https://www.gravatar.com/avatar/684ac7e28067e217fb76551137735510e86c5f69f05cd9aa6c9e6bfea1018758?d=identicon)[CMalvika](/maintainers/CMalvika)

---

Top Contributors

[![lstrojny](https://avatars.githubusercontent.com/u/79707?v=4)](https://github.com/lstrojny "lstrojny (55 commits)")[![Ocramius](https://avatars.githubusercontent.com/u/154256?v=4)](https://github.com/Ocramius "Ocramius (13 commits)")[![CMalvika](https://avatars.githubusercontent.com/u/23334195?v=4)](https://github.com/CMalvika "CMalvika (2 commits)")[![gitter-badger](https://avatars.githubusercontent.com/u/8518239?v=4)](https://github.com/gitter-badger "gitter-badger (1 commits)")[![peter279k](https://avatars.githubusercontent.com/u/9021747?v=4)](https://github.com/peter279k "peter279k (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/internations-type-jail/health.svg)

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

###  Alternatives

[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M648](/packages/sylius-sylius)[symfony/proxy-manager-bridge

Provides integration for ProxyManager with various Symfony components

762106.0M263](/packages/symfony-proxy-manager-bridge)[doctrine/mongodb-odm

PHP Doctrine MongoDB Object Document Mapper (ODM) provides transparent persistence for PHP objects to MongoDB.

1.1k23.3M301](/packages/doctrine-mongodb-odm)[shopware/shopware

Shopware 5 is an open source e-commerce software made in Germany

1.3k746.6k35](/packages/shopware-shopware)[shlinkio/shlink

A self-hosted and PHP-based URL shortener application with CLI and REST interfaces

4.8k4.3k](/packages/shlinkio-shlink)[sensiolabs/behat-page-object-extension

Page object extension for Behat

1166.5M27](/packages/sensiolabs-behat-page-object-extension)

PHPackages © 2026

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