humanized / yii2-user-access-token
Yii2模块,提供处理用户访问令牌的功能。
dev-master
2016-09-01 21:02 UTC
Requires
- yiisoft/yii2: *
This package is not auto-updated.
Last update: 2024-09-14 19:14:46 UTC
README
Yii2访问令牌模块
依赖
本包依赖于Codemix Yii2 Locale Urls版本1.3.0。
安装
使用Composer安装
安装此扩展的首选方式是通过composer。
运行以下命令
$ php composer.phar require humanized/yii2-translation "*"
或将以下内容添加到你的composer.json
文件的require
部分:
"humanized/yii2-translation": "*"
to the require
section of your composer.json
file.
运行迁移
$ php yii migrate/up --migrationPath=@vendor/humanized/yii2-user-access-token/migrations
编辑配置文件
将以下行添加到配置文件
'modules' => [ 'translation' => [ 'class' => 'humanized\translation\Module', ], ],
添加这些行可以访问模块提供的各种接口。在此,选择的模块名称为translation,因此各种路由将在translation/controller-id/action-id下可用,尽管可以选择任何模块名称。
本包包含一个urlManager组件,该组件扩展了由Codemix Yii2-LocaleUrls包提供的urlManager组件。在这里,自动处理默认应用程序语言的设置和启用网站语言的填充。其他配置选项在组件之间继承。
'components' => [ .. // Languages enabled populated through database storage // Further configuration options available at https://github.com/codemix/yii2-localeurls 'urlManager' => [ 'class' => 'humanized\translation\components\UrlManager', 'enablePrettyUrl' => true, 'showScriptName' => false, ], .. ],
入门指南
配置完成后,应通过模块提供的各种接口启用一个或多个语言。为了快速启动,给出了一个示例,说明如何使用包提供的CLI启用一些语言
$ php yii translation/language/enable en $ php yii translation/language/enable fr $ php yii translation/language/enable nl $ php yii translation/language/set-default en
上述行启用了英语、法语和荷兰语,并将英语设置为默认语言
有关如何使用完全配置的模块的完整说明,请参阅USAGE文件。