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 | |
| dev |
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_statemethod. 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; } }
jpuck/phpdev 适用场景与选型建议
jpuck/phpdev 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 362 次下载、GitHub Stars 达 1, 最近一次更新时间为 2016 年 09 月 18 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 jpuck/phpdev 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 jpuck/phpdev 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 362
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 7
- 依赖项目数: 3
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-09-18