New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

kakaprodo/custom-data

A Laravel package that wraps function arguments together into a single CustomData class allowing separate processing and validation for each argument.
4,568 7
Install
composer require kakaprodo/custom-data
Latest Version:v2.3.53
PHP:>=8.0
Laravel:8 – 12
Older releases:7
License:MIT
Last Updated:Aug 14, 2025
Links: GitHub  ·  Packagist
Maintainer: kakaprodo

Custom Data

Official Documentation

A Laravel package that wraps function arguments together into a single CustomData class allowing separate processing and validation for each argument.

class CreateUserData extends CustomData
{
    protected function expectedProperties(): array
    {
        return [
            'name' => $this->dataType()->string(),
            'email' => $this->dataType()->string(),
            'password' => $this->dataType()->string(),
            'age?' => $this->dataType()->string(),
            'sexe' => $this->dataType()->inArray(['M','F'])
        ];
    }
}

And then call it this way:

CreateUserData::make([
    'name' => 'kakaprodo',
    'email' => 'example@gmail.com',
    'password' => 'is_unique_pass',
    'sexe' => 'M'
]);

And if you like to decouple your code with small classes called Action , then you are at the right place:

class CreateUserAction extends CustomActionBuilder
{
   public function handle(CreateUserData $data)
   {
       return $data->onlyValidated();
   }
}

And then we call our action this way:

CreateUserAction::process([
    'name' => 'kakaprodo',
    'email' => 'example@gmail.com',
    'password' => 'is_unique_pass',
    'sexe' => 'M'
]);

Features

  • Combine several function arguments into one class called CustomData
  • Validate each argument a little bit the way TypeScript does it in Javascript
  • Support the definition of Laravel FormValidation rules
  • Support Action classes in which CustomData can be injected
  • Support The Ability to Queue Action class
  • Support helper command to generate Action and CustomData classes

You can find here the Official Documentation

Related Packages

valorin/random

Random is a simple helper package designed to make it easy to generate a range o...

423,305 234
php
cline/variable-keys

Laravel Blueprint macros for variable primary key and morph types

23,466 0
php
cline/struct

Lean, attribute-driven Laravel data objects with explicit validation and Eloquen...

18,346 0
php
cline/toggl

Advanced feature flag management with strategies, time bombs, and groups

12,635 0
php
cline/sequencer

Sequential migration and operation orchestration for Laravel

12,218 0
php

Version History

Version Released PHP Laravel License
v2.3.53 >=8.0 >=8.0 MIT
v2.3.52 >=8.0 >=8.0 MIT
2.3.51 >=7.0 >=7.0 MIT
v2.3.5 >=7.0 >=7.0 MIT
v2.3.4 >=7.0 >=7.0 MIT