PHPackages                             phpf/common - 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. phpf/common

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

phpf/common
===========

Phpf Common package

032PHP

Since Jan 31Pushed 11y ago1 watchersCompare

[ Source](https://github.com/phpf/Common)[ Packagist](https://packagist.org/packages/phpf/common)[ RSS](/packages/phpf-common/feed)WikiDiscussions master Synced 1w ago

READMEChangelogDependenciesVersions (1)Used By (0)

Common
======

[](#common)

Common class library, including a flexible autoloader and various containers.

**Namespace: `Phpf\Common`**

**Dependencies: None**

\###Classes #####Containers

- `Container`
- `DataContainer`
- `EnhancedContainer`
- `EnhancedDataContainer`
- `SerializableContainer`
- `SerializableDataContainer`

\#####Registries

- `Registry`
- `StaticRegistry`

\#####Other

- `Autoloader`
- `ClassAliaser`

\###About

\####Containers Containers provide a generic object interface and are based on 4 core methods:

- `get($var)` - Retrieve an item.
- `set($var, $val)` - Set an item.
- `exists($var)` - Return whether an item exists.
- `remove($var)` - Remove an item.

Containers also have the following additional methods:

- `import($vars)` - Sets items from an associative array or iterable object.
- `toArray($indexed = false)` - Returns items as an array, optionally indexed.
- `count()` - Implements `Countable`
- `getIterator()` - Implements `IteratorAggregate`.

Containers implement `ArrayAccess` and the four magic methods `__get()`, `__set()`, `__isset()`, and `__unset()`. Both the magic and array access methods are based on the four core methods, which means that subclasses only need to overwrite the 4 core methods.

\#####`Container`The `Container` class is the simplest type of container. Each item is a property - for example, `$container->set('name', 'Jim')` would set the object property `name` to `Jim`.

\#####`DataContainer`The `DataContainer` class has the same methods as the basic container; however, items are stored in a single array property `data`. Using the same example as above, the data container would instead add an array entry to its `data` property with key `name` and value `Jim`.

\#####`EnhancedContainer`The "enhanced" containers (`EnhancedContainer` and `EnhancedDataContainer`) simply allow callable properties to be added and then called as object methods, much like JavaScript.

For example:

```
$container = new \Phpf\Common\EnhancedContainer;

$container->set('formalize', function ($last_name, $gender) {

	switch($gender) {
		case 'doctor':
			$pre = 'Dr.';
			break;
		case 'male':
			$pre = 'Mr.';
			break;
		case 'female':
			$pre = 'Ms.';
			break;
	}

	return $pre.' '.$last_name;
});

echo $container->formalize('Jones', 'male'); // prints "Mr. Jones"
```

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/2b5b7d38d1408fa7abf81c2650415faa6d135c0725b5a25c5e52aefeac03c455?d=identicon)[wells5609](/maintainers/wells5609)

---

Top Contributors

[![wells5609](https://avatars.githubusercontent.com/u/4088444?v=4)](https://github.com/wells5609 "wells5609 (9 commits)")

### Embed Badge

![Health badge](/badges/phpf-common/health.svg)

```
[![Health](https://phpackages.com/badges/phpf-common/health.svg)](https://phpackages.com/packages/phpf-common)
```

###  Alternatives

[dcblogdev/laravel-companies-house

A Laravel Companies House package

1115.4k](/packages/dcblogdev-laravel-companies-house)

PHPackages © 2026

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