PHPackages                             fanqingxuan/jsonhelper - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. fanqingxuan/jsonhelper

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

fanqingxuan/jsonhelper
======================

v1.0.1(6y ago)03MITPHPPHP ^7.2.5

Since Apr 4Pushed 6y ago1 watchersCompare

[ Source](https://github.com/fanqingxuan/jsonhelper)[ Packagist](https://packagist.org/packages/fanqingxuan/jsonhelper)[ RSS](/packages/fanqingxuan-jsonhelper/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependencies (1)Versions (3)Used By (0)

laravel现在是php界红的发紫的框架, 之所以红必有其道理，但个人还是感觉laravel太重了，但是laravel里面还有有一些不错的组件或者功能想移植到其他非laravel项目中去，比如Eloquent ORM，网上已经有很多资源方法教我们独立使用，这里不做介绍。laravel中内置封装了集合类，供大家处理数组使用，相信大家已经都用过了，但没有找到相关资源将集合Collection类抽取出来，为此，花了点儿时间将laravel中的Collection集合类、数组Arr类、字符串Str类抽取出来，供大家参阅以及使用。

本项目抽取了Collection、Arr、Str**类**的95%+功能，其中有一小部分没有提取，比如字符串生成uuid、获取ASCII函数，不常用切依赖别的组件，抽取出来反而使项目不够轻量级了，因此砍掉了。

### 说明

[](#说明)

项目基于laravel最新版本7.x进行功能提取

### 环境要求

[](#环境要求)

**php7.2.5+**

### 安装

[](#安装)

```
composer require fanqingxuan/jsonhelper

```

### 基本用法

[](#基本用法)

```
require_once 'vendor/autoload.php';

use JsonHelper\Collection;
use JsonHelper\Arr;
use JsonHelper\Str;

//创建集合
$collection = collect([1, 2, 3]);
print_r($collection->all());

//Arr类
//Arr::get 方法使用「.」号从嵌套数组中获取值
$array = ['products' => ['desk' => ['price' => 100]]];
$price = Arr::get($array, 'products.desk.price');
var_dump($price);

//Str类
//Str::snake 方法将给定字符串转换为形如 snake_case 格式字符串
$converted = Str::snake('fooBar');
var_dump($converted);
```

### 相关函数

[](#相关函数)

本项目基本上抽取了laravel 7.x版本中Collection、Arr、Str类的所有方法，因此可以直接参考laravel 7.x手册中相关类的使用方法，可自行通过laravel官网或者其它途径查找，也可参考如下链接

[Collection函数](https://xueyuanjun.com/post/21513)

[Arr函数](https://xueyuanjun.com/post/21520#bkmrk-%E6%95%B0%E7%BB%84-%26-%E5%AF%B9%E8%B1%A1)

[Str函数](https://xueyuanjun.com/post/21520#bkmrk-%E5%AD%97%E7%AC%A6%E4%B8%B2%E5%87%BD%E6%95%B0)

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity52

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 ~0 days

Total

2

Last Release

2229d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/19618708?v=4)[Json](/maintainers/fanqingxuan)[@fanqingxuan](https://github.com/fanqingxuan)

### Embed Badge

![Health badge](/badges/fanqingxuan-jsonhelper/health.svg)

```
[![Health](https://phpackages.com/badges/fanqingxuan-jsonhelper/health.svg)](https://phpackages.com/packages/fanqingxuan-jsonhelper)
```

###  Alternatives

[symfony/maker-bundle

Symfony Maker helps you create empty commands, controllers, form classes, tests and more so you can forget about writing boilerplate code.

3.4k111.1M568](/packages/symfony-maker-bundle)[illuminate/support

The Illuminate Support package.

583107.1M34.5k](/packages/illuminate-support)[stoutlogic/acf-builder

An Advanced Custom Field Configuration Builder

8311.8M60](/packages/stoutlogic-acf-builder)[sculpin/sculpin

Static Site Generator

1.5k102.8k12](/packages/sculpin-sculpin)[kms/froala-editor-bundle

Provides a Froala editor integration for Symfony 4 &amp; 5.

110272.8k](/packages/kms-froala-editor-bundle)[wyrihaximus/react-child-process-messenger

Messenger decorator for react/child-process

32279.4k4](/packages/wyrihaximus-react-child-process-messenger)

PHPackages © 2026

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