gozoro/yii2-helpers 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

gozoro/yii2-helpers

最新稳定版本:v1.0.0

Composer 安装命令:

composer require gozoro/yii2-helpers

包简介

Helpers for Yii2 Framework. Extends standard helpers.

README 文档

README

Helpers for Yii2 Framework as static functions.

HTML helpers

Html::rus2translit("привет мир"); // privet mir

Html::str2url("привет мир!") // privet-mir

Html::text("это ссылка http://example.com") // это ссылка <a href="http://example.com">http://example.com</a>

Html::csrfHiddenInput(); //  Return string with CSRF hidden input

Html::video("./example.mp4") // Returns string with video tag or youtube-iframe.

JSON helpers

$options = [
	'valueString' => 'string',
	'valueInt'    => 5,
	'valueFloat'  => 4.3,
	'valueNull'   => null,
	'valueBool'   => true,
	'valArray'    => ['a', 'b', 'c'],
	'valAssoc'    => ['a'=>'apple', 'b'=>2, 'c'=>1],
	'func'        => 'function(val){return val;}',
];

Json::optionsEncode($options);

Returns string with JavaScript code:

 
 {
 	"valueString": "string",
 	"valueInt": 5,
 	"valueFloat": 4.3,
 	"valueNull": null,
 	"valueBool": true,
 	"valArray": ["a", "b", "c"],
 	"valAssoc": {"a":"apple", "b":2, "c":1},
 	"func": function(val){return val;},
 }

URL helper

Now you can parse and edit URLs

$url = new Url("https://example.com/my-path");
echo $url->getScheme(); // https
echo $url->getHost(); // example.com
echo $url->getPath(); // /my-path
// etc

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-04-03