PHPackages                             sevaske/support - 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. sevaske/support

ActiveLibrary

sevaske/support
===============

Reusable traits and utility helpers for PHP

1.0.0(5mo ago)0131↓100%MITPHPPHP ^7.4 || ^8.0CI passing

Since Oct 4Pushed 5mo ago1 watchersCompare

[ Source](https://github.com/sevaske/support)[ Packagist](https://packagist.org/packages/sevaske/support)[ GitHub Sponsors](https://github.com/sevaske)[ RSS](/packages/sevaske-support/feed)WikiDiscussions main Synced today

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

[![Packagist](https://camo.githubusercontent.com/0fbc213478fb99b10cfa949b0e3d901a27ea19fd1419fc7f2ef42eb320ffeb04/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f73657661736b652f737570706f72742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/sevaske/support)[![PHPUnit](https://github.com/sevaske/support/actions/workflows/tests.yml/badge.svg)](https://github.com/sevaske/support/actions/workflows/tests.yml)[![PHPStan](https://github.com/sevaske/support/actions/workflows/phpstan.yml/badge.svg)](https://github.com/sevaske/support/actions/workflows/phpstan.yml)[![License: MIT](https://camo.githubusercontent.com/fdf2982b9f5d7489dcf44570e714e3a15fce6253e0cc6b5aa61a075aac2ff71b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d79656c6c6f772e737667)](LICENSE)

PHP Support
===========

[](#php-support)

Lightweight and minimalistic PHP library providing a set of foundational tools for development.
Designed to be practical, extendable, and easy to integrate into projects, offering a flexible base for building more complex functionality.

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

[](#installation)

```
composer require sevaske/support
```

Features
--------

[](#features)

### Dynamic Attributes (`HasAttributes`)

[](#dynamic-attributes-hasattributes)

- Store attributes dynamically with magic methods: `__get`, `__set`, `__isset`, `__unset`.
- Supports array-style access via `ArrayAccess`.
- Utility methods:
    - `fill(array $attributes)` — bulk set attributes.
    - `has(string $key)` — check if an attribute exists.
    - `keys()` — list all attribute keys.
    - `replicate()` — clone object with same attributes.
    - `toArray()`, `jsonSerialize()` — export attributes.

**Example:**

```
use Sevaske\Support\Traits\HasAttributes;

class User {
    use HasAttributes;
}

$user = new User();
$user->fill(['name' => 'John', 'age' => 30]);
$user->age = 31;
$user->age; // 31
$user['age']; // 31
unset($user->name);

$copy = $user->replicate();
```

### Read-Only Attributes (`HasReadOnlyAttributesContract`)

[](#read-only-attributes-hasreadonlyattributescontract)

- Implements a contract to define read-only behavior.
- `readOnlyAttributes` can be `true` (all) or an array of keys.
- Modifying locked attributes throws `LogicException`.

**Example:**

```
class User implements HasReadOnlyAttributesContract {
    use HasAttributes;

    public function getReadOnlyAttributes(): bool|array
    {
        return ['age'];
    }
}

$user = new User();
$user->fill(['name' => 'John', 'age' => 30]);
$user->name = 'Alice'; // allowed
$user->age = 32; // throws LogicException
```

### Contextable Exceptions (`HasContext` + `ContextableException`)

[](#contextable-exceptions-hascontext--contextableexception)

- Attach metadata to exceptions.
- Fluent `withContext()` method and `context()` retrieval.

**Example:**

```
use Sevaske\Support\Exceptions\ContextableException;

    $ex = new ContextableException('Error', ['user_id' => 123]);
    $ex->withContext(['ip' => '127.0.0.1']);
    print_r($ex->context());
```

Contributing
------------

[](#contributing)

Contributions are welcome! Feel free to open issues or submit pull requests.
Please follow PSR-12 coding standards and include tests for any new features or fixes.

License
-------

[](#license)

This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.

###  Health Score

34

—

LowBetter than 79% of packages

Maintenance70

Regular maintenance activity

Popularity11

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity40

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

168d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/94643c38672a39a9b675ab6d43f5c1d3c0789300cc052f742a960e0a7d70847e?d=identicon)[sevaske](/maintainers/sevaske)

---

Top Contributors

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

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/sevaske-support/health.svg)

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

PHPackages © 2026

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