Download the PHP package langleyfoxall/laravel-redacted-model without Composer

On this page you can find all versions of the php package langleyfoxall/laravel-redacted-model. 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-redacted-model

Laravel Redacted Model

Packagist

Laravel Redacted Model makes it easier to hide or modify fields on a model based on given conditions in order to reduce data leakage in Laravel applications.

Installation

Laravel Redacted Model can be installed using composer. Run the following command in your project.

If you have never used the Composer dependency manager before, head to the Composer website for more information on how to get started.

Usage

To redact fields simply extend RedactedModel in your model and set the redacted variable to an array of the fields you want to protect. By default when accesed these fields will return [Hidden Data].

Conditionally redacting data

To conditionally redact fields override shouldRedactField on your model. The name of the field will be passed into this method. This will return true by default until you override it.

Note: Only fields specified in $redacted will be redacted regardless of what's returned from this method.

Changing the default redacted string

To change the message returned you can set the redactedString on your model. This will then be returned instead of [Hidden Data].

Hiding fields instead of redacting them

If you want to completely omit the field instead of redacting it you can set the redact variable on your model to false.

Note: If redactKeys is set to true, when the model is serialised the keys of redacted fields will also be omitted.

By default the array key of fields that return null and are in the redacted fields list will too be omitted in case the field name is Sensitive. To disable this set $redactKeys to false on your model.

Redacted value accessors

Accesors can be used to define the value of specific fields if they're redacted. Redacted value accessors are defined the same way as Laravel Accessors but ending in RedactedValue instead of Accessor.

The original value is passed into the method, this allows you to abstract the value instead of omitting or redacting it.

For example if instead of returning the name from the model you want to only return the first and last letter:

Overriding the default redacted value

By default redacted values will be returned as [Hidden Value] or null depending on the value of $redacted. You can bypass this by overriding defaultRedactedValue on the model.

This is useful if you want to derive the redacted value from the original value, as the field name and original value are passed into it. For example if you want to replace all characters with stars:

Enabling and disabling protection

If you want to temporarily disable field redaction or omission you can call disableProtection() on the model to disable protection and enableProtection() to re-enable it. This has to be used on a per-instance basis.

Changing the redacted fields

If you want to change or add to the redacted fields of a model after it has been instantiated you can call the setRedacted method on the model.

If you call it with an array as the parameter the redacted variable will be overridden but anything else will be appended to the existing array.


All versions of laravel-redacted-model with dependencies

PHP Build Version
Package Version
Requires php Version ^7.0.0
illuminate/support Version >=5.0
illuminate/database Version >=5.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 langleyfoxall/laravel-redacted-model contains the following files

Loading the files please wait ....