Download the PHP package mtownsend/array-redactor without Composer

On this page you can find all versions of the php package mtownsend/array-redactor. 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 array-redactor

A PHP package to redact an array's values by their keys no matter how deep the array.

Why?

Have you ever built or interacted with an api and needed to log all outgoing and incoming calls? Chances are that somewhere in that process is an authentication, either by an app or on behalf of a user. Logs are useful for debugging, but storing sensitive information such as passwords or api keys is not something you want to have in your logs for anyone to see. The usage goes beyond just this example, but that is what prompted me to create the ArrayRedactor package.

Whatever your usage needs may be, this package aims to provide a dead-simple, lightweight way to censor sensitive information in an array no matter how deeply it is nested.

Installation

Install via composer:

This package is designed to work with any PHP 5.6+ application but has special Facade support for Laravel.

Registering the service provider (Laravel users)

For Laravel 5.4 and lower, add the following line to your config/app.php:

For Laravel 5.5 and greater, the package will auto register the provider for you.

Using Lumen

To register the service provider, add the following line to app/bootstrap/app.php:

Publishing the config file (Laravel users)

`

Once your arrayredactor.php has been published to your config folder, you will see a file with 2 keys in it: keys and ink. You can replace these values with anything you want, but please note: these values will only be applied when using the Laravel Facade.

Quick start

Using the class

Advanced usage

Array Redactor can also receive valid json instead of an array of content.

You can also receive your content back as json instead of an array.

You can change the redaction value (default: [REDACTED]), known as the ink, by passing it as the third argument of the constructor, or using the dedicated ->ink() method.

You can call the ArrayRedactor as a function and the magic __invoke() method will call the redact method for you.

Lastly, you can skip the constructor arguments entirely if you prefer.

Using the global helper

This package provides a convenient helper function which is globally accessible.

Using the facade (Laravel users)

If you are using Laravel, this package provides a facade. To register the facade add the following line to your config/app.php under the aliases key.

Please note: this is the only method for Laravel users that will prefill your keys and ink from your arrayredactor.php config file. The global helper and direct instantiation of the class will not prefill these values for you.

``

Error handling

In the event you pass content that is not valid json or an array, an ArrayRedactorException will be thrown.

Credits

Testing

You can run the tests with:

License

The MIT License (MIT). Please see License File for more information.


All versions of array-redactor with dependencies

PHP Build Version
Package Version
Requires php Version >=5.6
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 mtownsend/array-redactor contains the following files

Loading the files please wait ....