PHPackages                             shahmal1yev/gcollection - 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. shahmal1yev/gcollection

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

shahmal1yev/gcollection
=======================

GenericCollection is a versatile PHP library that provides a type-safe collection class for managing various data types. Simplify your data management with intuitive methods and strong type constraints.

1.0.8(1y ago)03.1k↓40.9%PHPPHP &gt;=7.4

Since Jul 27Pushed 1y ago1 watchersCompare

[ Source](https://github.com/shahmal1yev/gcollection)[ Packagist](https://packagist.org/packages/shahmal1yev/gcollection)[ RSS](/packages/shahmal1yev-gcollection/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (2)Versions (12)Used By (0)

PHP-based GenericCollection
===========================

[](#php-based-genericcollection)

[![GitHub tag (latest by date)](https://camo.githubusercontent.com/2ea7d61b0badc234e03e2efa98681cf340d435b38718dc83de97d1d26bfe34c8/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f7461672f736861686d616c317965762f67436f6c6c656374696f6e3f6c6162656c3d6c6174657374267374796c653d666c6174)](https://camo.githubusercontent.com/2ea7d61b0badc234e03e2efa98681cf340d435b38718dc83de97d1d26bfe34c8/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f7461672f736861686d616c317965762f67436f6c6c656374696f6e3f6c6162656c3d6c6174657374267374796c653d666c6174)[![License: MIT](https://camo.githubusercontent.com/784362b26e4b3546254f1893e778ba64616e362bd6ac791991d2c9e880a3a64e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d677265656e2e737667)](https://opensource.org/licenses/MIT)[![GitHub last commit](https://camo.githubusercontent.com/3101a13b29fc6ebe9ebcceb98c45f1b3306da40bb97a54886b9408289db49878/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6173742d636f6d6d69742f736861686d616c317965762f67436f6c6c656374696f6e)](https://camo.githubusercontent.com/3101a13b29fc6ebe9ebcceb98c45f1b3306da40bb97a54886b9408289db49878/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6173742d636f6d6d69742f736861686d616c317965762f67436f6c6c656374696f6e)[![GitHub issues](https://camo.githubusercontent.com/5b583146487728fd04b14a87d24165e1f39a1e892367ff2105124a85a95b81c4/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732f736861686d616c317965762f67436f6c6c656374696f6e)](https://camo.githubusercontent.com/5b583146487728fd04b14a87d24165e1f39a1e892367ff2105124a85a95b81c4/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732f736861686d616c317965762f67436f6c6c656374696f6e)[![GitHub stars](https://camo.githubusercontent.com/01247fcffd4c6ff40be725bdcd426ae55c38745962c0f0d1eab6ef2911333a58/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f736861686d616c317965762f67436f6c6c656374696f6e)](https://camo.githubusercontent.com/01247fcffd4c6ff40be725bdcd426ae55c38745962c0f0d1eab6ef2911333a58/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f736861686d616c317965762f67436f6c6c656374696f6e)[![GitHub forks](https://camo.githubusercontent.com/fb08c66b8fd6d202a4c38bb4c98602e648e5867e9251dec703dfbce29904990c/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f666f726b732f736861686d616c317965762f67436f6c6c656374696f6e)](https://camo.githubusercontent.com/fb08c66b8fd6d202a4c38bb4c98602e648e5867e9251dec703dfbce29904990c/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f666f726b732f736861686d616c317965762f67436f6c6c656374696f6e)[![GitHub contributors](https://camo.githubusercontent.com/00276fd7350e4df11b2ef0b27ba7e7e9cf2a931d88bdc6d874cd6344fac77b73/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f636f6e7472696275746f72732f736861686d616c317965762f67436f6c6c656374696f6e)](https://camo.githubusercontent.com/00276fd7350e4df11b2ef0b27ba7e7e9cf2a931d88bdc6d874cd6344fac77b73/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f636f6e7472696275746f72732f736861686d616c317965762f67436f6c6c656374696f6e)

`GenericCollection` is a PHP library for handling collections with support for various primitive types. It allows for flexible type validation and manipulation of collections.

Features
--------

[](#features)

- **Flexible Type Handling**: Supports various primitive types such as `int`, `string`, `float`, `bool`, and more.
- **Type Validation**: Provides methods to validate if an item in the collection adheres to the specified type.
- **Extensible**: Easily extendable to support custom types and validation logic.

Dependencies
------------

[](#dependencies)

```
{
  "require": {
    "php": ">=7.4"
  },
  "require-dev": {
    "phpunit/phpunit": "9.6.20"
  }
}
```

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

[](#installation)

You can install `GenericCollection` via Composer. If you don't have Composer installed, you can get it from [getcomposer.org](https://getcomposer.org).

Run the following command to install `GenericCollection`:

```
composer require shahmal1yev/gcollection
```

Usage
-----

[](#usage)

Here is a basic example of how to use the `GenericCollection`:

```
