{"id":15026368,"url":"https://github.com/phpwatch/is_countable-polyfill","last_synced_at":"2025-10-03T23:32:28.835Z","repository":{"id":30892869,"uuid":"126304927","full_name":"PHPWatch/is_countable-polyfill","owner":"PHPWatch","description":"A trivial but working polyfill for PHP 7.3 is_countable function. Supports PHP versions \u003e= 5.3","archived":true,"fork":false,"pushed_at":"2022-11-27T17:52:47.000Z","size":54,"stargazers_count":18,"open_issues_count":0,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-22T21:54:55.214Z","etag":null,"topics":["php","php73","polyfill","polyfills"],"latest_commit_sha":null,"homepage":"https://ayesh.me/Upgrade-PHP-7.3#is-countable","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PHPWatch.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-03-22T08:38:21.000Z","updated_at":"2022-11-27T17:54:13.000Z","dependencies_parsed_at":"2023-01-14T17:54:12.796Z","dependency_job_id":null,"html_url":"https://github.com/PHPWatch/is_countable-polyfill","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PHPWatch%2Fis_countable-polyfill","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PHPWatch%2Fis_countable-polyfill/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PHPWatch%2Fis_countable-polyfill/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PHPWatch%2Fis_countable-polyfill/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PHPWatch","download_url":"https://codeload.github.com/PHPWatch/is_countable-polyfill/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":235204448,"owners_count":18952326,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["php","php73","polyfill","polyfills"],"created_at":"2024-09-24T20:04:22.143Z","updated_at":"2025-10-03T23:32:23.550Z","avatar_url":"https://github.com/PHPWatch.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PHP 7.3 is_countable polyfill\nA trivial yet functional polyfill for PHP 7.3 `is_countable()` function.\n\n**This polyfill is now archived and is marked as abandoned. PHP 7.3 is quite old, and it is highly recommended to simply upgrade to PHP 8 or later, which should leave no reason to use this polyfill. Thank you for using/considering this polyfill.**\n\n## Installation\nYou can use composer to install this polyfill:\n\n`composer require ayesh/is_countable-polyfill`\n\n## Tests\nPHPUnit is used as the test framework. Some of the tested variables are\ndirectly taken from the [commit](https://github.com/php/php-src/pull/3026/commits/587fcc504f8ad2b07ac28c3335cd0fe3ac39b503) that added `is_countable` to PHP source.\n\n## FAQ (or questions I think someone would ask)\n**Why use this library when I could simply copy-paste the snippet from the RFC?**\n\n   ¯\\\\\\_(ツ)_/¯\n\n**PHP 5.2 compatibility**\n\nYou can even use this simple compat for any PHP version that you'd ever\nrun into. For 5.2 or older versions, please just stop using polyfills\nand just upgrade your PHP version.\n\n**I get `Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d` error**\n\nThis is because you called `count()` function on a variable that cannot be\ncounted. If you want to check if a given variable is \"positive\", you should\nbe using `empty()` contruct instead of `count()`.\n\nPHP 7.3 comes with an `is_countable` function that helps to mitigate such\nwarnings by checking if the variable is countable first. For those who\ndon't have PHP 7.3 yet, this polyfill will add the same functionality in\nuser-land code.\n\n**Can I remove this package when I upgrade to PHP 7.3 or later?**\n\nYes. If you require PHP 7.3 or later as the minimum supported PHP version, you do not need to use this package. \nTo remove it:\n\n`composer remove ayesh/is_countable-polyfill`\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphpwatch%2Fis_countable-polyfill","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphpwatch%2Fis_countable-polyfill","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphpwatch%2Fis_countable-polyfill/lists"}