PHPackages                             boool/boool - 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. boool/boool

ActiveLibrary

boool/boool
===========

True, False ... and Maybe?

v0.1.0(3y ago)211MITPHPPHP ^8

Since Oct 22Pushed 3y agoCompare

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

READMEChangelog (1)Dependencies (3)Versions (2)Used By (0)

`Boool`
=======

[](#boool)

> Like a boolean, but with 50% more of the letter "o"!

This package is intended primarily as a helper for boolean-related commands, and allows you to write your code in a way that makes it more legible and easier to understand. Focus is placed on functionality first and foremost, speed and optimization second, so be aware that some of these methods might not be ideal to use in environments requiring high performance.

It accepts an array of statements and returns a `true` or `false` depending on which method you use.

**Note**: The package is currently not strict in its typing, meaning many (but not all!) methods will accept "truthy" values and "falsey" values. If you ask `Boool::allTrue([true, true, 1, true, 'hello'])`, it will return `true`, as all of those values are "truthy", whereas `Boool::allTrue([true, true, 0, true, 'hello'])` will return `false`, as the `0`evaluates as a "falsey" value.

As this behavior is not the same across the board, a future update of this package will ensure that all entries in the array passed into its methods evaluate as strictly `true` or strictly `false`, throwing exceptions if the array passed contains entries that evaluate to a non-boolean value.

But Why?
========

[](#but-why)

Like so many other packages that came before it, this was built to scratch an itch. I had been writing complex `if`statements for a project that I was working on, and was beginning to find them difficult to read properly. Refactoring and abstracting the code would only go so far, and I wanted a solution that allowed me to write code in a slightly more legible way. I do realize I'm probably over-engineering things here, but it felt like a reasonable enough project when I started working on it...

Installation and Usage
======================

[](#installation-and-usage)

To install the package:

`composer require boool\boool`

All methods listed below are available statically on the `Boool\Boool` class. To use it, simply use it wherever you would use any boolean, such as:

```
if (Boool::AllTrue($array) && Boool::AnyTrue($other_array)) {
  /* Do something */
}
```

Available Methods
=================

[](#available-methods)

The following methods are available through the `Boool` package:

- `AllFalse($array)` returns `true` if everything in `$array` evaluate as `false`.
    - Aliases: `OnlyFalse`, `EverythingFalse`, `NoTrue`.
- `AllTrue($array)` returns `true` if everything in `$array` evaluate as `true`.
    - Aliases: `All`, `OnlyTrue`, `EverythingTrue`, `NoFalse`.
- `AnyFalse($array)` returns `true` if **at least one** entry in `$array` evaluate as `true`.
    - Aliases: `ContainsFalse`, `HasFalse`.
- `AnyTrue($array)` returns `true` if **at least one** entry in `$array` evaluate as `true`.
    - Aliases: `Any`, `ContainsTrue`, `HasTrue`.
- `AtLeastFalse($array, $integer)` returns `true` if there are `$integer` or more `false` entries in `$array`.
- `AtLeastHalfFalse($array)` returns `true` if half or more of the entries in `$array` evaluate as `false`.
- `AtLeastHalfTrue($array)` returns `true` if half or more of the entries in `$array` evaluate as `true`.
- `AtLeastTrue($array, $integer)` returns `true` if there are `$integer` or more `true` entries in `$array`.
- `CountTrue($array, $integer)` returns `true` if there are exactly `$integer` `true` entries in `$array`.
    - Aliases: `AmountTrue`.
- `Half($array)` returns `true` if the entries in `$array` are exactly 50% `true` and 50% `false`.
    - Aliases: `HalfTrue`, `HalfFalse`.
- `MostlyFalse($array)` returns `true` if **more than half** of the entries in `$array` evaluate as `false`.
- `MostlyTrue($array)` returns `true` if **more than half** of the entries in `$array` evaluate as `true`.
- Aliases: `Most`

Coming in Future Versions
=========================

[](#coming-in-future-versions)

- "Parser" methods that extract all `true` or all `false` values from an array, returning a new array containing only those values that match the requested criteria.
- A way for third parties to add their own methods to `Boool` using plugin-type functionality.
- A few global methods like `boool_any($array)` to act as shortcuts to `Boool::AnyTrue($array)`.

Licence &amp; Copyright
=======================

[](#licence--copyright)

This package is released under an MIT license. Read more in `LICENCE` in the root folder of the repository.

###  Health Score

18

—

LowBetter than 8% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity36

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% 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

Unknown

Total

1

Last Release

1304d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2005bc0510625184565d645acd62c9e54cbb1b692586276728e2293d2ce9b831?d=identicon)[Breki](/maintainers/Breki)

---

Top Contributors

[![BrekiTomasson](https://avatars.githubusercontent.com/u/7026735?v=4)](https://github.com/BrekiTomasson "BrekiTomasson (10 commits)")

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/boool-boool/health.svg)

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

PHPackages © 2026

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