定制 jpuck/phpdev 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

jpuck/phpdev

Composer 安装命令:

composer require jpuck/phpdev

包简介

A collection of classes useful for code under construction.

README 文档

README

A collection of PHP 7 classes useful for code under construction.

Branch Status
master Build Status
dev Build Status

Getting Started

This library is registered on packagist, so you can easily include it in your project using composer.

composer require jpuck/phpdev

Don't forget to require the autoloader in your script.

<?php
require_once 'vendor/autoload.php';

Functions

bool strbegins(String $haystack, String $needle)

Checks whether a string begins with a string.

$haystack = 'test';
$needle   = 'te';
if(Functions::strbegins($haystack, $needle)){
	echo "$haystack begins with $needle";
}

mixed print_rt ( mixed $expression [, bool $return = false ] )

Tabulator wrapper for print_r replaces 8 spaces with a tab.

use jpuck\phpdev\Functions as jp;

$array = [
	'first' =>
	[
		'second' =>
		[
			'third' =>
			[
				'forth' =>
				[
					'fifth' => 5
				]
			]
		]
	]
];

print_r($array);

jp::print_rt($array);

Example displayed on console with tabs set to 4 spaces:

Array
(
    [first] => Array
        (
            [second] => Array
                (
                    [third] => Array
                        (
                            [forth] => Array
                                (
                                    [fifth] => 5
                                )

                        )

                )

        )

)
Array
(
    [first] => Array
    (
        [second] => Array
        (
            [third] => Array
            (
                [forth] => Array
                (
                    [fifth] => 5
                )

            )

        )

    )

)

mixed arr_export ( array $array [, bool $return = false ] )

Format arrays using var_export with tabs, square brackets, and no trailing spaces after arrows to newlines.

use jpuck\phpdev\Functions as jp;

$array = [
	'first' =>
	[
		'second' =>
		[
			'third' =>
			[
				'forth' =>
				[
					'fifth' => 5
				]
			]
		]
	]
];

var_export($array);

jp::arr_export($array);

Example displayed on console with tabs set to 4 spaces:

array (
  'first' => 
  array (
    'second' => 
    array (
      'third' => 
      array (
        'forth' => 
        array (
          'fifth' => 5,
        ),
      ),
    ),
  ),
)

[
    'first' =>
    [
        'second' =>
        [
            'third' =>
            [
                'forth' =>
                [
                    'fifth' => 5,
                ],
            ],
        ],
    ],
]

NOTICE: The documentation on using this function with objects is clear.

Note: To be able to evaluate the PHP generated by var_export(), all processed objects must implement the magic __set_state method. Note that StdClass does not implement __set_state().

$function = function(){};

$a = [
	'object' => new stdClass,
	'function' => $function,
];

$b = var_export($a, true);

eval("print_r($b);");

The above code will result in the following errors:

PHP Fatal error: Uncaught Error: Call to undefined method stdClass::__set_state()

PHP Fatal error: Uncaught Error: Call to undefined method Closure::__set_state()

null CleanMsSQLdb (PDO $pdo)

This is a dangerously powerful script for dropping everything from a Microsoft SQL Server database dbo schema.

  • non-system stored procs
  • views
  • functions
  • tables (regardless of Primary/Foreign Key constraints)

Exceptions

Unimplemented Method

use jpuck\phpdev\Exceptions\Unimplemented;

class MyClass {
	public function foo() {
		// completed code
		return true;
	}

	/**
	 * @throws Unimplemented
	 */
	public function bar() {
		// work in progress

		throw new Unimplemented(__METHOD__);

		return true;
	}
}

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-09-18

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固