Download the PHP package ipl/stdlib without Composer
On this page you can find all versions of the php package ipl/stdlib. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package stdlib
Icinga PHP Library - Standard Library
ipl/stdlib provides reusable building blocks for Icinga PHP libraries and
applications. It covers declarative filtering, event emission, string and
iterable utilities, lightweight data and message containers, and a
stable priority queue.
Installation
The recommended way to install this library is via Composer:
ipl/stdlib requires PHP 8.2 or later with the openssl extension.
Usage
Filter Rows With Declarative Rules
Build composable filter trees with ipl\Stdlib\Filter and evaluate them
against arrays or objects:
Available condition factories: equal, unequal, like, unlike,
greaterThan, greaterThanOrEqual, lessThan, lessThanOrEqual.
Available logical factories: all, any, none, not.
Flatten nested chains when you need to inspect individual rules:
Build Filters Incrementally
When an object needs to collect filter conditions over time, use the Filters
trait. It complements the Filterable contract and exposes filter(),
orFilter(), notFilter(), and orNotFilter():
Events
The Events trait wraps Evenement and
adds event validation. Declare event name constants on the class to give
callers a typo-safe API and to let isValidEvent() enforce an explicit
allow-list:
Utility Helpers
Str
Str offers string utilities that complement PHP's built-in functions.
It converts between naming conventions, splits and trims in one step, and
provides startsWith with case-insensitive matching.
Seq
Seq searches arrays, iterators, and generators by value, key, or callback
without first materializing them into arrays. When the second argument to
find or contains is a non-callable, it is compared by value; pass a
closure to match by predicate instead:
Iterable Helpers
Grouping With yield_groups
yield_groups partitions a pre-sorted traversable into named groups.
The callback must return at least the grouping criterion, but it can
also return a custom value and key. The traversable must be sorted
by the grouping criterion before being passed in; results are undefined
otherwise:
Other Utility Classes
Data: mutable key/value storeMessages: collects user-facing messages and supportssprintf-style placeholdersPriorityQueue: extendsSplPriorityQueuewith stable insertion-order for items at equal priority; iterate non-destructively withyieldAll()
Changelog
See CHANGELOG.md for a list of notable changes.
License
ipl/stdlib is licensed under the terms of the MIT License.