ngomafortuna/list-formatter 问题修复 & 功能扩展

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

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

ngomafortuna/list-formatter

最新稳定版本:v0.0.1

Composer 安装命令:

composer require ngomafortuna/list-formatter

包简介

Formatter from composite datas to string list. This library accepts lists in array or database format and converts them into strings where each item is separated by commas. This library also sorts a composite list (array/object) in ascending and descending order. (Formatador de dados compostos para

README 文档

README

Formatter from composite datas to string list. This library accepts lists in array or database format and converts them into strings where each item is separated by commas. This library also sorts a composite list (array/object) in ascending and descending order. (Formatador de dados compostos para string. Esta biblioteca recebe listas em formato de array ou base de dados e converte string em onde cada item é separado por vígulas. Esta biblioteca também ordena uma lista composta (array/object) de forma crescente e decrescente.)

This component have two features:

  • InLine: to formatter array or object list in string in line or list of hiperlink (para formatar lista de array or object em string en linha ou hiperlinks)
  • Order: to order array or object list, for two options: (Para ordenar elementos de uma lista)
    • get: return list in asc order (retorna uma lista em ordem crescente)
    • rGet: return list in desc order (retorna uma lista em ordem decrescente)

Require

Necessary PHP 8.0 or more (Necessário PHP 8.0 ou superior)

Install

composer require ngomafortuna/list-formatter

Syntax and mode of use

$list = InLine::get($notices, ['title']);
$list1 = InLine::get($notices, ['title', 'slug'], 'https://www.minharosa.ao');

$order = Order::get($arrayLIst, 'title');
$order1 = Order::rGet($arrayLIst, 'title');

Example

use Ngomafortuna\ListFormatter\InLine;
use Ngomafortuna\ListFormatter\Order;

$arrayLIst = [
    ['title' => 'Vestimentas', 'date' => '2024-06-06', 'image' => 'photo1.jpg'],
    ['title' => 'Cultura','date' => '2025-06-06','image' => 'photo3.jpg'],
    ['title' => 'Socieda','date' => '2024-76-06','image' => 'photo2.jpg']
];

// TRANSFORM ARRAY OR OBJECT LIST IN LINE (STRING)
$list = InLine::get($arrayLIst, ['title']);
$list1 = InLine::get($arrayLIst, ['title', 'slug'], 'https://www.minharosa.ao');

// ORDER ARRAY OR OBJECT
$order = Order::get($arrayLIst, 'title');
$order1 = Order::rGet($arrayLIst, 'title');

var_dump($list, $list1);

var_dump($order, $order1);

Results

string(102) "Caála, História, Economia Infraestrutura e Esportes, Divisão administrativa do Município da Caála"

string(340) "<a href='https://www.minharosa.aocaala'>Caála</a>, <a href='https://www.minharosa.aohistoria'>História</a>, <a href='https://www.minharosa.aoeconomia-e-infraestrutura'>Economia Infraestrutura e Esportes</a>, <a href='https://www.minharosa.aodivisao-administrativa-do-municipio-da-caala'>Divisão administrativa do Município da Caála</a>"


object(stdClass)#7 (3) {
  ["0"]=>
  object(stdClass)#5 (3) {
    ["title"]=>
    string(7) "Cultura"
    ["date"]=>
    string(10) "2025-06-06"
    ["image"]=>
    string(10) "photo3.jpg"
  }
  ["1"]=>
  object(stdClass)#6 (3) {
    ["title"]=>
    string(7) "Socieda"
    ["date"]=>
    string(10) "2024-76-06"
    ["image"]=>
    string(10) "photo2.jpg"
  }
  ["2"]=>
  object(stdClass)#2 (3) {
    ["title"]=>
    string(11) "Vestimentas"
    ["date"]=>
    string(10) "2024-06-06"
    ["image"]=>
    string(10) "photo1.jpg"
  }
}

object(stdClass)#11 (3) {
  ["0"]=>
  object(stdClass)#8 (3) {
    ["title"]=>
    string(11) "Vestimentas"
    ["date"]=>
    string(10) "2024-06-06"
    ["image"]=>
    string(10) "photo1.jpg"
  }
  ["1"]=>
  object(stdClass)#10 (3) {
    ["title"]=>
    string(7) "Socieda"
    ["date"]=>
    string(10) "2024-76-06"
    ["image"]=>
    string(10) "photo2.jpg"
  }
  ["2"]=>
  object(stdClass)#9 (3) {
    ["title"]=>
    string(7) "Cultura"
    ["date"]=>
    string(10) "2025-06-06"
    ["image"]=>
    string(10) "photo3.jpg"
  }
}

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2025-06-08