承接 lsmj/phrint 相关项目开发

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

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

lsmj/phrint

Composer 安装命令:

composer require lsmj/phrint

包简介

PHP state testing functions

关键字:

README 文档

README

Simple and visual state testing for PHP programming. Works well when checking if data is returned by a method and/or quickly figuring out the data type. The p method is particularily useful for temporarily displaying data on an html page. This is especially effective in combination with hot reloading, so you can work on your method while seeing the returned result update everytime you save. The c (console) method is useful for printing out data in a console during testing.

phrint_array

Table of Contents

Installation

Install with Composer

composer require lsmj/phrint --dev

Uninstall:

composer remove lsmj/phrint --dev

Usage

Auto-load and import class

Require Composer's autoload.php if you're not using a framework that already takes care of this, like Laravel. Import the class with use lsmj\phrint.

index.php:

<?php

require_once('vendor/autoload.php');

use lsmj\phrint;

or in public/index.php:

<?php

require_once('../vendor/autoload.php');

use lsmj\phrint;

Methods

p (print)

Prints the input type and data on a clutter free bleached yellow background. Especially useful when tracking state types or data. Objects are JSON encoded.

p(mixed $input)

Code example:

$arr = [1, 2, 3];
phrint::p($arr);

Result:

Type: array
Array
(
    [0] => 1
    [1] => 2
    [2] => 3
)

c (console)

Prints the input type and content without formatting. Useful when printing messages in a console.

c(mixed $input)

m (message)

Prints the input data on a clutter free bleached yellow background. Useful when printing messages that needs to be easy to find visually.

m(string|int $input)

l (list)

Explodes and prints a comma-seperated string as a vertical list on a bleached yellow background. This is useful for viewing or counting elements (like in a CSV heading), creating a new array from the list, manipulating the element names or copying and pasting the resulting list into a spreadsheet.

l(string $input, [string $delimiter = "'"], [string $remove_string = null])

Code example:

$str = 'a,b,c';
phrint::l($str);

Result:

1
2
3

The default delimiter is , but a different one can be passed as the second argument. The third argument is an optional regex function that replaces the given input string with an empty string.

Code example:

$str = 'col-a.col-b.col-c';
phrint::l($str, '.', 'col-');

Result:

a
b
c

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-06-18

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固