PHPackages                             lassehaslev/universal-objects - 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. lassehaslev/universal-objects

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

lassehaslev/universal-objects
=============================

0.1.0(9y ago)01031PHP

Since Dec 1Pushed 9y ago1 watchersCompare

[ Source](https://github.com/LasseHaslev/UniversalObjects)[ Packagist](https://packagist.org/packages/lassehaslev/universal-objects)[ RSS](/packages/lassehaslev-universal-objects/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependencies (2)Versions (3)Used By (1)

lassehaslev/universal-objects
=============================

[](#lassehaslevuniversal-objects)

> Create global classes with ease!

Install
-------

[](#install)

```
composer require lassehaslev/universal-objects

```

Usage
-----

[](#usage)

Extend global behavior:

```
class MyClass extends LasseHaslev\UniversalObjects\Object {}
```

#### Create

[](#create)

Create a global instance simple with create or get. First time you call this method you create a new instance. But all the next time you call these methods, you simple return the existsing instance for that particular object.

```
MyClass::create(); // Create new or gets existing instance of my class
// or use alias "get" function
MyClass::get(); // alias for create()
```

Create different global object to use other places. Note that the first instance will still be used, and 'second' will only create a new instance

```
$firstInstance = MyClass::create(); // Creates new instance
$secondInstance = MyClass::create( 'second' ); // Creates new instance

$firstInstance = MyClass::get(); // Get first instance
$secondInstance = MyClass::get( 'second' ); // Get second instance
```

To force create a new instance you can call createNew function

```
$firstInstance = MyClass::create(); // Creates new instance
$firstInstance = MyClass::createNew(); // Creates new instance
```

#### Destroy

[](#destroy)

You can also destroy instances you have created. If you run create again, they will create new fresh instances

```
$firstInstance = MyClass::create(); // Creates new instance
$secondInstance = MyClass::createNew( 'second' ); // Creates new instance

$firstInstance = MyClass::destroy(); // Deletes instance $firstInstance
$secondInstance = MyClass::destroy( 'second' ); // Deletes instance $seondInstance
```

```
$firstInstance = MyClass::create(); // Creates new instance
$secondInstance = MyClass::createNew( 'second' ); // Creates new instance

$firstInstance = MyClass::destroyAll(); // Destroy all instances of class ($firstInstance, $secondInstance)
```

Development
-----------

[](#development)

```
# Install dependencies
composer install

# Install dependencies for automatic tests
yarn

```

#### Runing tests

[](#runing-tests)

```
# Run one time
npm run test

# Automaticly run test on changes
npm run dev
```

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity54

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

Total

2

Last Release

3440d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/39edaff7913420649a4d7e159faecfef8210b583f645ef2f89545f2c72b64a9b?d=identicon)[LasseHaslev](/maintainers/LasseHaslev)

---

Top Contributors

[![LasseHaslev](https://avatars.githubusercontent.com/u/3670799?v=4)](https://github.com/LasseHaslev "LasseHaslev (5 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/lassehaslev-universal-objects/health.svg)

```
[![Health](https://phpackages.com/badges/lassehaslev-universal-objects/health.svg)](https://phpackages.com/packages/lassehaslev-universal-objects)
```

###  Alternatives

[easyrdf/easyrdf

EasyRdf is a PHP library designed to make it easy to consume and produce RDF.

62231.5M42](/packages/easyrdf-easyrdf)[spatie/laravel-enum

Laravel Enum support

3655.4M31](/packages/spatie-laravel-enum)[johnpbloch/wordpress-core

WordPress is open source software you can use to create a beautiful website, blog, or app.

17812.3M117](/packages/johnpbloch-wordpress-core)[functional-php/fantasy-land

Specification for interoperability of common algebraic structures in PHP

396.2M5](/packages/functional-php-fantasy-land)[symfony/ai-platform

PHP library for interacting with AI platform provider.

51927.7k136](/packages/symfony-ai-platform)

PHPackages © 2026

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