承接 propaysystems/utilities 相关项目开发

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

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

propaysystems/utilities

Composer 安装命令:

composer require propaysystems/utilities

包简介

A set of helper utilities and traits

README 文档

README

Propay Systems

Propay Utilities

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

A set of helper utilities and traits to common functions we use everyday and across all our systems.

Requirements

PHP 8.1+
Laravel 9+

Installation

You can install the package via composer:

composer require propaysystems/utilities

You can publish the config file with:

php artisan vendor:publish --tag="utilities-config"

Features

Helpers

-- Database Helper --

Clears all data and reset auto increment on given table.

DatabaseHelper::resetTable($table);

-- Date Helper --

This will get the month name of the month number you pass in. Abbreviation will return the short name of the month.

DateHelper::getMonthName($number, $abbreviation = false);

Get current financial year of South Africa

DateHelper::getFiscalYear();

Get time

DateHelper::getTime($string);

-- File Helper --

This will get the human-readable format of the bytes you pass in

FileHelper::formatBytes($bytes, $precision = 2);

-- Http Helper --

Get the currently assigned public ip address of the request

HttpHelper::getIp();

Get the currently useragent of the request

HttpHelper::getUserAgent();

Get the hostname/domain name of the system. You can specify full to return http::// parts aswell

HttpHelper::hostname($full = false);

Get the subdomain of the current system

HttpHelper::subdomain();

-- Id Number Helper --

Generate a fake id number for testing from the date of birth

IdNumberHelper::generateIdNumber($dateOfBirt, int $male = 1);

Generate a complete fake id number for testing

IdNumberHelper::generateFakeNumber($dateOfBirt, int $male = 1);

Get gender from the id number

IdNumberHelper::getGenderCode($idNumber);

Get the date of birth from the id number

IdNumberHelper::getBirthDate($idNumber);

Get age from the id number

IdNumberHelper::getAgeFromIdNumber($idNumber);

Validate the id number

IdNumberHelper::getAgeFromIdNumber($attribute, $value, $parameters);

-- Number Helper --

Will generate a random integer between 1 and 100 000

NumberHelper::randomInt();

Will get the % difference between 2 number

NumberHelper::getPercentageDifference(int $last, int $current);

This will format the number accordingly 100000 will become 100.00k

NumberHelper::numberFormat(int $number);

This will combine a country prefix ex: 27 with the cell number ex: 0821231234 and return 27821231234

NumberHelper::combineCellPrefix($prefix, $number)

-- Route Helper --

Check of the string is in the current route name

RouteHelper::currentRouteContains($string);

-- SMS Helper --

Get the number of sms messages from the string

SmsHelper::multipart_count($str);

-- Spatie Media Helper --

Helper functions related to the spatie media package for managing files
https://spatie.be/docs/laravel-medialibrary/v10/introduction

-- String Helper --

This will get the first character of each word and capitalise them and only return first letter/s

StringHelper::initials($str, bool $upperCase = true);

This will capitalise first character of each word and return the string

StringHelper::capitaliseFirstChar($string);

Removed all white spaces and special characters

StringHelper::clean($string, string $delimiter = '-', bool $toLower = false, bool $removeSpecialChars = true);

This will generate a random password

StringHelper::generatePassword($length = 15, $count = 1, $characters = 'lower_case,upper_case,numbers,special_symbols');

This will mask a string with relevant characters

StringHelper::mask($string, string $maskingCharacter = '*', int $padLeft = 4, int $padRight = 4));

Transform db column name to human-readable

StringHelper::dbColumnHumanReadable($string_array);

Transform db column name to human-readable relation

StringHelper::dbColumnRelation($string_array);

Return a list of all special characters

StringHelper::specialCharacters();

Traits

Include these traits in any of your classes

-- Activity Helper Trait --

This is a helper function to the spatie activity log package
https://spatie.be/docs/laravel-activitylog/v4/introduction

use ActivityHelper;

$thia->log(string $channel, string $description, $preformedOn = null, $causedBy = null, array $properties = []);

-- TableHelper Trait --

This is a helper for the WireUI notifications to easily fire a notification from any livewire class. https://v1.wireui.dev/

use AlertHelper;

$this->alert($title, $text...);
$this->alertUpdated();
$this->alertCreated();
$this->alertDeleted();
etc

-- Dropdown Schema Trait --

Use the trait in your database models instead of having to write the boilerplate code multiple times

use DropdownSchema;

$this->table('categories');

-- Composite Primary Key Trait --

Use the trait in your database models to allow access to composite primary keys

use HasCompositePrimaryKey;

$this->find($ids, $columns = ['*']);
$this->setKeysForSaveQuery($query);

-- Password Strength Trait --

Us this trait for password strength progress bar.

use PasswordStrength;

-- Password Validation Trait --

Us this trait for standard password validation.

use PasswordValidationRules;

-- Save to uppercase Trait --

This will fave all your model data to uppercase

use SaveToUpper;

-- Set null on empty Trait --

This will force all empty string to be null instead of empty

use SetNullOnEmpty;

$this->setNullOnEmpty($input);

-- Toggle triggers Trait --

This will toggle enable or disable triggers in the relevant database table

use TriggerHelper;

$this->switchDatabaseTrigger($enable = true, $table = null, $trigger = null, string $connection = 'sqlsrv');

-- TableHelper Trait --

This is a helper for the livewire powergrid package on for the pagination. https://livewire-powergrid.com/

use TableHelper;

Testing

Run pest testing

composer test

Run phpstan code analysis

composer analyse

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.

propaysystems/utilities 适用场景与选型建议

propaysystems/utilities 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 4.65k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2023 年 11 月 16 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「laravel」 「utilities」 「PropaySystems」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 propaysystems/utilities 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 propaysystems/utilities 我们能提供哪些服务?
定制开发 / 二次开发

基于 propaysystems/utilities 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-11-16