PHPackages                             artisansdk/generic - 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. artisansdk/generic

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

artisansdk/generic
==================

A user-land implementation of generics in PHP.

1626PHP

Since Jul 10Pushed 2y ago4 watchersCompare

[ Source](https://github.com/artisansdk/generic)[ Packagist](https://packagist.org/packages/artisansdk/generic)[ RSS](/packages/artisansdk-generic/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependenciesVersions (1)Used By (0)

Generics
========

[](#generics)

A PHP-based implementation of generics (templated classes) to aid with stricter type consistency.

Table of Contents
-----------------

[](#table-of-contents)

- [Installation](#installation)
- [Usage Guide](#usage-guide)
    - [Motivation Behind the Library](#motivation-behind-the-library)
    - [Run Without Type Checks](#run-without-type-checks)
    - [Creating Custom Generics](#creating-custom-generics)
- [Licensing](#licensing)

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

[](#installation)

The package installs into a PHP application like any other PHP package:

```
composer require artisansdk/generic
```

Usage Guide
-----------

[](#usage-guide)

For examples see `tests/Example.php`. Run the following for a performance test:

```
php tests/Example.php
```

Using a generic is just a matter of instantiating it with the required typed parameters which will be used for type checking from then on:

```
