Future compatible is_resource() and get_resource_type() that can understand opaque objects
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Anton Smirnov dfb956e0b2 Disable builds for 5.4 and 5.5 (ssl problems) 7 months ago
data PHPDoc in templates 8 months ago
docs Explain why PSpell is missing 7 months ago
gen Deeper dive into docs and issues 8 months ago
sbin No longer have code injections 8 months ago
src Fix phpdoc 7 months ago
tests Add more test cases, break by version 8 months ago
.gitattributes Exclude from distr 8 months ago
.gitignore Sphinx config 8 months ago
.gitlab-ci.yml Disable builds for 5.4 and 5.5 (ssl problems) 7 months ago
CHANGELOG.md Changelog for 1.0.0 8 months ago
LICENSE.md README and LICENSE 8 months ago
README.md Extra semicolon 7 months ago
composer.json Update keywords 8 months ago


IsResource: PHP Resource Compatibility Helper

Packagist PHP Packagist Gitlab pipeline status

is_resource() and get_resource_type() that work with opaque objects.



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"


composer require arokettu/is-resource


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

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


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