spatie/piper 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

spatie/piper

最新稳定版本:1.0.0

Composer 安装命令:

composer require spatie/piper

包简介

A pipe operator-first PHP utility library for array and string manipulation

README 文档

README

Logo for scotty

Pipe operator-first utility library

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

Piper is a pipe operator-first PHP utility library for array and string manipulation. It ports Laravel's collection and string utility methods to standalone functions.

It comes with array helpers:

use function Spatie\Piper\Arr\{filter, map};

$popular = $posts
    |> filter(fn (Post $post) => $post->views > 1000)
    |> map(fn (Post $post) => $post->title);

// ["Claude Talk Small. Code Still Big.", …]

And string helpers:

use function Spatie\Piper\Str\{lower, replace};

'Hello, world!'
    |> lower()
    |> replace('world', 'Piper');

// "hello, Piper!"

Since all functions work with primitives, you can mix and match:

use function Spatie\Piper\Arr\{filter, join, map, values};
use function Spatie\Piper\Str\{prefix, suffix};

[1, 2, 3, 4, 5, 6]
    |> filter(fn (int $i) => $i % 2 === 0)
    |> map(fn (int $i) => pow($i, 2))
    |> values()
    |> join(', ', ', and ')
    |> prefix('The winning numbers are ')
    |> suffix('.');

// "The winning numbers are 4, 16, and 36."

Installation

You can install the package via composer:

composer require spatie/piper

Documentation

All documentation is available on our documentation site.

Support us

We invest a lot of resources into creating best in class open source packages.

You can support us by buying one of our paid products.

We highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using. You'll find our address on our contact page. We publish all received postcards on our virtual postcard wall.

Testing

You can run the tests with:

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

Piper is a port of Laravel's collection & string helpers. All methods, tests, and documentation examples are derived from the Laravel source. The porting strategy is described in PORT.md.

License

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

统计信息

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

GitHub 信息

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

其他信息

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

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固