定制 pentacore/laravel-utils 二次开发

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

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

pentacore/laravel-utils

最新稳定版本:v1.0.3

Composer 安装命令:

composer require pentacore/laravel-utils

包简介

A collection of commonly used Laravel utilities, traits, and helpers.

README 文档

README

A collection of commonly used Laravel utilities, traits, and helpers.

Requirements

  • PHP ^8.3
  • Laravel ^11.0 || ^12.0 || ^13.0

Installation

composer require pentacore/laravel-utils

The service provider is auto-discovered.

Utilities

EnumUtils trait

Adds a set of helpers to any backed enum.

use Pentacore\LaravelUtils\Concerns\EnumUtils;

enum Status: string
{
    use EnumUtils;

    case Active = 'active';
    case Pending = 'pending';
    case Archived = 'archived';
}
Method Description
Status::names() Array of case names.
Status::values() Array of backing values.
Status::array() Associative array [value => name].
Status::validationRule() Rule::in(values) for use in form requests / validators.
Status::iterator() Generator keyed by case name.
Status::mapForSelect($withNull, $labelKey) Sorted [label, value] list for select dropdowns.
Status::commaSeparatedValues() Comma-separated string of values.
$case->asSlug() URL-friendly slug of the value.
$case->toString() Value cast to string.
$case->equals($value) Strict comparison of value.

If a case implements a label() method, mapForSelect() will use it instead of the case name.

Testing

composer test

License

MIT

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-05-07

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固