PHPackages                             felo-z/laravel-helper - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Caching](/categories/caching)
4. /
5. felo-z/laravel-helper

ActiveLibrary[Caching](/categories/caching)

felo-z/laravel-helper
=====================

Laravel helper

v1.1.0(1mo ago)07MITPHPPHP ^8.4

Since Jan 25Pushed 1mo agoCompare

[ Source](https://github.com/Felo-Z/laravel-helper)[ Packagist](https://packagist.org/packages/felo-z/laravel-helper)[ Docs](https://github.com/Felo-Z/laravel-helper)[ GitHub Sponsors](https://github.com/Felo-Z)[ RSS](/packages/felo-z-laravel-helper/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (14)Versions (3)Used By (0)

Laravel Helper
==============

[](#laravel-helper)

Laravel 辅助工具包，提供日志清理和缓存清理功能。

要求
--

[](#要求)

- PHP &gt;= 8.2
- Laravel `^12.0|^13.0`

安装
--

[](#安装)

```
composer require felo-z/laravel-helper -vvv
```

### 发布配置文件

[](#发布配置文件)

你可以将配置文件发布到项目的 `config/` 目录：

```
php artisan vendor:publish --provider="FeloZ\LaravelHelper\HelperServiceProvider"
```

使用
--

[](#使用)

### 辅助函数

[](#辅助函数)

#### 清理日志文件

[](#清理日志文件)

```
clear_logs();
```

此函数会根据配置清理指定目录下的日志文件。

#### 清理缓存

[](#清理缓存)

```
clear_cache();
```

此函数会清理 Laravel 缓存和 Redis 缓存。

### Artisan 命令

[](#artisan-命令)

#### 清理日志文件

[](#清理日志文件-1)

```
php artisan felo:clear-logs
```

#### 清理缓存

[](#清理缓存-1)

```
php artisan felo:clear-cache
```

### 配置说明

[](#配置说明)

发布配置文件后，可以在 `config/felo-helper.php` 中进行配置：

```
return [
    'clear_logs' => [
        // 日志文件目录，支持多个目录，逗号分隔或数组形式
        'directories' => env('FELO_HELPER_LOG_DIRECTORIES', [storage_path('logs')]),
        // 需要清理的日志文件扩展名，支持多个扩展名，逗号分隔或数组形式
        'extensions' => env('FELO_HELPER_LOG_EXTENSIONS', 'log,json'),
        // 排除的文件名，不会被删除的文件，逗号分隔或数组形式
        'exclude' => env('FELO_HELPER_LOG_EXCLUDE', 'laravel.log'),
    ],
    'clear_cache' => [
        // 是否清理 Laravel 缓存
        'clear_laravel_cache' => env('FELO_HELPER_CLEAR_LARAVEL_CACHE', true),
        // Redis 连接名称，支持多个连接，逗号分隔或数组形式
        'redis_connections' => env('FELO_HELPER_REDIS_CONNECTIONS', 'default'),
    ],
];
```

### 环境变量

[](#环境变量)

你也可以通过环境变量进行配置：

```
# 日志清理配置
FELO_HELPER_LOG_DIRECTORIES=/path/to/logs1,/path/to/logs2
FELO_HELPER_LOG_EXTENSIONS=log,json,txt
FELO_HELPER_LOG_EXCLUDE=laravel.log,important.log

# 缓存清理配置
FELO_HELPER_CLEAR_LARAVEL_CACHE=true
FELO_HELPER_REDIS_CONNECTIONS=default,cache
```

开发
--

[](#开发)

### 代码检查

[](#代码检查)

项目使用以下工具来保证代码质量：

#### Laravel Pint - 代码格式化

[](#laravel-pint---代码格式化)

```
# 检查代码风格（不修改文件）
composer run check-style

# 自动修复代码风格问题
composer run fix-style
```

#### PHPStan - 静态分析

[](#phpstan---静态分析)

```
# 运行 PHPStan 静态分析
composer run phpstan
```

PHPStan 配置文件位于项目根目录的 `phpstan.neon`，分析级别为 5。

#### PHPUnit - 单元测试

[](#phpunit---单元测试)

```
# 运行所有测试
composer run test
```

### 提交代码前检查

[](#提交代码前检查)

在提交代码前，建议运行以下命令：

```
# 1. 代码格式化
composer run fix-style

# 2. 静态分析
composer run phpstan

# 3. 运行测试
composer run test
```

贡献
--

[](#贡献)

欢迎贡献代码！你可以通过以下方式参与：

1. 在 [问题追踪器](https://github.com/felo-z/laravel-helper/issues) 上报告 Bug
2. 在 [问题追踪器](https://github.com/felo-z/laravel-helper/issues) 上回答问题或修复 Bug
3. 贡献新功能或更新文档

*代码贡献过程不需要太正式。你只需要确保遵循 PSR-0、PSR-1 和 PSR-2 编码规范。任何新的代码贡献都必须附带相应的单元测试。*

License
-------

[](#license)

MIT

###  Health Score

40

—

FairBetter than 88% of packages

Maintenance90

Actively maintained with recent releases

Popularity5

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~56 days

Total

2

Last Release

51d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/a8df410a9fd3a23313e76c190cc6bcfffd359f9a78534e415158bbc08a826c2e?d=identicon)[Felo-Z](/maintainers/Felo-Z)

---

Tags

laravelhelperartisanlogscache

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/felo-z-laravel-helper/health.svg)

```
[![Health](https://phpackages.com/badges/felo-z-laravel-helper/health.svg)](https://phpackages.com/packages/felo-z-laravel-helper)
```

###  Alternatives

[swayok/alternative-laravel-cache

Replacements for Laravel's redis and file cache stores that properly implement tagging idea. Powered by cache pool implementations provided by http://www.php-cache.com/

202541.1k6](/packages/swayok-alternative-laravel-cache)[dragon-code/laravel-cache

An improved interface for working with cache

6844.8k10](/packages/dragon-code-laravel-cache)[arifhp86/laravel-clear-expired-cache-file

Remove laravel expired cache file/folder

36128.7k](/packages/arifhp86-laravel-clear-expired-cache-file)[byerikas/cache-tags

Allows for Redis/Valkey cache flushing multiple tagged items by a single tag.

1413.9k](/packages/byerikas-cache-tags)[salehhashemi/laravel-configurable-cache

Configurable Laravel cache manager

2114.5k1](/packages/salehhashemi-laravel-configurable-cache)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
