承接 clairedv/laravel-array-helpers 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

clairedv/laravel-array-helpers

最新稳定版本:1.0

Composer 安装命令:

composer require clairedv/laravel-array-helpers

包简介

Some static helpers for querying and transforming php arrays

README 文档

README

A set of static helper methods to check and transform array data.

Installation

Require this package with composer composer install ...

This package has been tested with Laravel 10

Methods

All of the methods in the class are static, just as Laravels own array helper methods are. As this class extends Laravels Arr helper class, you can use the ArrayHelper in place of the Arr class .

sharesAnyValues()

use ClaireDv\LaravelArrayHelpers\ArrayHelper;

$array1 = [1, 2, 3];
$array2 = [3, 4, 5];

ArrayHelper::sharesAnyValues(
    $array1, $array2); // returns true

hasOnlyValue()

use ClaireDv\LaravelArrayHelpers\ArrayHelper;

$array1 = ['claire'];

ArrayHelper::hasOnlyValue(
    'claire', $array2); // returns true

isMulti()

use ClaireDv\LaravelArrayHelpers\ArrayHelper;

$array1 = ['one' => ['two']];

ArrayHelper::isMulti($array1); // returns true

arrayToString()

use ClaireDv\LaravelArrayHelpers\ArrayHelper;

    $arrayToConvert = [
        'name' =>  'claire',
        'games' => [
            'discworld, 'broken age'
    ]]

$string  = ArrayHelper::arrayToString($array1);

// 'name: claire, games: discworld, broken age'

replaceBracesWithValues()

use ClaireDv\LaravelArrayHelpers\ArrayHelper;

$stringWithBraces = 'Dear {firstName}, Your order number is {orderNumber}';

$arrayWithValues = ['firstName' => 'Claire', 'orderNumber' => 'AB-1234'];

$string  = ArrayHelper::replaceBracesWithValues($array1);

// 'Dear Claire, Your order number is AB-1234'

Tests

Includes PHPUnit test suite.

To run the tests from the root of the project in the terminal: ./vendor/bin/phpunit

统计信息

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

GitHub 信息

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

其他信息

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

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固