2017 © Pedro Peláez
 

library ruby-marshal

ruby-marshal for PHP

image

sudiyi/ruby-marshal

ruby-marshal for PHP

  • Thursday, November 10, 2016
  • by sudiyi
  • Repository
  • 4 Watchers
  • 3 Stars
  • 112 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Sudiyi Ruby Marshal for PHP

概述

运行环境

  • PHP 5.4+
  • mbstring extension

安装方法

  1. 如果您通过composer管理您的项目依赖,可以在你的项目根目录运行:, (*1)

    $ composer require sudiyi/ruby-marshal

    或者在你的composer.json中声明对速递易开放平台 SDK 的依赖:, (*2)

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

    然后通过composer install安装依赖。, (*3)

  2. 下载SDK源码,在您的代码中引入 SDK 目录下的autoload.php文件:, (*4)

    require_once '/path/to/ruby_marshal/autoload.php';, (*5)

SDK 主要目录结构

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

异常处理

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

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程序

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

问题反馈

Goto: ISSUES, (*7)

开源协议

MIT, (*8)

The Versions

10/11 2016

dev-master

9999999-dev https://github.com/sudiyi/ruby_marshal

ruby-marshal for PHP

  Sources   Download

MIT

The Requires

  • php >=5.4

 

ruby marshal

02/11 2016

1.0.0

1.0.0.0 https://github.com/sudiyi/ruby_marshal

ruby-marshal for PHP

  Sources   Download

MIT

The Requires

  • php >=5.4

 

ruby marshal