Download the PHP package fourfortymedia/eloquent-model-guard without Composer

On this page you can find all versions of the php package fourfortymedia/eloquent-model-guard. 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 eloquent-model-guard

Eloquent Model Guard - Readme

Welcome to the readme for the eloquent-model-guard Laravel package. This package brings an array of enhancements to data validation for Eloquent models, providing developers with improved control over data integrity and validation rules. Let's dive into the details of this package.

Attributes

The eloquent-model-guard package introduces the ability to add structured and machine-readable metadata information to declarations. This enhances the control over data validation, particularly within Eloquent models, and allows for finer customization of validation rules based on specific scenarios.

Background

Database fields are characterized by types that define the nature of data they can store. These types ensure data integrity and consistency by enforcing validation rules. Typically, these setups are performed within migrations. Different data types represent various kinds of data such as numbers, strings, and dates. By indicating the type of a field, the database can validate and enforce rules to ensure only valid data is stored. This not only prevents errors but also enhances query performance and data accuracy.

While migrations establish data integrity upon storage, they are executed only once. The eloquent-model-guard package empowers users to update and adapt validation rules within the model. This offers a significant advantage in responding to changing application requirements. Developers can now effortlessly customize validation rules based on evolving business needs without altering the database structure. This dynamic and agile approach enhances the efficiency and adaptability of validation, resulting in a more robust and responsive application.

Added Features

The eloquent-model-guard package comes with several notable additions:

Changes

The following changes have been made to improve validation in Eloquent models:

Context

The enhancements brought by the eloquent-model-guard package greatly enhance data validation for Eloquent models. The introduction of OnCreateRules and OnUpdateRules attributes allows developers to craft specific validation rules for model creation and updates, respectively. This granularity in validation empowers developers to fine-tune validation for individual models, properties, or attributes, promoting cleaner code organization and more efficient validation logic.

Installation

In your eloquent model, add the following

Examples

Let's explore some usage examples to demonstrate how to take advantage of the new attributes:

  1. Validation on Creation:

  2. Validation on Update:

  3. Combining Both Attributes:

  4. Using on Model Fields: Note: When using this on the model attributes, use either private or protected on those attributes so that they don't interfere with your attributes

    please note that when using it on a sigle property, you may pass and accosiative array with a key that is the same as the property with the value as the rules or pass rules as array or keys

  5. Custom Rules with Validation:

  6. Automatic Validation on Creation and Updating:

Note

Please note that this pull request is a work in progress and is being submitted for initial review and feedback. Further improvements and adjustments will be made based on the feedback received.

Remember that the package's features only take effect when the attributes are applied to the model or properties. This package does not enforce any developer to use it, offering flexibility while providing powerful validation capabilities.

For any inquiries or feedback, feel free to contact Mr. Rikhotso, the creator of this package. Your thoughts and suggestions are highly valued.


All versions of eloquent-model-guard with dependencies

PHP Build Version
Package Version
Requires php Version >=8.0
laravel/framework Version >=8.0
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 fourfortymedia/eloquent-model-guard contains the following files

Loading the files please wait ...