PHPackages                             roshan-dhungana/status - 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. roshan-dhungana/status

ActiveLibrary

roshan-dhungana/status
======================

Reusable enum helpers for status handling (values, options, labels) with Laravel support

00PHP

Since Apr 5Pushed 3d agoCompare

[ Source](https://github.com/dhunganaroshan341/StatusEnumComposer)[ Packagist](https://packagist.org/packages/roshan-dhungana/status)[ RSS](/packages/roshan-dhungana-status/feed)WikiDiscussions main Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

```
# Status Enum Package

A lightweight, reusable PHP 8.1+ package that standardizes enum usage for dropdowns, validation, and display logic—especially useful in Laravel applications.

---

## ✨ Features

- Enum value extraction for validation
- Dropdown-friendly options
- Clean label formatting
- Built-in validation rule
- Instance helper methods (`is`, `label`)
- Laravel-ready (framework-agnostic core)

---

## 📥 Installation

```bash
composer require roshan-dhungana/status
```

---

⚙️ Requirements
---------------

[](#️-requirements)

- PHP 8.1+
- Laravel 10+ (optional)

---

🚀 Quick Start
-------------

[](#-quick-start)

### Create your Enum

[](#create-your-enum)

```
namespace App\Enums;

use RoshanDhungana\Status\Contracts\EnumContract;
use RoshanDhungana\Status\Traits\HasEnumHelpers;

enum ProjectStatus: string implements EnumContract
{
    use HasEnumHelpers;

    case ACTIVE = 'active';
    case INACTIVE = 'inactive';
    case DRAFT = 'draft';
}
```

---

📋 Usage
-------

[](#-usage)

### Get values (for validation)

[](#get-values-for-validation)

```
ProjectStatus::values();
```

Returns:

```
['active', 'inactive', 'draft']
```

---

### Validation (Laravel)

[](#validation-laravel)

```
use Illuminate\Validation\Rule;

'status' => ProjectStatus::rule(),
```

---

### Dropdown options

[](#dropdown-options)

```
ProjectStatus::options();
```

Returns:

```
[
    'active' => 'Active',
    'inactive' => 'Inactive',
    'draft' => 'Draft',
]
```

---

### Blade Example

[](#blade-example)

```
@foreach(ProjectStatus::options() as $value => $label)
    {{ $label }}
@endforeach
```

---

### Get label from enum instance

[](#get-label-from-enum-instance)

```
$status->label();
```

---

### Compare values safely

[](#compare-values-safely)

```
if ($status->is(ProjectStatus::ACTIVE)) {
    // logic here
}
```

or

```
$status->is('active');
```

---

### Parse from raw value

[](#parse-from-raw-value)

```
$status = ProjectStatus::fromValue('active');
```

---

🧠 Why Use This Package?
-----------------------

[](#-why-use-this-package)

Without this package, enum usage is often scattered:

- Hardcoded arrays in validation
- Duplicate dropdown mappings
- Inconsistent label formatting

This package centralizes everything into a **single source of truth**, improving:

- Maintainability
- Readability
- Consistency across your app

---

🏗 Architecture
--------------

[](#-architecture)

- Contracts → define behavior
- Traits → reusable enum logic
- Enums → domain-specific states

The core is framework-agnostic while supporting Laravel seamlessly.

---

📌 Example: Eloquent Casting (Laravel)
-------------------------------------

[](#-example-eloquent-casting-laravel)

```
protected $casts = [
    'status' => ProjectStatus::class,
];
```

---

🔧 Extending
-----------

[](#-extending)

Create additional enums easily:

```
enum OrderStatus: string implements EnumContract
{
    use HasEnumHelpers;

    case PENDING = 'pending';
    case COMPLETED = 'completed';
}
```

---

🤝 Contributing
--------------

[](#-contributing)

Contributions, issues, and feature requests are welcome.

---

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance65

Regular maintenance activity

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity11

Early-stage or recently created project

 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/ab2d1e60fe97cb6b3b5413231ef100337cb8c90831502c9b6827ff2271c474b4?d=identicon)[dhunganaroshan341](/maintainers/dhunganaroshan341)

---

Top Contributors

[![dhunganaroshan341](https://avatars.githubusercontent.com/u/79978683?v=4)](https://github.com/dhunganaroshan341 "dhunganaroshan341 (3 commits)")

### Embed Badge

![Health badge](/badges/roshan-dhungana-status/health.svg)

```
[![Health](https://phpackages.com/badges/roshan-dhungana-status/health.svg)](https://phpackages.com/packages/roshan-dhungana-status)
```

PHPackages © 2026

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