定制 spekulatius/laravel-powertools 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

spekulatius/laravel-powertools

最新稳定版本:0.3.2

Composer 安装命令:

composer require spekulatius/laravel-powertools

包简介

A personal collection of Laravel Helpers, my powertools.

README 文档

README

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

This is a personal collection of handy helpers, tools, and utilities that I've used across various Laravel projects. However, please note that these are intended for personal use and development, so please use at your own risk.

Features

maskSensitiveData: Collection Makro to mask sensitive data

maskSensitiveData Laravel Collection macro and provides the functionality to mask sensitive data in a collection. The macro prepares masked fields regular expressions for use, and applies the mask to the sensitive data based on the regexes and custom fields. It maps over the collection and replaces any data matching the regular expressions with a mask value of [masked]. This functionality is useful when dealing with collections of sensitive data and is designed to keep the sensitive data secure.

Usage:

collect(['password' => 'this really should not be logged...'])
  ->maskSensitiveData()
  ->toArray();

// 'password' => '[masked]'

ToLog: Model Trait to log context

The ToLog trait is a simple trait to add to models that allows you to summarize model data as logging context. It's essentially a slimmed-down version of the ->toArray() method, and it's meant to be used in a similar approach similar to \Log::error('....', $entry->toLog());. Already runs maskSensitiveData by design.

SelfDeletingTemporaryDirectory

An extension of Spaties TemporaryDirectory to delete itself after 120 minutes (configurable).

use Spekulatius\LaravelPowertools\Helpers\SelfDeletingTemporaryDirectory;

// ...

$tempDir = new SelfDeletingTemporaryDirectory;

// use like TemporaryDirectory from Spatie.

My common way to use this:

$tempFile = (new SelfDeletingTemporaryDirectory)->create()->path('temp.zip');

Compatibility

This project has been tested on Laravel 10 using PHP 8.1 or 8.2. It should work on Laravel 9 as well, although it has not been tested on that version.

Installation

You can install the package via composer:

composer require spekulatius/laravel-powertools

You can publish the config file with:

php artisan vendor:publish --tag="laravel-powertools-config"

Testing

The project is roughly tested on Laravel 10.

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

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

统计信息

  • 总下载量: 1.09k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 3
  • 点击次数: 3
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 3
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-04-05