承接 abolotin/yii2-unique-id 相关项目开发

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

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

abolotin/yii2-unique-id

Composer 安装命令:

composer require abolotin/yii2-unique-id

包简介

Generating unique identificator for any purposes. Typically used by Yii-widgets ("id"-attribute of HTML elements).

关键字:

README 文档

README

Generating unique identificator for any purposes. Typically used by Yii-widgets ("id"-attribute of HTML elements).

Standard Yii2 generator use prefix "w" and simple counter of generated IDs. It's enougth while non-AJAX requests used. But if you're want to load some page content via AJAX-request, you're can obtain HTML-elements with same IDs ("w1", for example). So, some scripts, based on element's ID, will work unexpectedly. Such behaviour may be bypassed by specifying ID manually in code. Another way is setting up Widget::$autoIdPrefix.

Installation

Using Composer

You can use the composer package manager to install. Either run:

$ php composer.phar require abolotin/yii2-unique-id

or add:

"abolotin/yii2-unique-id": ""

to your composer.json file

Manual Install

You can also manually install the component easily to your project. Just download the source ZIP or TAR ball

Usage

Using in manual mode

Just call \abolotin\yii2\UniqueId::getId(). It's returns unique value, which can be assigned to "id" attribute of HTML-element.

Using in automatic mode

You're can to setup automatic generation of IDs by any \yii\base\Widget based objects. Just add '\abolotin\yii2\UniqueId' string to 'bootstrap' array of applications configuraion:

return [
   ...
   'bootstrap' => [
       '\\abolotin\\yii2\\UniqueId',
       ...
   ]
];

or using component's mode:

return [
   ...
   'components' => [
       'uniqueId' => [
           'class' => '\\abolotin\\yii2\\UniqueId',
           ...
       ],
       ...
   ],
   'bootstrap' => [
       'uniqueId',
       ...
   ]
];

In last case it's can be also configured.

Configuration

Component allows next configuration options:

widgetPrefix - string. First prefix, used by widget generator. Default value: 'w'.

pjaxPrefix - string. First prefix, used by Pjax widget generator. Default value: 'p'.

autoIdPrefix - string. Second prefix, used by generator. If unspecified, will be generated automatically.

counter - integer. Inner generated IDs counter. Default value: 0.

suffix - string. Suffix of inner generated ID. Default value: 't'.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2018-05-06

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固