GithubHelp home page GithubHelp logo

irealworlds / laravel-attribute-requests Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 98 KB

A powerful tool designed to simplify the handling and validation of incoming requests in Laravel applications by making them work like DTOs with decorated properties.

License: MIT License

PHP 100.00%
laravel php requests

laravel-attribute-requests's People

Contributors

irealworlds avatar

Stargazers

 avatar

Watchers

 avatar

laravel-attribute-requests's Issues

Property names

Request properties should be able to be decorated with the name they are expected to have in the request.
For example:

#[RequestPropertyName('created_at')]
public Carbon $createdAt;

Request scaffolding

Override the default behaviour of

php artisan make:request

with a new stub for requests.

Rules may require injection into them

Maybe it should be possible to pass rules as class strings, which would imply that they should be instantiated by the container before application instead of being manually instantiated.

For example:

#[ValidateRule(CountyCodeRule::class)]

Make sure every type of rule can be implemented

Go through all types of available validation rules and make sure that they can be implemented with this library.

The rules() property should not have to be overridden for most application cases.

Mapper based conversion

Properties should be able to be decorated with explicit (custom) mappers.
For example:

#[RequestPropertyMapper(CarbonDateMapper::class)]
public Carbon $date;

Implicit mapping should also be migrated to mappers.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.