PHPackages                             jpc/design-pattern - 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. jpc/design-pattern

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

jpc/design-pattern
==================

Simple Design Patter integration

1.1.0(5y ago)046.2k↓65.8%GPL-3.0PHPPHP &gt;=5.4CI failing

Since Sep 29Pushed 5y ago1 watchersCompare

[ Source](https://github.com/JoffreyPoreeCoding/DesignPattern)[ Packagist](https://packagist.org/packages/jpc/design-pattern)[ Docs](https://github.com/JoffreyPoreeCoding/DesignPattern)[ RSS](/packages/jpc-design-pattern/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (8)Dependencies (2)Versions (9)Used By (0)

DesignPattern
=============

[](#designpattern)

**DesignPattern** library allow you to simply include design pattern like **Singleton** or **Multiton** into your classes.

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

[](#installation)

Use `composer require jpc/design-pattern` to install with composer.

How to use
----------

[](#how-to-use)

### Create the singleton class

[](#create-the-singleton-class)

Create your class which you want to be a Singleton class.

```

```

Then, add the Singleton trait.

```

```

### Get the Singleton class

[](#get-the-singleton-class)

You can simply use the static function `getInstance` to get singleton instance.

```
//Some Code
$mySingleton = MySingletonClass::getInstance($param1, $param2);
//Some Code
```

#### For **Multiton**

[](#for-multiton)

The unique difference between Singleton and Multiton is when you get the instance, you have to pass an identifier like that :

```
//Some Code
$myMultiton = MyMultitonClass::getInstance("IDENTIFIER", $param1, $param2);
//Some Code
```

It's allow you to make different instance with different parameters.

Thanks You!
-----------

[](#thanks-you)

Thanks you for reading and maybe for downloading and use this library! If you have some request, make them and i will code it for you!

###  Health Score

33

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity28

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity63

Established project with proven stability

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 ~215 days

Recently: every ~367 days

Total

8

Last Release

2060d ago

Major Versions

0.2.0 → 1.0.02016-11-03

### Community

Maintainers

![](https://www.gravatar.com/avatar/98f6dc165225e41186faf7b510ef920bf4085e3ffe4f33745d2e3600994cec8a?d=identicon)[JoffreyPoreeCoding](/maintainers/JoffreyPoreeCoding)

---

Tags

traitsingletonmultitonDesignPattern

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/jpc-design-pattern/health.svg)

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

###  Alternatives

[nette/robot-loader

🍀 Nette RobotLoader: high performance and comfortable autoloader that will search and autoload classes within your application.

89955.0M361](/packages/nette-robot-loader)[kkszymanowski/traitor

Add a trait use statement to existing PHP class

1305.6M16](/packages/kkszymanowski-traitor)[gomachan46/state-machine

simple state machine with annotations for PHP, inspired by AASM known as a Ruby state machine.

1897.8k](/packages/gomachan46-state-machine)[ebidtech/collection

A set of interfaces and traits to speed up the creation of collections

13123.6k6](/packages/ebidtech-collection)[fanmade/laravel-bitwise-trait

Simple trait to use bitwise operators on any class

1575.0k](/packages/fanmade-laravel-bitwise-trait)[markbaker/enumhelper

A small library that provides Helper Traits for PHP 8.1 Enums

2822.1k1](/packages/markbaker-enumhelper)

PHPackages © 2026

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