arokettu/is-resource

Future compatible is_resource() and get_resource_type() that can understand objects that replaced earlier resources

Maintainers

👁 arokettu

Package info

github.com/arokettu/is-resource

Homepage

Issues

Chat

Documentation

pkg:composer/arokettu/is-resource

Statistics

Installs: 20 304

Dependents: 5

Suggesters: 0

Stars: 0

1.0.5 2025-08-15 16:09 UTC

Requires

  • php: >=5.3 <8.6

Requires (Dev)

None

Suggests

None

Provides

None

Conflicts

None

Replaces

None

MIT 17d3e955140b23c53c4d47d779f1e443d492ffad

curlsocketspgsqlhashgdresourcescompatibilityphp80php81is_resourceget_resource_type

This package is auto-updated.

Last update: 2026-06-06 16:10:04 UTC


README

👁 Packagist
👁 PHP
👁 Packagist
👁 Gitlab pipeline status

is_resource() and get_resource_type() that can understand objects that replaced earlier resources.

Installation

composer require arokettu/is-resource

Usage

<?php

use Arokettu\IsResource as r;

$hash = hash_init('md5');

// vanilla functions:
is_resource($hash); // true in PHP <= 7.1, false in PHP >= 7.2
get_resource_type($hash); // "Hash Context" in PHP <= 7.1, null or TypeError in PHP >= 7.2

// library functions:
r\is_resource($hash); // true
r\get_resource_type($hash); // "Hash Context"

Documentation

Read full documentation here: https://sandfox.dev/php/is-resource.html

Also on Read the Docs: https://is-resource.readthedocs.io/

Support

Please file issues on our main repo at GitLab: https://gitlab.com/sandfox/is-resource/-/issues

Feel free to ask any questions in our room on Gitter: https://gitter.im/arokettu/community

License

The library is available as open source under the terms of the MIT License.