承接 troytft/mapper 相关项目开发

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

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

troytft/mapper

最新稳定版本:v2.1.0

Composer 安装命令:

composer require troytft/mapper

包简介

Mapper is a PHP library for mapping data to objects, type of property can be configured by annotation

关键字:

README 文档

README

Mapper is a PHP library for mapping data to objects, type of property can be configured by annotation

Features

  • Supports scalar types: integer, float, boolean, string
  • Supports any nesting level using object and collection types
  • Supports work with dates
  • Allows write your own types
  • Allows define nullability of property

Usage

<?php

use Mapper\Annotation as Mapper;
use Mapper\ModelInterface;

class Movie implements ModelInterface
{
    /**
     * @var string
     *
     * @Mapper\StringType()
     */
    private $name;

    /**
     * @var Release[]|null
     *
     * @Mapper\CollectionType(type=@Mapper\ObjectType(class="Model\Release"), nullable=true)
     */
    private $releases;
    
    ... getters and setters
}

$model = new Movie();
$data = [
    'name' => 'Taxi 2',
    'releases' => [
        [
            'country' => 'France',
            'date' => '2000-03-25'
        ],
    ]
];

$mapper->map($model, $data);

Requirements

  • PHP 7.4 or higher

Installation

composer require troytft/mapper

Documentation

Full documentation can be found at docs/main.md

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: Apache-2.0
  • 更新时间: 2019-09-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固