PHPackages                             safronik/code-patterns - 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. [Templating &amp; Views](/categories/templating)
4. /
5. safronik/code-patterns

ActiveLibrary[Templating &amp; Views](/categories/templating)

safronik/code-patterns
======================

Implementation of different code patterns mainly could be used as traits

0.2.0(2mo ago)0372MITPHPPHP &gt;=8.2

Since Apr 18Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/safronik/project-code-patterns)[ Packagist](https://packagist.org/packages/safronik/code-patterns)[ Docs](https://github.com/Safronik/project-code-patterns)[ RSS](/packages/safronik-code-patterns/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (4)DependenciesVersions (5)Used By (2)

safronik/code-patterns
======================

[](#safronikcode-patterns)

 **A PHP library contains code patterns ready to use.**

About
-----

[](#about)

This package contains few main code patterns you can use to build your own project. You are free to use anywhere in any way you want (MIT License).

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

[](#installation)

The preferred method of installation is via Composer. Run the following command to install the package and add it as a requirement to your project's `composer.json`:

```
composer require safronik/code-patterns
```

Content
-------

[](#content)

Patterns grouped by their destination:

### Generative:

[](#generative)

Patterns which are create or store objects/values

- [AbstractFabric.php](src%2FGenerative%2FAbstractFabric.php)
- [Builder.php](src%2FGenerative%2FBuilder.php)
- [Container.php](src%2FGenerative%2FContainer.php)
- [Fabric.php](src%2FGenerative%2FFabric.php)
- [Multiton.php](src%2FGenerative%2FMultiton.php)
- [Prototype.php](src%2FGenerative%2FPrototype.php)
- [RAII.php](src%2FGenerative%2FRAII.php)
- [Registry.php](src%2FGenerative%2FRegistry.php)
- [Singleton.php](src%2FGenerative%2FSingleton.php)

### Structural:

[](#structural)

Patterns which help to organize and build solid code structure

- [Decorator.php](src%2FStructural%2FDecorator.php)
- [DTO.php](src%2FStructural%2FDTO.php)
- [Hydrator.php](src%2FStructural%2FHydrator.php)

### Behavioral:

[](#behavioral)

These helps you to organize the code in dynamic, its behaviour.

- [Event.php](src%2FBehavioral%2FEvent.php)
- [EventBroker.php](src%2FBehavioral%2FEventBroker.php)
- [EventManager.php](src%2FBehavioral%2FEventManager.php)

### Custom:

[](#custom)

Patterns from any previous group with some additional changes like lazy loads or specific keys

- [MultitonByClassname.php](src%2FCustom%2FMultitonByClassname.php)

### Contributing

[](#contributing)

Feel free to contribute!

###  Health Score

39

—

LowBetter than 86% of packages

Maintenance84

Actively maintained with recent releases

Popularity7

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity46

Maturing project, gaining track record

 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

Every ~225 days

Total

4

Last Release

83d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/c69e7608cd7b2fe530ef65731dc64b353ece983e732764a99d0155beac3275d9?d=identicon)[Safronik](/maintainers/Safronik)

---

Top Contributors

[![safronik](https://avatars.githubusercontent.com/u/16255344?v=4)](https://github.com/safronik "safronik (22 commits)")

---

Tags

codetemplatepattern

### Embed Badge

![Health badge](/badges/safronik-code-patterns/health.svg)

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

###  Alternatives

[phpoffice/phpword

PHPWord - A pure PHP library for reading and writing word processing documents (OOXML, ODF, RTF, HTML, PDF)

7.6k34.7M186](/packages/phpoffice-phpword)[rize/uri-template

PHP URI Template (RFC 6570) supports both expansion &amp; extraction

420137.3M46](/packages/rize-uri-template)[mopa/bootstrap-sandbox-bundle

Seperate live docs from code

256.8k](/packages/mopa-bootstrap-sandbox-bundle)[larablocks/pigeon

A more flexible email message builder for Laravel 5 including chained methods, reusable message configurations, and message layout and template view management.

143.7k](/packages/larablocks-pigeon)

PHPackages © 2026

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