承接 samkitano/laragrowl 相关项目开发

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

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

samkitano/laragrowl

Composer 安装命令:

composer require samkitano/laragrowl

包简介

Flash Notifications with jGrowl for Laravel

README 文档

README

Latest Version on Packagist Software License Build Status Total Downloads

All the awesomeness and functionality of jGrowl made simple, for your Laravel project.

jGrowl is "an unobtrusive notification system for web applications", by Stan Lemon. If you are not acquainted with this marvelous notification system, I encourage you to pay a visit and read the documentation.

I find this notification system to be primus inter pares. Very well documented and mantained, "unobtrusive" as advertised, lightweight, flexible, and easy to use. Since I constantly use it, particularly in the Admin sections of my projects, I wrote Laragrowl to easily include it in my Laravel apps.

The main goal of Laragrowl, rather than fully exploit jGrowl's capabilities, is to provide an out-of-the-box, easy-to-use, consistent notification system within Laravel. I believe this is fully achieved with single-liners like Laragrowl::success('Your model has been updated');.

Furthermore, with Laravel's awesome ability to use Aliases for the facades, you can even "rename" Laragrowl into something like Notify or Inform. I.e. Inform::error('Validation Failed'). Whatever suits your taste.

Requirements

-Laravel >= 5.2.X
-PHP >= 5.6
-jQuery >= 1.9.0

Installation

1 - Require with Composer: composer require samkitano/laragrowl

2 - Include the service provider in the 'providers' array within config/app.php.

'providers' => [
    Kitano\Laragrowl\LaragrowlServiceProvider::class,
];

3 - Scroll down config/app.php and add an alias of your convenience (i.e. 'Notify') for the facade:

'aliases' => [
    'Notify' => Kitano\Laragrowl\Laragrowl::class,
];

3 - At this point, you must decide whether to a) download jGrowl; b) use a CDN; or c) publish the included version of jGrowl (1.4.5)

a) Download jGrowl, copy the files to a directory of your convenience and include them in your template:

<!DOCTYPE html>
<html>
    <head>
        ...
        <link href="path_to_your_downloaded_jGrowl_css_files" rel="stylesheet" type="text/css"/>
        ...
    </head>

    <body>
        ...
        <!-- Place jQuery Here -->
        <script src="path_to_your_downloaded_jGrowl_js_files"></script>
        ...
    </body>
</html>

b) Using a CDN:

<!DOCTYPE html>
<html>
    <head>
      ...
      <link rel="stylesheet" type="text/css" href="//cdnjs.cloudflare.com/ajax/libs/jquery-jgrowl/1.4.1/jquery.jgrowl.min.css" />
	  <!-- Place Your Theme Here -->
	  ...
    </head>

    <body>
        ...
        <!-- Place jQuery Here -->
        <script src="https//cdnjs.cloudflare.com/ajax/libs/jquery-jgrowl/1.4.1/jquery.jgrowl.min.js"></script>
        ...
    </body>
</html>

If you decide to download, or to use a CDN, you'll have to provide your own styling for the notifications. A basic theme is included in this package in src\assets\css\jquery.jgrowl.theme.css Feel free to use it "as is", or as a boilerplate to suit your own needs.

c) Publish included jGrowl version:

php artisan vendor:publish --provider="Kitano\Laragrowl\LaragrowlServiceProvider" --tag=assets

4 - Include the CSS files within your master template <head> section, and the core jGrowl script file right before the closing </body> tag.

<!DOCTYPE html>
<html>
    <head>
        <title>Laragrowl</title>
        <link href="{{ url('vendor/css/jquery.jgrowl.min.css') }}" rel="stylesheet" type="text/css">
        <link href="{{ url('vendor/css/jquery.jgrowl.theme.min.css') }}" rel="stylesheet" type="text/css">
    <head>

    <body>
        <script src="your.jquery.version.js"></script>
        <script src="{{ url('vendor/js/jquery.jgrowl.min.js') }}"></script>
    </body>

</html>

5 - Publish the message view:

php artisan vendor:publish --provider="Kitano\Laragrowl\LaragrowlServiceProvider" --tag=views

6 - Include the view after the jGrowl <script> tag in your master template:

	<body>
		<script src="your.jquery.version"></script>
		<script src="{{ url('vendor/js/jquery.jgrowl.min.js) }}"></script>

		@include('vendor.laragrowl.message')
	</body>

REMEMBER: jGrowl is a jQuery plugin, so you MUST have jQuery loaded before your jGrowl source.

If you are comfortable with elixir, and/or you like to master your own assets, you know what to do next.

By all means, feel free to modify the provided view resources\vendor\laragrowl\message.blade.php to fit your own requirements.

Usage

Where? Where you'd usually place a Session::flash('important message').

How? You can either use the facade Laragrowl::message or the alias you have provided (if so):

// Examples
public function store()
{
	...

	// PICK YOUR FLAVOUR

	// With an Alias, like "Notify"
	Notify::message('Your stuff has been stored.', 'success');

	// With the Facade
	Laragrowl::message('Your stuff has been stored', 'success');

	// Using available methods to declare the message type
	Laragrowl::default('Your stuff has been stored');
	Laragrowl::success('Your stuff has been stored');
	Laragrowl::error('Your stuff was NOT stored');
	Laragrowl::warning('Your form contains errors, check fields');
	Laragrowl::info('You have a neww message');

	...
}

Methods

Method Arguments Description Example
::message message, type, header, sticky, life, group Displays a notification according to parameters. If type is not provided, theme will be "default". Laragrowl::message('Welcome, User!', 'default', 'HI THERE')
::default message, header, sticky Displays a "default" themed notification. Laragrowl::default('Welcome, User!');
::info message, header, sticky Displays an "info" themed notification. Ideal for quickly provide an informational message. Laragrowl::info('Please fill out this form')
::success message, header, sticky Displays a "success" themed notification. Ideal for quickly provide a success message. Laragrowl::success('Data Saved!', 'SUCCESS!')
::warning message, header, sticky Displays a "warning" themed notification. Ideal for quickly provide a warning message. Laragrowl::warning('FYI: Third party service is not available at this time.', 'HEY!')
::error message, header, sticky Displays an "error" themed notification. Ideal for quickly provide an error message. Laragrowl::error('Validation Failed! Please correct form erros', 'ERROR', 'sticky')

Arguments

Argument Type Default value Description
message String The message to display.
type String 'success' The default theme for messages. Available: 'default', 'info', 'success', 'warning' and 'error'.
header String '' The message prefix, i.e. 'Error'.
sticky Boolean or String False Weather or not the message will display forever until closed.
life Integer or String 6000 Lifetime of a non-sticky message, in milisseconds.
group String '' An extra CSS selector useful to group messages.

License

Laragrowl is open-sourced software licensed under the MIT license.

samkitano/laragrowl 适用场景与选型建议

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

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

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

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

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-06-11