PHPackages                             ayesh/is\_countable-polyfill - 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. ayesh/is\_countable-polyfill

Abandoned → [symfony/polyfill-php73](/?search=symfony%2Fpolyfill-php73)ArchivedLibrary[Utility &amp; Helpers](/categories/utility)

ayesh/is\_countable-polyfill
============================

A trivial but working polyfill for PHP 7.3 is\_countable function. Supports PHP versions &gt;= 5.3

v1.0.9(5y ago)18134.2k↑48.5%2MIT and GPL-3.0+PHPPHP &gt;=5.3

Since Mar 22Pushed 3y ago1 watchersCompare

[ Source](https://github.com/PHPWatch/is_countable-polyfill)[ Packagist](https://packagist.org/packages/ayesh/is_countable-polyfill)[ RSS](/packages/ayesh-is-countable-polyfill/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (1)Versions (10)Used By (0)

PHP 7.3 is\_countable polyfill
==============================

[](#php-73-is_countable-polyfill)

A trivial yet functional polyfill for PHP 7.3 `is_countable()` function.

**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.**

Installation
------------

[](#installation)

You can use composer to install this polyfill:

`composer require ayesh/is_countable-polyfill`

Tests
-----

[](#tests)

PHPUnit is used as the test framework. Some of the tested variables are directly taken from the [commit](https://github.com/php/php-src/pull/3026/commits/587fcc504f8ad2b07ac28c3335cd0fe3ac39b503) that added `is_countable` to PHP source.

FAQ (or questions I think someone would ask)
--------------------------------------------

[](#faq-or-questions-i-think-someone-would-ask)

**Why use this library when I could simply copy-paste the snippet from the RFC?**

¯\\\_(ツ)\_/¯

**PHP 5.2 compatibility**

You can even use this simple compat for any PHP version that you'd ever run into. For 5.2 or older versions, please just stop using polyfills and just upgrade your PHP version.

**I get `Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d` error**

This is because you called `count()` function on a variable that cannot be counted. If you want to check if a given variable is "positive", you should be using `empty()` contruct instead of `count()`.

PHP 7.3 comes with an `is_countable` function that helps to mitigate such warnings by checking if the variable is countable first. For those who don't have PHP 7.3 yet, this polyfill will add the same functionality in user-land code.

**Can I remove this package when I upgrade to PHP 7.3 or later?**

Yes. If you require PHP 7.3 or later as the minimum supported PHP version, you do not need to use this package. To remove it:

`composer remove ayesh/is_countable-polyfill`

###  Health Score

38

—

LowBetter than 84% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity38

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 87% 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 ~101 days

Recently: every ~190 days

Total

9

Last Release

2163d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/1703f88c1f225e3fadff28458e81328f86668d9631a8c489f45ea1aaebe12df2?d=identicon)[Ayesh](/maintainers/Ayesh)

---

Top Contributors

[![Ayesh](https://avatars.githubusercontent.com/u/811553?v=4)](https://github.com/Ayesh "Ayesh (40 commits)")[![carusogabriel](https://avatars.githubusercontent.com/u/16328050?v=4)](https://github.com/carusogabriel "carusogabriel (2 commits)")[![peter279k](https://avatars.githubusercontent.com/u/9021747?v=4)](https://github.com/peter279k "peter279k (2 commits)")[![deltamualpha](https://avatars.githubusercontent.com/u/2105458?v=4)](https://github.com/deltamualpha "deltamualpha (1 commits)")[![duncan3dc](https://avatars.githubusercontent.com/u/546811?v=4)](https://github.com/duncan3dc "duncan3dc (1 commits)")

---

Tags

phpphp73polyfillpolyfillscompatibilityportablepolyfillshimportcompatphp73

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/ayesh-is-countable-polyfill/health.svg)

```
[![Health](https://phpackages.com/badges/ayesh-is-countable-polyfill/health.svg)](https://phpackages.com/packages/ayesh-is-countable-polyfill)
```

###  Alternatives

[symfony/polyfill-mbstring

Symfony polyfill for the Mbstring extension

7.8k1.2B515](/packages/symfony-polyfill-mbstring)[symfony/polyfill-php72

Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions

4.8k674.7M31](/packages/symfony-polyfill-php72)[symfony/polyfill-intl-idn

Symfony polyfill for intl's idn\_to\_ascii and idn\_to\_utf8 functions

3.4k774.6M90](/packages/symfony-polyfill-intl-idn)[symfony/polyfill-intl-normalizer

Symfony polyfill for intl's Normalizer class and related functions

2.1k830.2M36](/packages/symfony-polyfill-intl-normalizer)[symfony/polyfill-php73

Symfony polyfill backporting some PHP 7.3+ features to lower PHP versions

2.4k581.8M67](/packages/symfony-polyfill-php73)[symfony/polyfill-php80

Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions

1.7k815.2M455](/packages/symfony-polyfill-php80)

PHPackages © 2026

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