phpfn/placeholder
Composer 安装命令:
composer require phpfn/placeholder
包简介
Simple placeholder implementation for functional constructions
README 文档
README
Library provides a placeholder implementation for currying functions, partial applications, pipe operator, and other syntactic structures hat allow specifying default values.
Installation
Library can be installed into any PHP application:
$ composer require phpfn/placeholder
In order to access library make sure to include vendor/autoload.php
in your file.
<?php require __DIR__ . '/vendor/autoload.php';
Usage
What is "placeholder"?
<?php var_dump(is_placeholder('_')); // expected output: false var_dump(is_placeholder(_)); // expected output: true
For example we can replace each of the placeholders in the array with the required value.
<?php use Fun\Placeholder\Placeholder; $array = [1, _, 3, _]; $result = Placeholder::map($array, fn() => ' map '); echo implode(', ', $result); // expected output: "1, map, 3, map"
And... Thats all =)
统计信息
- 总下载量: 68
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 0
- 依赖项目数: 2
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-08-08