承接 maxalmonte14/phpcollections 相关项目开发

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

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

maxalmonte14/phpcollections

Composer 安装命令:

composer require maxalmonte14/phpcollections

包简介

A set of collections for PHP.

README 文档

README

StyleCI Scrutinizer Code Quality Build Status

About PHPCollections

PHPCollections is a set of data structures that try to make your life easier when you're working with PHP and large sets of data. Inspired by languages like Java or C#, PHPCollections offers data structures like List, Map, Stack and more, check it out!

Requirements

PHP >= 7.2

Installation

composer require "maxalmonte14/phpcollections"

Examples

Imagine you're storing Post objects for fetching like so.

$posts[] = new Post(1, 'PHP 7.2 release notes');
$posts[] = new Post(2, 'New Laravel 5.5 LTS make:factory command');

Everything is fine! But maybe you made a mistake for some mysterious reason and added a non-Post object.

$posts[] = 5 // This is not even an object!

When you'll try to fetch your posts array you'll be in troubles.

<?php foreach($posts as $post): ?>
    <tr>
        <!-- this gonna fail when $post == 5! -->
        <td><?= $post->id; ?></td>
        <td><?= $post->title; ?></td>
    </tr>
<?php endforeach ?>

Fortunately PHPCollections exists.

$posts = new GenericList(
    Post::class,
    new Post(1, 'PHP 7.2 release notes'),
    new Post(2, 'New Laravel 5.5 LTS make:factory command')
);
$posts->add(5); // An InvalidArgumentException is thrown!

Of course there exist more flexible data structures like ArrayList.

$posts = new ArrayList();
$posts->add(new Post(1, 'PHP 7.2 release notes'));
$posts->add(new Post(2, 'New Laravel 5.5 LTS make:factory command'));
$posts->add(5); // Everything is fine, I need this 5 anyway

Features

  • Different types of collections like Dictionary, Stack and GenericList.
  • Simple API.
  • Lightweight, no extra packages needed.

统计信息

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

GitHub 信息

  • Stars: 58
  • Watchers: 4
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-10-12

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固