PHPackages                             denshoch/msg-stack - 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. denshoch/msg-stack

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

denshoch/msg-stack
==================

A message stack system that accumulates messages while continuing process

v0.1.1(1y ago)0301MITPHPPHP &gt;=8.1

Since Nov 23Pushed 1y ago2 watchersCompare

[ Source](https://github.com/denshoch/msg-stack)[ Packagist](https://packagist.org/packages/denshoch/msg-stack)[ RSS](/packages/denshoch-msg-stack/feed)WikiDiscussions master Synced 1mo ago

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

msg-stack
=========

[](#msg-stack)

A message stack system that accumulates messages while continuing process.

Features
--------

[](#features)

- Stack messages with different severity levels (ERROR, WARNING, INFO, SUCCESS)
- Continue processing even after errors (configurable)
- Multi-language support via YAML message definitions
- Type-safe implementation using PHP 8.1 enums
- Simple and intuitive API

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

[](#installation)

```
composer require denshoch/msg-stack

```

Basic Usage
-----------

[](#basic-usage)

```
use Denshoch\MsgStack\MessageStore;
use Denshoch\MsgStack\MessageType;

// Initialize with message directory and language
$messageStore = new MessageStore(__DIR__ . '/messages', 'ja');

// Configure error handling
$messageStore->setContinueOnError(true);

try {
    // Add messages of different types
    $messageStore->addMessage(
        MessageType::WARNING,
        'W001',
        ['filename' => 'example.jpg']
    );

    // Process continues...
    $messageStore->addMessage(
        MessageType::ERROR,
        'E001',
        ['path' => '/invalid/path']
    );

} catch (MessageException $e) {
    // Handle errors when continueOnError is false
} finally {
    // Get all accumulated messages
    $allMessages = $messageStore->getMessages();

    // Or get messages by type
    $warnings = $messageStore->getMessages(MessageType::WARNING);

    // Check for specific message types
    if ($messageStore->hasMessages(MessageType::ERROR)) {
        // Handle errors...
    }
}
```

Message Definition
------------------

[](#message-definition)

Create YAML files in your messages directory:

```
# messages/en.yml
W001: 'Low resolution image detected: {filename}'
E001: 'Invalid path: {path}'

# messages/ja.yml
W001: '低解像度の画像が検出されました: {filename}'
E001: '不正なパスです: {path}'
```

API Reference
-------------

[](#api-reference)

### MessageStore

[](#messagestore)

- `__construct(string $messagesDir, string $language = 'en')`
- `setLanguage(string $language): void`
- `setContinueOnError(bool $continue): void`
- `addMessage(MessageType $type, string $code, array $params = []): void`
- `getMessages(?MessageType $type = null): array`
- `hasMessages(MessageType $type): bool`
- `clearMessages(): void`

### MessageType

[](#messagetype)

```
enum MessageType: string
{
    case INFO = 'info';
    case WARNING = 'warning';
    case ERROR = 'error';
    case SUCCESS = 'success';
}
```

Requirements
------------

[](#requirements)

- PHP 8.1 or later
- symfony/yaml ^6.0

License
-------

[](#license)

MIT License

Author
------

[](#author)

Densho Channel

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance38

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity38

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.

###  Release Activity

Cadence

Every ~0 days

Total

2

Last Release

541d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/300c27810659995976cf7fc8cb82e3c2a5e244c24dab6c4eecc8052272234569?d=identicon)[denshoch](/maintainers/denshoch)

---

Top Contributors

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

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/denshoch-msg-stack/health.svg)

```
[![Health](https://phpackages.com/badges/denshoch-msg-stack/health.svg)](https://phpackages.com/packages/denshoch-msg-stack)
```

###  Alternatives

[orchestra/canvas

Code Generators for Laravel Applications and Packages

20917.2M158](/packages/orchestra-canvas)[lullabot/drainpipe

An automated build tool to allow projects to have a set standardized operations scripts.

41716.4k2](/packages/lullabot-drainpipe)[netgen/content-browser

Netgen Content Browser is a Symfony bundle that provides an interface which selects items from any kind of backend and returns the IDs of selected items back to the calling code.

14112.1k8](/packages/netgen-content-browser)

PHPackages © 2026

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