cmfcmf/column-width-calculator 问题修复 & 功能扩展

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

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

cmfcmf/column-width-calculator

Composer 安装命令:

composer require cmfcmf/column-width-calculator

包简介

Calculate "perfect" table column widths in PHP.

README 文档

README

Calculate "perfect" table column widths in PHP, based on my question at StackOverflow and @watcher's answer.

How to use

$rows needs to be an array of rows. Each $row needs to be an array of cells. Each $cell needs to have the cell's content in it.

<?php
/**
 * @param array $rows An array of rows, where each row is an array of cells containing the cell content.
 * @param bool  $html Whether or not the rows contain html content. This will call html_entity_decode.
 * @param bool  $stripTags Whether or not to strip tags (only if $html is true).
 * @param int   $minPercentage The minimum percentage each row must be wide.
 * @param null  $customColumnFunction A custom function to transform a cell's value before it's length is measured.
 */
$columnWidthCalculator = new Cmfcmf\ColumnWidthCalculator($rows);
/**
 * Calculate the column widths.
 *
 * @return array
 *
 * Explanation of return array:
 * - $columnSizes[$colNumber]['percentage'] The calculated column width in percents.
 * - $columnSizes[$colNumber]['calc'] The calculated column width in letters.
 *
 * - $columnSizes[$colNumber]['max'] The maximum column width in letters.
 * - $columnSizes[$colNumber]['avg'] The average column width in letters.
 * - $columnSizes[$colNumber]['raw'] An array of all the column widths of this column in letters.
 * - $columnSizes[$colNumber]['stdd'] The calculated standard deviation in letters.
 *
 * INTERNAL
 * - $columnSizes[$colNumber]['cv'] The calculated standard deviation / the average column width in letters.
 * - $columnSizes[$colNumber]['stdd/max'] The calculated standard deviation / the maximum column width in letters.
 */
$columnSizes = $columnWidthCalculator->calculateWidths();

License

GPLv2, see the LICENSE file.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: GPLv2
  • 更新时间: 2014-06-25

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固