承接 apie/common-value-objects 相关项目开发

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

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

apie/common-value-objects

Composer 安装命令:

composer require apie/common-value-objects

包简介

Composer package of the apie library: common value objects

README 文档

README

common-value-objects

Latest Stable Version Total Downloads Latest Unstable Version License PHP Composer

PHP Composer

This package is part of the Apie library. The code is maintained in a monorepo, so PR's need to be sent to the monorepo

Documentation

A set of common value object classes that can be used right away or can be used as examples how to make common value objects.

Enums

enums are just PHP enums with common values. They are fully supported by Apie.

Enums Description
Gender Indicate male or female

Identifiers

Identifiers are used by Apie entities to tell the id of an entity. To use these as identifiers for your entity, you need to extend one of these and implement the IdentifierInterface. Otherwise you can also use them as property fields on an entity or a composite value object.

Example:

<?php
use Apie\Core\Identifiers\UuidV4;
use Apie\Core\Identifiers\IdentifierInterface;

class UserIdentifier extends UuidV4 implements IdentifierInterface
{
    public static function getReferenceFor(): ReflectionClass
    {
        return new ReflectionClass(User::class);
    }
}
<?php
use Apie\Core\Entities\EntityInterface;

class User implements EntityInterface
{
    private UserIdentifier $id;

    public function __construct()
    {
        $this->id = UserIdentifier::createRandom();
    }

    public function getIdentifier(): UserIdentifier
    {
        return $this->id;
    }
}
Class Description
KebabCaseSlug Slug in the shape of "example-slug"
PascalCaseSlug Slug in the shape of "example_slug"
Slug Slug in the shape of "exampleslug"
Uuid Any string in the shape of an uuid
UuidV1 Uuid in version 1 format
UuidV2 Uuid in version 2 format
UuidV3 Uuid in version 3 format
UuidV4 Uuid in version 4 format
UuidV5 Uuid in version 5 format
UuidV6 Uuid in version 6 format

Name value objects

Contains value objects related to names. They are very tolerant what is written in them and support unicode characters to avoid wrong assumptions about what is a valid first and last name.

Class Description
FirstName First name
LastName Last name

Range value objects

Ranges often have a restriction related that for example the start should always be lower than the end. They are often a composite of 2 values.

Class Description
DateTimeRange A range between dates. The first date should always be lower than the last date

Text value objects

At first these value objects seem redundant as you wonder why you should not just use string, but the problem with using string is that it has no restriction on the length of a text. The value object will also mean you can tell an application it requires a non-empty text for example.

Class Description
SmallDatabaseText A string that fits into a database varchar field (255 characters). The text will be trimmed and can be empty.
StrongPasswordField A string used for passwords that are considered strong passwords.

apie/common-value-objects 适用场景与选型建议

apie/common-value-objects 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 7.53k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2021 年 01 月 22 日, 在 PHP 生态内属于活跃度较高的组件。

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

围绕 apie/common-value-objects 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-01-22