qlimix/serializable 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

qlimix/serializable

Composer 安装命令:

composer require qlimix/serializable

包简介

An interface that indicates the object is serializable

关键字:

README 文档

README

Travis CI Packagist MIT License

An interface that indicates the object is serializable.

Install

Using Composer:

$ composer require qlimix/serializable

usage

<?php

use Qlimix\Serializable\SerializableInterface;

final class FooBar implements SerializableInterface
{
    /** @var string */
    private $foo;
    
    /** @var int */
    private $bar;
    
    public function __construct(string $foo, int $bar)
    {
        $this->foo = $foo;
        $this->bar = $bar;
    }
    
    public function getName(): string
    {
        return 'foo.bar';
    }
    
    public function serialize(): array
    {
        return [
            'foo' => $this->foo,
            'bar' => $this->bar,
        ];
    }

    public static function deserialize(array $data): SerializableInterface
    {
        return new self($data['foo'], $data['bar']);
    }
}

If whatever you are serializing doesn't cross the boundaries of your application you could use the GetClassNameTrait to refer to the object class name.

Testing

To run all unit tests locally with PHPUnit:

$ vendor/bin/phpunit

Quality

To ensure code quality run grumphp which will run all tools:

$ vendor/bin/grumphp run

Contributing

Please see CONTRIBUTING for details.

统计信息

  • 总下载量: 652
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 3
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-06-15

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固