PHPackages                             ap-lib/singleton - 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. ap-lib/singleton

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

ap-lib/singleton
================

Implementation for a singleton pattern

1.0.0(1y ago)021MITPHPPHP ^8.1

Since Feb 3Pushed 1y ago1 watchersCompare

[ Source](https://github.com/ap-lib/singleton)[ Packagist](https://packagist.org/packages/ap-lib/singleton)[ Docs](https://github.com/ap-lib/singleton)[ RSS](/packages/ap-lib-singleton/feed)WikiDiscussions main Synced today

READMEChangelog (1)Dependencies (1)Versions (2)Used By (0)

AP\\Singleton
=============

[](#apsingleton)

[![MIT License](https://camo.githubusercontent.com/7013272bd27ece47364536a221edb554cd69683b68a46fc0ee96881174c4214c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e737667)](LICENSE)

Implementation for a singleton pattern

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

[](#installation)

```
composer require ap-lib/singleton
```

Requirements
------------

[](#requirements)

- PHP 8.1 or higher

How it works
------------

[](#how-it-works)

```
use AP\Singleton\Singleton;

class Hello
{
    use Singleton;

    private string $format;

    public function sayHello(string $name): string
    {
        return sprintf($this->format, $name);
    }

    private function __construct()
    {
        $this->format = "Hello %s";
    }
}

echo Hello::getInstance()->sayHello("World"); // Hello World
```

###  Health Score

28

—

LowBetter than 57% of packages

Maintenance46

Moderate activity, may be stable

Popularity7

Limited adoption so far

Community7

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

Unknown

Total

1

Last Release

412d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/1215fe5ecc9ba0ab1c730d3c992125cf6ebf460562e66be71ebae127789d465a?d=identicon)[AntonPanfilov](/maintainers/AntonPanfilov)

---

Top Contributors

[![anton-panfilov](https://avatars.githubusercontent.com/u/1083546?v=4)](https://github.com/anton-panfilov "anton-panfilov (3 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/ap-lib-singleton/health.svg)

```
[![Health](https://phpackages.com/badges/ap-lib-singleton/health.svg)](https://phpackages.com/packages/ap-lib-singleton)
```

###  Alternatives

[php127/douyin

php视频去水印 抖音去水印 快手去水印

1714.7k](/packages/php127-douyin)[lkallas/estonianpin

A simple library for processing Estonian Personal Identification Code (isikukood).

1615.1k](/packages/lkallas-estonianpin)

PHPackages © 2026

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