PHPackages                             sudiyi/ruby-marshal - 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. sudiyi/ruby-marshal

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

sudiyi/ruby-marshal
===================

ruby-marshal for PHP

1.0.0(9y ago)2276MITPHPPHP &gt;=5.4

Since Nov 2Pushed 9y ago4 watchersCompare

[ Source](https://github.com/sudiyi/ruby_marshal)[ Packagist](https://packagist.org/packages/sudiyi/ruby-marshal)[ Docs](https://github.com/sudiyi/ruby_marshal)[ RSS](/packages/sudiyi-ruby-marshal/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependenciesVersions (2)Used By (0)

Sudiyi Ruby Marshal for PHP
===========================

[](#sudiyi-ruby-marshal-for-php)

概述
--

[](#概述)

运行环境
----

[](#运行环境)

- PHP 5.4+
- mbstring extension

安装方法
----

[](#安装方法)

1. 如果您通过composer管理您的项目依赖，可以在你的项目根目录运行：

    ```
     $ composer require sudiyi/ruby-marshal

    ```

    或者在你的`composer.json`中声明对速递易开放平台 SDK 的依赖：

    ```
     "require": {
         "sudiyi/ruby-marshal": "~1.0"
     }

    ```

    然后通过`composer install`安装依赖。
2. 下载SDK源码，在您的代码中引入 SDK 目录下的`autoload.php`文件：

    ```
    require_once '/path/to/ruby_marshal/autoload.php';

    ```

SDK 主要目录结构
----------

[](#sdk-主要目录结构)

```
|-- example
|   `-- demo.php         案例程序代码
|-- src
|   |-- Helper.php          帮助类
|   |-- Ints.php            辅助类
|   |-- RubyMarshalLoad.php 主程序类
|   `-- RubyMarshalException.php    异常类
|-- autoload.php            PSR-4 自动加载
`-- composer.json

```

### 异常处理

[](#异常处理)

SDK 执行过程中若遇到异常，将会抛出一个 RubyMarshalException 异常，用户可自行捕获并处理。

```
use SuDiYi\RubyMarshal\RubyMarshalLoad;
use SuDiYi\RubyMarshal\UnEscape;
use SuDiYi\RubyMarshal\RubyMarshalException

try {
    $rubyMarshalLoad = new RubyMarshalLoad();
    $content = 'marshal-str'
    $arr = $rubyMarshalLoad->load($content);
} catch (RubyMarshalException $e) {
    echo "============== ERROR ==============\n";
    echo $e->getMessage() . "\n";
    var_dump($e->getErrorBody());
    echo "===================================\n";
}
```

### 运行Sample程序

[](#运行sample程序)

1. 执行 `php ./example/demo.php`

问题反馈
----

[](#问题反馈)

Goto: [ISSUES](https://github.com/sudiyi/ruby_marshal/issues)

开源协议
----

[](#开源协议)

MIT

###  Health Score

29

—

LowBetter than 57% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 87.5% 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

3521d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/20438046?v=4)[速递易](/maintainers/sudiyi)[@sudiyi](https://github.com/sudiyi)

---

Top Contributors

[![tqtxk](https://avatars.githubusercontent.com/u/9649222?v=4)](https://github.com/tqtxk "tqtxk (7 commits)")[![yiichou](https://avatars.githubusercontent.com/u/2182089?v=4)](https://github.com/yiichou "yiichou (1 commits)")

---

Tags

Marshalruby

### Embed Badge

![Health badge](/badges/sudiyi-ruby-marshal/health.svg)

```
[![Health](https://phpackages.com/badges/sudiyi-ruby-marshal/health.svg)](https://phpackages.com/packages/sudiyi-ruby-marshal)
```

###  Alternatives

[blainesch/prettyarray

Manipulate arrays similar to Ruby.

1019.2k](/packages/blainesch-prettyarray)

PHPackages © 2026

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