Download the PHP package aneterial/laravel-data-validator without Composer

On this page you can find all versions of the php package aneterial/laravel-data-validator. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-data-validator

laravel-data-validator

Build Status License Packagist PHP Laravel

Contents

Prerequisites

for dev

Installation

Install package via composer

Usage

You now have a class attribute DataValidator\Attributes\RequestProperty at your disposal. Add it to the properties of your DTO and set the necessary configuration fields

Description of fields:

Next, you need to get a DataValidator\DataManager instance in your controller from app DI container and pass the request essence to it, indicating the DTO class that you expect to receive after validation and filling with data.

Next, the Laravel validator will check the request entity (instanse of \Illuminate\Http\Request), and if the data is incorrect, it will throw an \Illuminate\Validation\ValidationException. If the data is correct, the Manager will create and fill the DTO object with data, which you can use in your application

If your endpoint involves passing array of objects [{...}, {...}, {...}], you can use a method that will validate the request and return an array of DTOs

Examples

Here are some examples of using validation by attributes

1) DTO with lists

2) DTO with non required properties, if it not required - it should be nullable, except array - it can be empty array

3) DTO with nested object

4) DTO with list of nested object

5) DTO with enum of BackedEnum property, you should set enum type to property and no more rules are required except, if you want - indicate type of enum

6) DTO with enums of BackedEnum property

Restrictions

if DTO has nested objects or arrays of nested objects, the requestDataType of these entities is ignored and taken from the parrent entity

So if you use

In nested object requestDataType will not work and it be RequestProperty::BODY_TYPE like in parrent entity

Method DataManager::validateAndConvertList can only work with data from request body, so all properties of entity will be force casted to type RequestProperty::BODY_TYPE in this usage


All versions of laravel-data-validator with dependencies

PHP Build Version
Package Version
Requires php Version >=8.2
laravel/framework Version ^11
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package aneterial/laravel-data-validator contains the following files

Loading the files please wait ....