承接 agelxnash/laravel-magic-dto 相关项目开发

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

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

agelxnash/laravel-magic-dto

最新稳定版本:1.0.1

Composer 安装命令:

composer require agelxnash/laravel-magic-dto

包简介

README 文档

README

Total Downloads codecov

class ExampleDto extends MagicDto
{
    public function __construct(
        public int $propInt,
        public float $propFloat,
        public CarbonImmutable $date,
        public ?ExampleDto $nested = null,
    ) {
    }
}
ExampleDto::from([
    'propInt' => 666,
    'propFloat' => '100.5',
    'date' => '2023-12-11',
    'nested' => [
        'date' => '2024-02-23',
        'propInt' => 777,
        'propFloat' => '200.1',
    ],
])
// or
ExampleDto::from([
    'prop_int' => 666,
    'prop_float' => '100.5',
    'date' => '2023-12-11',
    'nested' => [
        'date' => '2024-02-23',
        'prop_int' => 777,
        'prop_float' => '200.1',
    ],
])

Inject eloquent models

composer require "illuminate/database" required when you need to use AgelxNash\MagicDto\Attributes\InjectModel

Class User extends Illuminate\Database\Eloquent\Model {}

class ExampleDto extends MagicDto
{
    public function __construct(
        #[InjectModel(User::class, 'id')]
        public User $user1,
        #[InjectModel(User::class, 'email')]
        public User $user2,
    ) {
    }
}

ExampleDto::from(['user1' => 777]);
ExampleDto::from(['user2' => 'agel-nash@example.com']);

Author

Borisov Evgeniy
Agel_Nash


Laravel, MODX, Security Audit



https://agel-nash.ru
Telegram: @agel_nash
Email: laravel@agel-nash.ru

Donation


ЮMoney: 41001299480137

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-02-24