PHPackages                             estaleiroweb/traits - 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. estaleiroweb/traits

ActiveLibrary

estaleiroweb/traits
===================

PHP Traits used in others projects of EstaleiroWeb

0411PHP

Since Oct 11Pushed 7mo ago1 watchersCompare

[ Source](https://github.com/estaleiroweb/traits)[ Packagist](https://packagist.org/packages/estaleiroweb/traits)[ RSS](/packages/estaleiroweb-traits/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

EstaleiroWeb\\Traits
====================

[](#estaleirowebtraits)

PHP Traits used in others projects of EstaleiroWeb

Traits Decription
-----------------

[](#traits-decription)

### Trait Debug

[](#trait-debug)

Implements the method who prints all trace from the position where was called.

```
class MyClass {
	use EstaleiroWeb\Traits\Debug;
	public function __construct(){
		$this->fnA();
	}
	public function fnA(){
		$this->fnB();
	}
	public function fnB(){
		$this->debug();
	}
}
new MyClass;
```

### Trait GetterAndSetter

[](#trait-getterandsetter)

Automates the overload of Getters and Setters methods.

```
class MyClass {
	use EstaleiroWeb\Traits\GetterAndSetter;
	private $xValue;
	public function __construct($value=1){
		$this->readonly=[
			'v1'=>$value,
			'v2'=>$value,
		];
		$this->protect=[
			'v3'=>$value,
		];
		$this->v4=$value;
	}
	public function getV4(){
		$this->xValue;
	}
	public function setV2($value){
		$this->xValue=$value * 3;
	}
	public function setV4($value){
		$this->xValue=$value * 3;
	}
}
$o=new MyClass;
print "{$o->v1},{$o->v2},{$o->v3},{$o->v4}\n";
// 1,1,1,3
$o->v1=2;
$o->v2=2;
$o->v3=2;
$o->v4=2;
print "{$o->v1},{$o->v2},{$o->v3},{$o->v4}\n";
// 1,6,2,6
```

### Trait GetterAndSetterRO

[](#trait-getterandsetterro)

Idem GetterAndSetter, but implements only readonly methods.

### Trait LoadParameters

[](#trait-loadparameters)

Easily load parameters in order.

### Trait NetTools

[](#trait-nettools)

Implements some methods to tools network

- nmap: Check if a host's port is free
- getFreeRandomPort: Dicovery a free port to use.
- checkHost: Check is exists host
- goURL: Redirect to another URL
- hostname: Get hostname

### Trait Options

[](#trait-options)

In implementation

### Trait OverLoadElements

[](#trait-overloadelements)

In implementation

### Trait SessionConfig

[](#trait-sessionconfig)

In implementation

### Trait Singleton

[](#trait-singleton)

Implements a singleton class

```
class MyClass {
	use EstaleiroWeb\Traits\Singleton;
	public $v;
	protected function __construct($v){
		$this->v=$v;
	}
}
$a=new MyClass(1);
// ERROR
$b=MyClass::singleton(1);
$c=MyClass::singleton(2);
print "{$b->v},{$c->v}";
// 1,1
$b-v=3;
print "{$b->v},{$c->v}";
// 3,3
```

### Trait SingletonClass

[](#trait-singletonclass)

Same as Singleton, but creates a new instance for each different class it called.

### Trait SingletonKey

[](#trait-singletonkey)

Same as Singleton, but creates a new instance for each different key it passed.

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance47

Moderate activity, may be stable

Popularity9

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity13

Early-stage or recently created project

 Bus Factor1

Top contributor holds 93.3% 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/943dd6f9f045099de47b09d7e9c745c38615fae96992abbfc60854ff3a753362?d=identicon)[estaleiroweb](/maintainers/estaleiroweb)

---

Top Contributors

[![estaleiroweb](https://avatars.githubusercontent.com/u/91695243?v=4)](https://github.com/estaleiroweb "estaleiroweb (14 commits)")[![HelbertFernandes](https://avatars.githubusercontent.com/u/199752?v=4)](https://github.com/HelbertFernandes "HelbertFernandes (1 commits)")

### Embed Badge

![Health badge](/badges/estaleiroweb-traits/health.svg)

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

PHPackages © 2026

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