承接 jjin/helpers 相关项目开发

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

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

jjin/helpers

Composer 安装命令:

composer require jjin/helpers

包简介

A simple collection of helper functions file for day-to-day tasks PHP web developers

关键字:

README 文档

README

Latest Stable Version Total Downloads Latest Unstable Version License

String Helpers

randomString($limit)

  • generate a random string

eg randomString(10) //asdgRttasE

randomProductOrderNumber($limit)

  • generate a random string,(same as randomString, except returns capitalized output)

eg randomProductOrderNumber(5) //F5CGIJ

trimText(string $text, int $maxLength, $trimIndicator = '...')

  • Trim text at particular length, usable at readmore texts

trimText($text, 10, '...')

splitName()

Split name string into first_name middle_name last_name

splitName("jhon abraham") // return array "first_name","last_name","middle_name"

generateEmailAddress()

Generate a dummy email address

generateEmailAddress(3,5) // abc@jijin.com

Array Helpers

nullRemove($array)

  • Remove null values from array

nullRemove(array $array = [])

checkIsArrayValueEmpty($array)

  • check any value empty in associate array

  • returns boolean

checkIsArrayValueEmpty($array) //retrun true/false

arrayOrderBy(array $items, $attr, $order)

orderBy([[],[],[]],'key','desc');

arrayVariadicSum(...$numbers)'

Takes an indefinite number of integers and returns their sum

arrayReject($items, $func)

Filters the collection using the given callback.

reject(['Apple', 'Pear', 'Kiwi', 'Banana'], function ($item) {
return strlen($item) > 4;
}); // ['Pear', 'Kiwi']

arrayTake($items, $remove_from_beginning_index = 1)

Returns an array with n elements removed from the beginning.

File Helper

folderCheck($params)

  • Check for a folder exists, if yes return true, else create one and returns true

  • folderCheck('$file path')

fileRemove($folderpath)

  • Completely remove a file from server

fileRemove($folderpath)

fileUpload($key='',$folder='')

  • upload files, even support multiple file upload

fileUpload('my_files','uploads/user')

JMakeThumbNail( 'sample.jpg', $fileHeight,$fileWidth, 'default.jpg')

As name suggests create Thumbnails of image

Time & Date helper

timeNow()

  • returns current timestamp

timeAgo($time)

  • Convert time to times ago string format

timeAgo(time in daytime)

getDayId($week_string)

get week id by passing first letter of the week

Debug Helper

Useful functions to easyly debug your codes

  • json_output(array $output = [], bool $exit = true, int $httpStatus = 200)

Return a prettified json output

print_j($params,false='')

  • Prints array with pre codeBlock

print_j($array,false)

j_log($data = null, string $file_url = null)

  • Create a Log file in server folder

j_log($data = null, string $file_url = null)

json_output(array $output = [], bool $exit = true, int $httpStatus = 200)

  • echo a string,(same as die function)

d_echo(string $var, int $die = 0)

d_echo(string $var, int $die = 0)

true_response(string $message = '', int $code = 200)

  • Returns a status true array with passed string and code

true_response(string $message = '', int $code = 200)

false_response(string $message = '', int $code = 200)

  • Returns a status false array with passed string and code

false_response(string $message = '', int $code = 200)

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-07-30

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固