承接 chippyash/record-status 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

chippyash/record-status

Composer 安装命令:

composer require chippyash/record-status

包简介

Class Status Management

README 文档

README

Quality Assurance

PHP 5.6 PHP 7 Build Status Test Coverage Maintainability

See the Test Contract

What?

Provides a simple helper capability for managing record or class status

Why?

When dealing with database records, there is often a case for never deleting the record. This can be because you either don't want to lose the data, or you need it in place to ensure referential integrity with other data.

This small library provides the interfaces and traits to add a status functionality to any class.

Roadmap

If you want more, either suggest it, or better still, fork it and provide a pull request.

Check out ZF4 Packages for more packages

How

A record can be in one of three states:

  • active. An active record can have be changed to suspended or defunct
  • suspended. A suspended record can be changed to active of defunct. You should not change the attributes of a suspended reord.
  • defunct. A defunct record or class cannot have its state changed. This analogous to being deleted, except that the record data remains intact. You must not change the attributes of a defunct record.

Whilst the library provides support to manage the record status, you should also bear in mind that you will need to provide additional support to check the status in any of your other methods in a class.

In the docs directory, you'll also find an example trigger that you can use in MySql or MariaDb database server to maintain status integrity.

Coding Basics

Record Status Enum class

The Chippyash\RStatus\RecordStatus class is provided to provide the three possible states as a an Enum(erator) using the MyCLabs Enum library.

use Chippyash\RStatus\RecordStatus;

//create status objects
$status = RecordStatus::ACTIVE();
$status = RecordStatus::SUSPENDED();
$status = RecordStatus::DEFUNCT();

//test if status can be changed
if ($status->canChange()) {
	//....
}

Enabling RecordStatus for your class

Have your class implement the RecordStatusRecordable interface. Use the RecordStatusRecording trait as a convenient implementation of the interface.

use Chippyash\RStatus\RecordStatusRecordable;
use Chippyash\RStatus\RecordStatusRecording;

class MyRecord implements RecordStatusRecordable
{
	use RecordStatusRecording;
}

The RecordStatusRecording trait provides a protected $recordStatus propertyand the following methods:

/**
 * Return the record status
 *
 * @return RecordStatus
 */
public function getStatus();

/**
 * Set the record status
 *
 * @param RecordStatus $status
 *
 * @return $this
 *
 * @throws RecordStatusException
 */
public function setStatus(RecordStatus $status);

/**
 * Is record status == active
 *
 * @return bool
 */
public function isStatusActive();

/**
 * Is record status == suspended
 *
 * @return bool
 */
public function isStatusSuspended();

/**
 * Is record status == defunct
 *
 * @return bool
 */
public function isStatusDefunct();

Changing the library

  1. fork it
  2. write the test
  3. amend it
  4. do a pull request

Found a bug you can't figure out?

  1. fork it
  2. write the test
  3. do a pull request

NB. Make sure you rebase to HEAD before your pull request

Or - raise an issue ticket.

Where?

The library is hosted at Github. It is available at Packagist.org

Installation

Install Composer

For production

    "chippyash/record-status": ">=1,<2"

For development

Clone this repo, and then run Composer in local repo root to pull in dependencies

    git clone git@github.com:chippyash/record-status.git
    cd record-status
    composer install

To run the tests:

    cd record-status
    vendor/bin/phpunit -c test/phpunit.xml test/

License

This software library is released under the GNU GPL V3 or later license

This software library is Copyright (c) 2017, Ashley Kitson, UK

A commercial license is available for this software library, please contact the author. It is normally free to deserving causes, but gets you around the limitation of the GPL license, which does not allow unrestricted inclusion of this code in commercial works.

History

V1.0.0 Original release

V1.0.1 build integration

V1.0.2 typos

chippyash/record-status 适用场景与选型建议

chippyash/record-status 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 2.45k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2017 年 12 月 31 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「class」 「record」 「status」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 chippyash/record-status 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 chippyash/record-status 我们能提供哪些服务?
定制开发 / 二次开发

基于 chippyash/record-status 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: (GPL V3+ and Proprietary) 03a6982b3e95c606b222f01c6a28a03e4ba5197a
  • 更新时间: 2017-12-31