mirror of
https://github.com/php-flasher/php-flasher.git
synced 2026-03-31 15:07:47 +01:00
Merge pull request #201 from php-flasher/configuration
chore: update laravel and symfony configuration documentation
This commit is contained in:
+27
-18
@@ -53,32 +53,30 @@ This will create a file at `config/flasher.php` with the following content:
|
||||
<?php // config/flasher.php
|
||||
|
||||
return [
|
||||
// Default notification library (e.g., 'flasher', 'toastr', 'noty', etc.)
|
||||
// Default notification library (e.g., 'flasher', 'toastr', 'noty', 'notyf', 'sweetalert')
|
||||
'default' => 'flasher',
|
||||
|
||||
// Path to the main JavaScript file of PHPFlasher
|
||||
// Path to the main PHPFlasher JavaScript file
|
||||
'main_script' => '/vendor/flasher/flasher.min.js',
|
||||
|
||||
// Path to the stylesheets for PHPFlasher notifications
|
||||
// List of CSS files to style your notifications
|
||||
'styles' => [
|
||||
'/vendor/flasher/flasher.min.css',
|
||||
],
|
||||
|
||||
// Enable translation of PHPFlasher messages using Laravel's translator service
|
||||
'translate' => true,
|
||||
// Set global options for all notifications (optional)
|
||||
// 'options' => [
|
||||
// 'timeout' => 5000, // Time in milliseconds before the notification disappears
|
||||
// 'position' => 'top-right', // Where the notification appears on the screen
|
||||
// ],
|
||||
|
||||
// Automatically inject PHPFlasher assets in HTML response
|
||||
// Automatically inject JavaScript and CSS assets into your HTML pages
|
||||
'inject_assets' => true,
|
||||
|
||||
// Global options
|
||||
'options' => [
|
||||
'timeout' => 5000, // in milliseconds
|
||||
'position' => 'top-right',
|
||||
'escapeHtml' => false,
|
||||
],
|
||||
// Enable message translation using Laravel's translation service
|
||||
'translate' => true,
|
||||
|
||||
// Configuration for the flash bag (converting Laravel flash messages)
|
||||
// Map Laravel session keys to PHPFlasher types
|
||||
// Map Laravel flash message keys to notification types
|
||||
'flash_bag' => [
|
||||
'success' => ['success'],
|
||||
'error' => ['error', 'danger'],
|
||||
@@ -86,11 +84,22 @@ return [
|
||||
'info' => ['info', 'notice', 'alert'],
|
||||
],
|
||||
|
||||
// Filter criteria for notifications (e.g., limit number, types)
|
||||
'filter' => [
|
||||
'limit' => 5, // Limit the number of displayed notifications
|
||||
],
|
||||
// Set criteria to filter which notifications are displayed (optional)
|
||||
// 'filter' => [
|
||||
// 'limit' => 5, // Maximum number of notifications to show at once
|
||||
// ],
|
||||
|
||||
// Define notification presets to simplify notification creation (optional)
|
||||
// 'presets' => [
|
||||
// 'entity_saved' => [
|
||||
// 'type' => 'success',
|
||||
// 'title' => 'Entity saved',
|
||||
// 'message' => 'Entity saved successfully',
|
||||
// ],
|
||||
// ],
|
||||
];
|
||||
|
||||
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
+31
-17
@@ -52,40 +52,54 @@ This will create a file at `config/packages/flasher.yaml` with the following con
|
||||
# config/packages/flasher.yaml
|
||||
|
||||
flasher:
|
||||
# Default notification library (e.g., 'flasher', 'toastr', 'noty', etc.)
|
||||
# Default notification library (e.g., 'flasher', 'toastr', 'noty', 'notyf', 'sweetalert')
|
||||
default: flasher
|
||||
|
||||
# Path to the main JavaScript file of PHPFlasher
|
||||
# Path to the main PHPFlasher JavaScript file
|
||||
main_script: '/vendor/flasher/flasher.min.js'
|
||||
|
||||
# Path to the stylesheets for PHPFlasher notifications
|
||||
# List of CSS files to style your notifications
|
||||
styles:
|
||||
- '/vendor/flasher/flasher.min.css'
|
||||
|
||||
# Enable translation of PHPFlasher messages using Symfony's translator service
|
||||
translate: true
|
||||
# Set global options for all notifications (optional)
|
||||
# options:
|
||||
# # Time in milliseconds before the notification disappears
|
||||
# timeout: 5000
|
||||
# # Where the notification appears on the screen
|
||||
# position: 'top-right'
|
||||
|
||||
# Automatically inject PHPFlasher assets in HTML response
|
||||
# Automatically inject JavaScript and CSS assets into your HTML pages
|
||||
inject_assets: true
|
||||
|
||||
# Global options
|
||||
options:
|
||||
# timeout in milliseconds
|
||||
timeout: 5000
|
||||
position: 'top-right'
|
||||
escapeHtml: false
|
||||
# Enable message translation using Symfony's translation service
|
||||
translate: true
|
||||
|
||||
# Map Symfony session keys to PHPFlasher notification types
|
||||
# URL patterns to exclude from asset injection and flash_bag conversion
|
||||
excluded_paths:
|
||||
- '/^\/_profiler/'
|
||||
- '/^\/_fragment/'
|
||||
|
||||
# Map Symfony flash message keys to notification types
|
||||
flash_bag:
|
||||
success: ['success']
|
||||
error: ['error', 'danger']
|
||||
warning: ['warning', 'alarm']
|
||||
info: ['info', 'notice', 'alert']
|
||||
|
||||
# Criteria to filter displayed notifications (limit, types)
|
||||
filter:
|
||||
# Limit number of displayed notifications
|
||||
limit: 5
|
||||
# Set criteria to filter which notifications are displayed (optional)
|
||||
# filter:
|
||||
# # Maximum number of notifications to show at once
|
||||
# limit: 5
|
||||
|
||||
# Define notification presets to simplify notification creation (optional)
|
||||
# presets:
|
||||
# # Example preset:
|
||||
# entity_saved:
|
||||
# type: 'success'
|
||||
# title: 'Entity saved'
|
||||
# message: 'Entity saved successfully'
|
||||
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
@@ -2,34 +2,34 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Flasher\Laravel\Resources;
|
||||
|
||||
return [
|
||||
// Default notification library (e.g., 'flasher', 'toastr', 'noty', etc.)
|
||||
// Default notification library (e.g., 'flasher', 'toastr', 'noty', 'notyf', 'sweetalert')
|
||||
'default' => 'flasher',
|
||||
|
||||
// Path to the main JavaScript file of PHPFlasher
|
||||
// Path to the main PHPFlasher JavaScript file
|
||||
'main_script' => '/vendor/flasher/flasher.min.js',
|
||||
|
||||
// Path to the stylesheets for PHPFlasher notifications
|
||||
// List of CSS files to style your notifications
|
||||
'styles' => [
|
||||
'/vendor/flasher/flasher.min.css',
|
||||
],
|
||||
|
||||
// Whether to translate PHPFlasher messages using Laravel's translation service
|
||||
'translate' => true,
|
||||
// Set global options for all notifications (optional)
|
||||
// 'options' => [
|
||||
// 'timeout' => 5000, // Time in milliseconds before the notification disappears
|
||||
// 'position' => 'top-right', // Where the notification appears on the screen
|
||||
// ],
|
||||
|
||||
// Automatically inject PHPFlasher assets into HTML response
|
||||
// Automatically inject JavaScript and CSS assets into your HTML pages
|
||||
'inject_assets' => true,
|
||||
|
||||
// Global options
|
||||
'options' => [
|
||||
'timeout' => 5000, // in milliseconds
|
||||
'position' => 'top-right',
|
||||
],
|
||||
// Enable message translation using Laravel's translation service
|
||||
'translate' => true,
|
||||
|
||||
// Configuration for the flash bag (converting Laravel flash messages)
|
||||
// Map Laravel session keys to PHPFlasher types
|
||||
// URL patterns to exclude from asset injection and flash_bag conversion
|
||||
'excluded_paths' => [],
|
||||
|
||||
// Map Laravel flash message keys to notification types
|
||||
'flash_bag' => [
|
||||
'success' => ['success'],
|
||||
'error' => ['error', 'danger'],
|
||||
@@ -37,8 +37,17 @@ return [
|
||||
'info' => ['info', 'notice', 'alert'],
|
||||
],
|
||||
|
||||
// Filter criteria for notifications (e.g., limit number, types)
|
||||
'filter' => [
|
||||
'limit' => 5, // Limit the number of displayed notifications
|
||||
],
|
||||
// Set criteria to filter which notifications are displayed (optional)
|
||||
// 'filter' => [
|
||||
// 'limit' => 5, // Maximum number of notifications to show at once
|
||||
// ],
|
||||
|
||||
// Define notification presets to simplify notification creation (optional)
|
||||
// 'presets' => [
|
||||
// 'entity_saved' => [
|
||||
// 'type' => 'success',
|
||||
// 'title' => 'Entity saved',
|
||||
// 'message' => 'Entity saved successfully',
|
||||
// ],
|
||||
// ],
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user