Download the PHP package thvvger/symfony-request-validator without Composer
On this page you can find all versions of the php package thvvger/symfony-request-validator. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download thvvger/symfony-request-validator
More information about thvvger/symfony-request-validator
Files in thvvger/symfony-request-validator
Package symfony-request-validator
Short Description Validate symfony request and return JSON response
License MIT
Informations about the package symfony-request-validator
Table of Contents
-
About The Project
- Built With
-
Getting Started
- Prerequisites
- Installation
- Usage
- Roadmap
- Contributing
- License
- Contact
- Acknowledgments
Symfony Request Validator
RequestValidator is a Symfony bundle that simplifies the process of validating request data and generating request classes with validation rules. It integrates with Symfony's Validator component and provides an easy way to generate request classes with built-in validation constraints.
(back to top)
Getting Started
This is an example of how you may give instructions on setting up your project locally. To get a local copy up and running follow these simple example steps.
Installation
-
Install the package
-
Configure the Services : After installing the bundle, you need to register the services for the
FileGeneratorandGenerateClassCommand.Add the following configuration to your
config/services.yaml:- The
FileGeneratorservice is configured withautowireandautoconfigureto automatically inject dependencies. - The
GenerateClassCommandis registered as a console command, allowing you to execute it from the command line usingphp bin/console generate:class.
- The
-
(back to top)
Configuration
Ensure that the bundle is registered in `config/bundles.php:
(back to top)
Usage
Generate a Request Class
To generate a request class, use the following command:
This will generate a PHP file in the src/Request/ directory with a base structure for your request class.
Example Generated Class
Here’s an example of a class generated after running the command:
Example Usage in Your Controller
After generating the TestRequest class with the relevant validation logic, you can use it within a controller to handle incoming requests, perform validation, and execute any necessary logic (such as file generation).
If validation fails (e.g., missing or invalid file), a response like the following will be returned:
(back to top)
Contributing
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature) - Commit your Changes (
git commit -m 'Add some AmazingFeature') - Push to the Branch (
git push origin feature/AmazingFeature) - Open a Pull Request
(back to top)
License
Distributed under the MIT License. See LICENSE.txt for more information.
(back to top)
Contact
Larry-Bill ADJE - @twitter_handle - [email protected]
(back to top)
Acknowledgments
- [Orphé Bobby]()
- [Massoud FATAOU]()
(back to top)
All versions of symfony-request-validator with dependencies
symfony/validator Version >=6.0
symfony/http-foundation Version >=6.0
symfony/framework-bundle Version >=6.1
symfony/console Version >=6.1