ken/flash-me

Simple flash alert for Laravel

0.0.4 2017-10-21 18:16 UTC

This package is auto-updated.

Last update: 2024-04-09 16:19:35 UTC


README

FlashMe Flash Alert for Laravel, Elegant, responsive, flexible and lightweight notification plugin with no dependencies, simple and easy to use

Getting Started

How to use this packages

Installing

composer require ken/flash-me

and

php artisan vendor:publish --tag="flashMe"

Optional Setting

config/flash_me.php

/**
 * Change this /path if you load assets from local
 * example 'css' => asset('/css/app.css'),
 */
return [
	'css' => 'https://cdnjs.cloudflare.com/ajax/libs/izitoast/1.1.5/css/iziToast.min.css',
	'js' => 'https://cdnjs.cloudflare.com/ajax/libs/izitoast/1.1.5/js/iziToast.min.js',
];

resources/lang/en/flash_me.php

return [
	'success' => [
		'type' => 'success',
		'title' => 'Hi...',
		'message' => 'FlashMe is Ready!',
		'options' => [
			'position' => 'topRight', // this is an example option, you can add another option
			'transitionIn' => 'bounceInLeft',
    			'transitionOut' => 'fadeOut',
		],
	],
	'info' => [
		'type' => 'info',
		'title' => 'Hi...',
		'message' => 'FlashMe is Ready!',
		'options' => [
			'position' => 'topRight', // this is an example option, you can add another option
			'transitionIn' => 'bounceInLeft',
    			'transitionOut' => 'fadeOut',
		],
	],
	'warning' => [
		'type' => 'warning',
		'title' => 'Hi...',
		'message' => 'FlashMe is Ready!',
		'options' => [
			'position' => 'topRight', // this is an example option, you can add another option
			'transitionIn' => 'bounceInLeft',
    			'transitionOut' => 'fadeOut',
		],
	],
	'error' => [
		'type' => 'error',
		'title' => 'Hi...',
		'message' => 'FlashMe is Ready!',
		'options' => [
			'position' => 'topRight', // this is an example option, you can add another option
			'transitionIn' => 'bounceInLeft',
    			'transitionOut' => 'fadeOut',
		],
	],
];

other options can use

	id: null, 
	class: '',
	title: '',
	titleColor: '',
	titleSize: '',
	titleLineHeight: '',
	message: '',
	messageColor: '',
	messageSize: '',
	messageLineHeight: '',
	backgroundColor: '',
	theme: 'light', // dark
	color: '', // blue, red, green, yellow
	icon: '',
	iconText: '',
	iconColor: '',
	image: '',
	imageWidth: 50,
	maxWidth: null,
	zindex: null,
	layout: 1,
	balloon: false,
	close: true,
	closeOnEscape: false,
	rtl: false,
	position: 'bottomRight', // bottomRight, bottomLeft, topRight, topLeft, topCenter, bottomCenter, center
	target: '',
	targetFirst: true,
	toastOnce: false,
	timeout: 5000,
	animateInside: true,
	drag: true,
	pauseOnHover: true,
	resetOnHover: false,
	progressBar: true,
	progressBarColor: '',
	progressBarEasing: 'linear',
	overlay: false,
	overlayClose: false,
	overlayColor: 'rgba(0, 0, 0, 0.6)',
	transitionIn: 'fadeInUp',
	transitionOut: 'fadeOut',
	transitionInMobile: 'fadeInUp',
	transitionOutMobile: 'fadeOutDown',

Usage

How to use if you will send flash alert to view? example if this is controller on your project

public function testFlash()
{
	flashMe()->success();
	return view('your_view');
}

Another function

flashMe()->success();
flashMe()->info();
flashMe()->warning();
flashMe()->error();

Display

you can display on your master template or single blade, before end of body tag

@if (flashMe()->ok())
  {!! flashMe_flash() !!}
@endif

Built With

Demo

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

License

This project is licensed under the MIT License - see the LICENSE.md file for details