p2made/yii2-p2y2-things

此软件包已被废弃,不再维护。作者建议使用p2made/p2y2-things软件包。

一组CSS & JS资源,封装为Yii 2 AssetBundles &/or Widgets。

安装次数: 8,504

依赖项: 3

建议者: 0

安全: 0

星标: 11

关注者: 2

分支: 10

类型:yii2-extension

This package is auto-updated.

Last update: 2021-09-11 05:04:50 UTC


README

License Total Downloads Monthly Downloads Latest Stable Version Latest Unstable Version

注意!

经过一段时间的繁忙,我重新回到Yii2开发。我将在我重新开始工作的每个项目上进行重构。使用Bootstrap的项目将恢复到Bootstrap 5.x的版本5.0.0

一组资源,作为资产、辅助工具和widgets,用于Yii2。

版本5之所以如此命名,是因为我已经将P2Y2Things迁移到使用Bootstrap v5。

亮点

P2Y2 Assets

一个CSS & JS资源的宝库,封装为Yii2 AssetBundles。这些只是方便加载大量CSS & JS小工具的方法。还有一个从官方CDN获取资产的选择。

Bootstrap Social Asset Bundle & Helpers

P2Y2 Assets中的Bootstrap Social资产,辅助工具受@rmrevin的yii2-fontawesome启发。

感谢@lipis对Bootstrap Social的贡献。

FlagIconCss Asset Bundle & Helpers

P2Y2 Assets中的flag-icon-css资产,辅助工具受@rmrevin的yii2-fontawesome启发。

感谢@lipis对Bootstrap Social的贡献。

IsGd Helper

is.gd简单封装为辅助工具,用于Yii 2框架。

Uuid Helpers

ramsey/uuid简单封装为辅助工具,用于Yii 2框架。

感谢@ramsey为ramsey/uuid提供UUID魔法。

安装

安装P2Y2Things的首选方式是通过composer。根据您的composer安装情况,运行以下命令之一

	composer require p2made/yii2-p2y2-things "dev-master"

	php composer.phar require p2made/yii2-p2y2-things "dev-5.0.0-dev"

或者添加

	"p2made/yii2-p2y2-things": "dev-5.0.0-dev"

将此代码添加到您的 composer.json 文件的 "require" 部分,并在您下次运行 composer update 时,P2Y2Things 将被安装。

然后...

如果您正在使用 P2Y2Things,您可能需要禁用一些 Yii 2 资产,以避免因重复加载而产生冲突。使用以下代码修改 common/config/main.php...

	'components' => [
		...
		'assetManager' => [
			'bundles' => [
				'yii\web\JqueryAsset' => [
					'sourcePath' => null, 'js' => [],
				],
				'yii\bootstrap\BootstrapAsset' => [
					'sourcePath' => null, 'css' => [],
				],
				'yii\bootstrap\BootstrapPluginAsset' => [
					'sourcePath' => null, 'js' => [],
				],
				'yii\jui\JuiAsset' => [
					'sourcePath' => null, 'css' => [], 'js' => [],
				],
				'\rmrevin\yii\fontawesome\AssetBundle' => [
					'sourcePath' => null, 'css' => [],
				],
			],
		],
		...
	],

P2Y2Things 提供了从官方 CDN 加载资产的选择。只需将以下内容放入 common/config/params.php...

	'p2m' => [
		'assets' => [
			'useStatic' => true, // false or not set to use published assets
		],
	],

当一切设置到您满意的状态时,使用以下代码注册 P2CoreAsset...

	p2m\assets\P2CoreAsset::register($this);

...& 您将获得

  • Jquery(作为 p2m\assets\JqueryAsset),
  • yii\web\YiiAsset(作为 p2m\assets\P2YiiAsset),
  • Bootstrap(作为 p2m\assets\BootstrapAsset),&
  • Font Awesome(作为 p2m\assets\FontAwesomeAsset

在一行中优雅地加载。