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
|
<?php // config/flasher.php
|
||||||
|
|
||||||
return [
|
return [
|
||||||
// Default notification library (e.g., 'flasher', 'toastr', 'noty', etc.)
|
// Default notification library (e.g., 'flasher', 'toastr', 'noty', 'notyf', 'sweetalert')
|
||||||
'default' => 'flasher',
|
'default' => 'flasher',
|
||||||
|
|
||||||
// Path to the main JavaScript file of PHPFlasher
|
// Path to the main PHPFlasher JavaScript file
|
||||||
'main_script' => '/vendor/flasher/flasher.min.js',
|
'main_script' => '/vendor/flasher/flasher.min.js',
|
||||||
|
|
||||||
// Path to the stylesheets for PHPFlasher notifications
|
// List of CSS files to style your notifications
|
||||||
'styles' => [
|
'styles' => [
|
||||||
'/vendor/flasher/flasher.min.css',
|
'/vendor/flasher/flasher.min.css',
|
||||||
],
|
],
|
||||||
|
|
||||||
// Enable translation of PHPFlasher messages using Laravel's translator service
|
// Set global options for all notifications (optional)
|
||||||
'translate' => true,
|
// '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,
|
'inject_assets' => true,
|
||||||
|
|
||||||
// Global options
|
// Enable message translation using Laravel's translation service
|
||||||
'options' => [
|
'translate' => true,
|
||||||
'timeout' => 5000, // in milliseconds
|
|
||||||
'position' => 'top-right',
|
|
||||||
'escapeHtml' => false,
|
|
||||||
],
|
|
||||||
|
|
||||||
// Configuration for the flash bag (converting Laravel flash messages)
|
// Map Laravel flash message keys to notification types
|
||||||
// Map Laravel session keys to PHPFlasher types
|
|
||||||
'flash_bag' => [
|
'flash_bag' => [
|
||||||
'success' => ['success'],
|
'success' => ['success'],
|
||||||
'error' => ['error', 'danger'],
|
'error' => ['error', 'danger'],
|
||||||
@@ -86,11 +84,22 @@ return [
|
|||||||
'info' => ['info', 'notice', 'alert'],
|
'info' => ['info', 'notice', 'alert'],
|
||||||
],
|
],
|
||||||
|
|
||||||
// Filter criteria for notifications (e.g., limit number, types)
|
// Set criteria to filter which notifications are displayed (optional)
|
||||||
'filter' => [
|
// 'filter' => [
|
||||||
'limit' => 5, // Limit the number of displayed notifications
|
// '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',
|
||||||
|
// ],
|
||||||
|
// ],
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|||||||
+41
-27
@@ -52,40 +52,54 @@ This will create a file at `config/packages/flasher.yaml` with the following con
|
|||||||
# config/packages/flasher.yaml
|
# config/packages/flasher.yaml
|
||||||
|
|
||||||
flasher:
|
flasher:
|
||||||
# Default notification library (e.g., 'flasher', 'toastr', 'noty', etc.)
|
# Default notification library (e.g., 'flasher', 'toastr', 'noty', 'notyf', 'sweetalert')
|
||||||
default: flasher
|
default: flasher
|
||||||
|
|
||||||
# Path to the main JavaScript file of PHPFlasher
|
# Path to the main PHPFlasher JavaScript file
|
||||||
main_script: '/vendor/flasher/flasher.min.js'
|
main_script: '/vendor/flasher/flasher.min.js'
|
||||||
|
|
||||||
# Path to the stylesheets for PHPFlasher notifications
|
# List of CSS files to style your notifications
|
||||||
styles:
|
styles:
|
||||||
- '/vendor/flasher/flasher.min.css'
|
- '/vendor/flasher/flasher.min.css'
|
||||||
|
|
||||||
# Enable translation of PHPFlasher messages using Symfony's translator service
|
# Set global options for all notifications (optional)
|
||||||
translate: true
|
# options:
|
||||||
|
# # Time in milliseconds before the notification disappears
|
||||||
# Automatically inject PHPFlasher assets in HTML response
|
# timeout: 5000
|
||||||
|
# # Where the notification appears on the screen
|
||||||
|
# position: 'top-right'
|
||||||
|
|
||||||
|
# Automatically inject JavaScript and CSS assets into your HTML pages
|
||||||
inject_assets: true
|
inject_assets: true
|
||||||
|
|
||||||
# Global options
|
# Enable message translation using Symfony's translation service
|
||||||
options:
|
translate: true
|
||||||
# timeout in milliseconds
|
|
||||||
timeout: 5000
|
# URL patterns to exclude from asset injection and flash_bag conversion
|
||||||
position: 'top-right'
|
excluded_paths:
|
||||||
escapeHtml: false
|
- '/^\/_profiler/'
|
||||||
|
- '/^\/_fragment/'
|
||||||
# Map Symfony session keys to PHPFlasher notification types
|
|
||||||
|
# Map Symfony flash message keys to notification types
|
||||||
flash_bag:
|
flash_bag:
|
||||||
success: ['success']
|
success: ['success']
|
||||||
error: ['error', 'danger']
|
error: ['error', 'danger']
|
||||||
warning: ['warning', 'alarm']
|
warning: ['warning', 'alarm']
|
||||||
info: ['info', 'notice', 'alert']
|
info: ['info', 'notice', 'alert']
|
||||||
|
|
||||||
|
# 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'
|
||||||
|
|
||||||
# Criteria to filter displayed notifications (limit, types)
|
|
||||||
filter:
|
|
||||||
# Limit number of displayed notifications
|
|
||||||
limit: 5
|
|
||||||
```
|
```
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|||||||
@@ -2,34 +2,34 @@
|
|||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Flasher\Laravel\Resources;
|
|
||||||
|
|
||||||
return [
|
return [
|
||||||
// Default notification library (e.g., 'flasher', 'toastr', 'noty', etc.)
|
// Default notification library (e.g., 'flasher', 'toastr', 'noty', 'notyf', 'sweetalert')
|
||||||
'default' => 'flasher',
|
'default' => 'flasher',
|
||||||
|
|
||||||
// Path to the main JavaScript file of PHPFlasher
|
// Path to the main PHPFlasher JavaScript file
|
||||||
'main_script' => '/vendor/flasher/flasher.min.js',
|
'main_script' => '/vendor/flasher/flasher.min.js',
|
||||||
|
|
||||||
// Path to the stylesheets for PHPFlasher notifications
|
// List of CSS files to style your notifications
|
||||||
'styles' => [
|
'styles' => [
|
||||||
'/vendor/flasher/flasher.min.css',
|
'/vendor/flasher/flasher.min.css',
|
||||||
],
|
],
|
||||||
|
|
||||||
// Whether to translate PHPFlasher messages using Laravel's translation service
|
// Set global options for all notifications (optional)
|
||||||
'translate' => true,
|
// '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,
|
'inject_assets' => true,
|
||||||
|
|
||||||
// Global options
|
// Enable message translation using Laravel's translation service
|
||||||
'options' => [
|
'translate' => true,
|
||||||
'timeout' => 5000, // in milliseconds
|
|
||||||
'position' => 'top-right',
|
|
||||||
],
|
|
||||||
|
|
||||||
// Configuration for the flash bag (converting Laravel flash messages)
|
// URL patterns to exclude from asset injection and flash_bag conversion
|
||||||
// Map Laravel session keys to PHPFlasher types
|
'excluded_paths' => [],
|
||||||
|
|
||||||
|
// Map Laravel flash message keys to notification types
|
||||||
'flash_bag' => [
|
'flash_bag' => [
|
||||||
'success' => ['success'],
|
'success' => ['success'],
|
||||||
'error' => ['error', 'danger'],
|
'error' => ['error', 'danger'],
|
||||||
@@ -37,8 +37,17 @@ return [
|
|||||||
'info' => ['info', 'notice', 'alert'],
|
'info' => ['info', 'notice', 'alert'],
|
||||||
],
|
],
|
||||||
|
|
||||||
// Filter criteria for notifications (e.g., limit number, types)
|
// Set criteria to filter which notifications are displayed (optional)
|
||||||
'filter' => [
|
// 'filter' => [
|
||||||
'limit' => 5, // Limit the number of displayed notifications
|
// '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