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

3441d 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

[oblik/kirby-link-field

Kirby 4 field for all types of links.

7650.6k2](/packages/oblik-kirby-link-field)[pinano/select2-bundle

Symfony2 bundle for wrapping the famous select2 jquery plugin by @ivaynberg

16198.3k1](/packages/pinano-select2-bundle)[sarfraznawaz2005/composer-cost

Displays cost/size of each composer package installed.

368.0k](/packages/sarfraznawaz2005-composer-cost)[laravelplus/laravel-updater

A Laravel package for syncing with upstream repositories (GitHub, GitLab, Bitbucket, etc.)

201.7k](/packages/laravelplus-laravel-updater)[ropendev/phptojs

PHPToJS's class convert php variable's content to js variable's content preserving javascript expression (like function)

105.8k1](/packages/ropendev-phptojs)

PHPackages © 2026

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