diff --git a/src/Noty/README.md b/src/Noty/README.md index 85e4b3e9..17eaef7d 100644 --- a/src/Noty/README.md +++ b/src/Noty/README.md @@ -1,34 +1,143 @@ # PHPFlasher Noty Adapter -[![Latest Stable Version](https://img.shields.io/packagist/v/php-flasher/flasher-noty.svg)](https://packagist.org/packages/php-flasher/flasher-noty) +[![Latest Version](https://img.shields.io/packagist/v/php-flasher/flasher-noty.svg)](https://packagist.org/packages/php-flasher/flasher-noty) [![Total Downloads](https://img.shields.io/packagist/dt/php-flasher/flasher-noty.svg)](https://packagist.org/packages/php-flasher/flasher-noty) [![License](https://img.shields.io/packagist/l/php-flasher/flasher-noty.svg)](https://packagist.org/packages/php-flasher/flasher-noty) -Noty adapter for [PHPFlasher](https://php-flasher.io). +Dependency-free notification library using [Noty](https://ned.im/noty/) for PHPFlasher. + +## Features + +- Multiple layout positions (top, bottom, center, corners) +- Queue management for multiple notifications +- Configurable animations +- Action buttons support +- Progress bar for timeout +- Modal mode support ## Installation +**Laravel:** + ```bash -composer require php-flasher/flasher-noty-laravel # Laravel -composer require php-flasher/flasher-noty-symfony # Symfony +composer require php-flasher/flasher-noty-laravel +php artisan flasher:install +``` + +**Symfony:** + +```bash +composer require php-flasher/flasher-noty-symfony +php bin/console flasher:install ``` ## Quick Start ```php -// Basic usage -flash('noty')->success('Operation completed successfully!'); +// Using the helper function +noty()->success('Profile updated successfully!'); -// With options -flash('noty')->warning('Please backup your data.', [ - 'timeout' => 3000, +// With custom layout +noty()->info('New message received', [ 'layout' => 'topCenter', ]); + +// Error notification +noty()->error('Unable to save changes. Please try again.'); + +// Warning with custom timeout +noty()->warning('Session expires in 5 minutes', [ + 'timeout' => 10000, +]); + +// Sticky notification (no auto-dismiss) +noty()->error('Connection lost', ['timeout' => false]); + +// With progress bar +noty()->info('Processing...', ['progressBar' => true]); +``` + +## Configuration Options + +| Option | Type | Default | Description | +|--------|------|---------|-------------| +| `layout` | string | `topRight` | Notification position | +| `timeout` | int/bool | `5000` | Auto-dismiss delay in ms (`false` = sticky) | +| `progressBar` | bool | `true` | Show countdown progress bar | +| `closeWith` | array | `['click']` | How to close (`click`, `button`) | +| `animation.open` | string | `null` | Opening animation class | +| `animation.close` | string | `null` | Closing animation class | +| `modal` | bool | `false` | Show as modal with overlay | +| `killer` | bool | `false` | Close all other notifications | + +### Layout Options + +- `top`, `topLeft`, `topCenter`, `topRight` +- `center`, `centerLeft`, `centerRight` +- `bottom`, `bottomLeft`, `bottomCenter`, `bottomRight` + +## Livewire Integration + +Noty notifications work seamlessly with Livewire. You can listen to notification events: + +```php +use Livewire\Attributes\On; + +#[On('noty:click')] +public function onNotyClick(array $payload): void +{ + // Handle notification click +} + +#[On('noty:close')] +public function onNotyClose(array $payload): void +{ + // Handle notification close +} +``` + +### Available Events + +| Event | Description | +|-------|-------------| +| `noty:show` | Fired when notification is shown | +| `noty:click` | Fired when notification is clicked | +| `noty:close` | Fired when close button is clicked | +| `noty:hidden` | Fired when notification is hidden | + +## Global Configuration + +**Laravel** (`config/flasher.php`): + +```php +'plugins' => [ + 'noty' => [ + 'options' => [ + 'layout' => 'topRight', + 'timeout' => 5000, + 'progressBar' => true, + 'closeWith' => ['click', 'button'], + ], + ], +], +``` + +**Symfony** (`config/packages/flasher.yaml`): + +```yaml +flasher: + plugins: + noty: + options: + layout: topRight + timeout: 5000 + progressBar: true + closeWith: ['click', 'button'] ``` ## Documentation -For complete documentation, visit [php-flasher.io](https://php-flasher.io). +For complete documentation, visit [php-flasher.io/library/noty](https://php-flasher.io/library/noty). ## License diff --git a/src/Notyf/README.md b/src/Notyf/README.md index 25dbde6b..0b261092 100644 --- a/src/Notyf/README.md +++ b/src/Notyf/README.md @@ -1,34 +1,148 @@ # PHPFlasher Notyf Adapter -[![Latest Stable Version](https://img.shields.io/packagist/v/php-flasher/flasher-notyf.svg)](https://packagist.org/packages/php-flasher/flasher-notyf) +[![Latest Version](https://img.shields.io/packagist/v/php-flasher/flasher-notyf.svg)](https://packagist.org/packages/php-flasher/flasher-notyf) [![Total Downloads](https://img.shields.io/packagist/dt/php-flasher/flasher-notyf.svg)](https://packagist.org/packages/php-flasher/flasher-notyf) [![License](https://img.shields.io/packagist/l/php-flasher/flasher-notyf.svg)](https://packagist.org/packages/php-flasher/flasher-notyf) -Notyf adapter for [PHPFlasher](https://php-flasher.io). +Minimalist, responsive toast notifications using [Notyf](https://github.com/caroso1222/notyf) for PHPFlasher. + +## Features + +- Lightweight and minimalist design +- Responsive and mobile-friendly +- Customizable positions +- Dismissible notifications +- Ripple effect animation +- Custom icons support ## Installation +**Laravel:** + ```bash -composer require php-flasher/flasher-notyf-laravel # Laravel -composer require php-flasher/flasher-notyf-symfony # Symfony +composer require php-flasher/flasher-notyf-laravel +php artisan flasher:install +``` + +**Symfony:** + +```bash +composer require php-flasher/flasher-notyf-symfony +php bin/console flasher:install ``` ## Quick Start ```php -// Basic usage -flash('notyf')->success('Operation completed successfully!'); +// Using the helper function +notyf()->success('Profile updated successfully!'); -// With options -flash('notyf')->info('New message received', [ - 'duration' => 4000, - 'position' => 'top-right', +// With custom position +notyf()->info('New notification', [ + 'position' => ['x' => 'center', 'y' => 'top'], ]); + +// Error notification +notyf()->error('Unable to save changes.'); + +// Custom duration +notyf()->warning('Please review your input', [ + 'duration' => 8000, +]); + +// Dismissible notification +notyf()->success('Click to dismiss', [ + 'dismissible' => true, +]); + +// With ripple effect +notyf()->info('Loading...', ['ripple' => true]); +``` + +## Configuration Options + +| Option | Type | Default | Description | +|--------|------|---------|-------------| +| `duration` | int | `5000` | Auto-dismiss delay in ms (0 = sticky) | +| `dismissible` | bool | `false` | Show close button | +| `ripple` | bool | `true` | Enable ripple animation | +| `position.x` | string | `right` | Horizontal position (`left`, `center`, `right`) | +| `position.y` | string | `top` | Vertical position (`top`, `bottom`) | + +### Position Combinations + +- `{x: 'right', y: 'top'}` (default) +- `{x: 'left', y: 'top'}` +- `{x: 'center', y: 'top'}` +- `{x: 'right', y: 'bottom'}` +- `{x: 'left', y: 'bottom'}` +- `{x: 'center', y: 'bottom'}` + +## Livewire Integration + +Notyf notifications work seamlessly with Livewire. You can listen to notification events: + +```php +use Livewire\Attributes\On; + +#[On('notyf:click')] +public function onNotyfClick(array $payload): void +{ + // Handle notification click +} + +#[On('notyf:dismiss')] +public function onNotyfDismiss(array $payload): void +{ + // Handle notification dismiss +} +``` + +### Available Events + +| Event | Description | +|-------|-------------| +| `notyf:click` | Fired when notification is clicked | +| `notyf:dismiss` | Fired when notification is dismissed | + +## Global Configuration + +**Laravel** (`config/flasher.php`): + +```php +'plugins' => [ + 'notyf' => [ + 'options' => [ + 'duration' => 5000, + 'dismissible' => true, + 'ripple' => true, + 'position' => [ + 'x' => 'right', + 'y' => 'top', + ], + ], + ], +], +``` + +**Symfony** (`config/packages/flasher.yaml`): + +```yaml +flasher: + plugins: + notyf: + options: + duration: 5000 + dismissible: true + ripple: true + position: + x: right + y: top ``` ## Documentation -For complete documentation, visit [php-flasher.io](https://php-flasher.io). +For complete documentation, visit [php-flasher.io/library/notyf](https://php-flasher.io/library/notyf). ## License diff --git a/src/SweetAlert/README.md b/src/SweetAlert/README.md index 75f8eeb8..8997c6fb 100644 --- a/src/SweetAlert/README.md +++ b/src/SweetAlert/README.md @@ -1,34 +1,169 @@ # PHPFlasher SweetAlert Adapter -[![Latest Stable Version](https://img.shields.io/packagist/v/php-flasher/flasher-sweetalert.svg)](https://packagist.org/packages/php-flasher/flasher-sweetalert) +[![Latest Version](https://img.shields.io/packagist/v/php-flasher/flasher-sweetalert.svg)](https://packagist.org/packages/php-flasher/flasher-sweetalert) [![Total Downloads](https://img.shields.io/packagist/dt/php-flasher/flasher-sweetalert.svg)](https://packagist.org/packages/php-flasher/flasher-sweetalert) [![License](https://img.shields.io/packagist/l/php-flasher/flasher-sweetalert.svg)](https://packagist.org/packages/php-flasher/flasher-sweetalert) -SweetAlert2 adapter for [PHPFlasher](https://php-flasher.io). +Beautiful, responsive, customizable alerts using [SweetAlert2](https://sweetalert2.github.io/) for PHPFlasher. + +## Features + +- Confirmation dialogs with Confirm/Deny/Cancel buttons +- User input dialogs (text, email, password, select, etc.) +- Custom HTML content support +- Image and icon customization +- Toast mode for non-blocking notifications +- Timer-based auto-close ## Installation +**Laravel:** + ```bash -composer require php-flasher/flasher-sweetalert-laravel # Laravel -composer require php-flasher/flasher-sweetalert-symfony # Symfony +composer require php-flasher/flasher-sweetalert-laravel +php artisan flasher:install +``` + +**Symfony:** + +```bash +composer require php-flasher/flasher-sweetalert-symfony +php bin/console flasher:install ``` ## Quick Start ```php -// Basic usage -flash('sweetalert')->success('Operation completed successfully!'); +// Using the helper function +sweetalert()->success('Profile updated successfully!'); -// With options -flash('sweetalert')->info('New message', [ - 'timer' => 3000, +// With a title +sweetalert()->info('Please read the terms before continuing', 'Important'); + +// Error notification +sweetalert()->error('Unable to process your request.'); + +// Toast mode (non-blocking) +sweetalert()->success('Saved!', [ 'toast' => true, + 'position' => 'top-end', + 'timer' => 3000, ]); + +// Auto-close with timer +sweetalert()->info('Redirecting...', ['timer' => 2000]); +``` + +## Confirmation Dialogs + +```php +// Simple confirmation +sweetalert() + ->showDenyButton() + ->success('Do you want to save the changes?'); + +// With all three buttons +sweetalert() + ->showDenyButton(true, 'Don\'t save') + ->showCancelButton(true, 'Cancel') + ->warning('Do you want to save the changes?'); + +// Delete confirmation +sweetalert() + ->showCancelButton() + ->confirmButtonColor('#d33') + ->warning('Are you sure you want to delete this item?', 'This action cannot be undone'); +``` + +## Configuration Options + +| Option | Type | Default | Description | +|--------|------|---------|-------------| +| `toast` | bool | `false` | Enable toast mode (corner notification) | +| `position` | string | `center` | Dialog position on screen | +| `timer` | int | `null` | Auto-close delay in ms | +| `timerProgressBar` | bool | `false` | Show progress bar for timer | +| `showConfirmButton` | bool | `true` | Show confirm button | +| `showDenyButton` | bool | `false` | Show deny button | +| `showCancelButton` | bool | `false` | Show cancel button | +| `confirmButtonText` | string | `OK` | Confirm button text | +| `denyButtonText` | string | `No` | Deny button text | +| `cancelButtonText` | string | `Cancel` | Cancel button text | + +### Position Options + +- `top`, `top-start`, `top-end` +- `center`, `center-start`, `center-end` +- `bottom`, `bottom-start`, `bottom-end` + +## Livewire Integration + +SweetAlert works seamlessly with Livewire. You can listen to button click events: + +```php +use Livewire\Attributes\On; + +#[On('sweetalert:confirmed')] +public function onConfirmed(array $payload): void +{ + // User clicked confirm button + $this->performAction(); +} + +#[On('sweetalert:denied')] +public function onDenied(array $payload): void +{ + // User clicked deny button +} + +#[On('sweetalert:dismissed')] +public function onDismissed(array $payload): void +{ + // User dismissed the dialog (clicked cancel or outside) +} +``` + +### Available Events + +| Event | Description | +|-------|-------------| +| `sweetalert:confirmed` | Fired when confirm button is clicked | +| `sweetalert:denied` | Fired when deny button is clicked | +| `sweetalert:dismissed` | Fired when dialog is dismissed | + +## Global Configuration + +**Laravel** (`config/flasher.php`): + +```php +'plugins' => [ + 'sweetalert' => [ + 'options' => [ + 'position' => 'center', + 'timer' => null, + 'showConfirmButton' => true, + 'timerProgressBar' => true, + ], + ], +], +``` + +**Symfony** (`config/packages/flasher.yaml`): + +```yaml +flasher: + plugins: + sweetalert: + options: + position: center + timer: null + showConfirmButton: true + timerProgressBar: true ``` ## Documentation -For complete documentation, visit [php-flasher.io](https://php-flasher.io). +For complete documentation, visit [php-flasher.io/library/sweetalert](https://php-flasher.io/library/sweetalert). ## License diff --git a/src/Toastr/README.md b/src/Toastr/README.md index 9e3b64bb..55236e54 100644 --- a/src/Toastr/README.md +++ b/src/Toastr/README.md @@ -1,34 +1,147 @@ # PHPFlasher Toastr Adapter -[![Latest Stable Version](https://img.shields.io/packagist/v/php-flasher/flasher-toastr.svg)](https://packagist.org/packages/php-flasher/flasher-toastr) +[![Latest Version](https://img.shields.io/packagist/v/php-flasher/flasher-toastr.svg)](https://packagist.org/packages/php-flasher/flasher-toastr) [![Total Downloads](https://img.shields.io/packagist/dt/php-flasher/flasher-toastr.svg)](https://packagist.org/packages/php-flasher/flasher-toastr) [![License](https://img.shields.io/packagist/l/php-flasher/flasher-toastr.svg)](https://packagist.org/packages/php-flasher/flasher-toastr) -Toastr adapter for [PHPFlasher](https://php-flasher.io). +Toast notifications using [Toastr](https://github.com/CodeSeven/toastr) for PHPFlasher. + +## Features + +- Customizable positions (top-right, bottom-left, center, etc.) +- Auto-dismiss with configurable timeout +- Progress bar support +- Close button option +- Queue management (newest on top) +- Prevent duplicate notifications ## Installation +**Laravel:** + ```bash -composer require php-flasher/flasher-toastr-laravel # Laravel -composer require php-flasher/flasher-toastr-symfony # Symfony +composer require php-flasher/flasher-toastr-laravel +php artisan flasher:install +``` + +**Symfony:** + +```bash +composer require php-flasher/flasher-toastr-symfony +php bin/console flasher:install ``` ## Quick Start ```php -// Basic usage -flash('toastr')->success('Operation completed successfully!'); +// Using the helper function +toastr()->success('Profile updated successfully!'); -// With options -flash('toastr')->info('New message received', [ - 'timeOut' => 5000, - 'positionClass' => 'toast-top-right', +// With a title +toastr()->info('You have 3 new messages', 'New Messages'); + +// Error notification +toastr()->error('Unable to save changes. Please try again.'); + +// Warning with options +toastr()->warning('Session expires in 5 minutes', [ + 'timeOut' => 10000, + 'positionClass' => 'toast-bottom-right', ]); + +// Sticky notification (won't auto-dismiss) +toastr()->error('Connection lost', ['timeOut' => 0]); + +// Prevent duplicate notifications +toastr()->success('Saved!', ['preventDuplicates' => true]); +``` + +## Configuration Options + +| Option | Type | Default | Description | +|--------|------|---------|-------------| +| `positionClass` | string | `toast-top-right` | Notification position | +| `timeOut` | int | `5000` | Auto-dismiss delay in ms (0 = sticky) | +| `extendedTimeOut` | int | `1000` | Time after hover before dismiss | +| `progressBar` | bool | `true` | Show countdown progress bar | +| `closeButton` | bool | `true` | Show close button | +| `newestOnTop` | bool | `true` | Stack order for multiple toasts | +| `preventDuplicates` | bool | `false` | Prevent duplicate messages | +| `tapToDismiss` | bool | `true` | Click toast to dismiss | + +### Position Options + +- `toast-top-right` (default) +- `toast-top-left` +- `toast-top-center` +- `toast-top-full-width` +- `toast-bottom-right` +- `toast-bottom-left` +- `toast-bottom-center` +- `toast-bottom-full-width` + +## Livewire Integration + +Toastr notifications work seamlessly with Livewire. You can listen to notification events in your components: + +```php +use Livewire\Attributes\On; + +#[On('toastr:click')] +public function onToastrClick(array $payload): void +{ + // Handle notification click +} + +#[On('toastr:close')] +public function onToastrClose(array $payload): void +{ + // Handle notification close +} +``` + +### Available Events + +| Event | Description | +|-------|-------------| +| `toastr:show` | Fired when notification is shown | +| `toastr:click` | Fired when notification is clicked | +| `toastr:close` | Fired when close button is clicked | +| `toastr:hidden` | Fired when notification is hidden | + +## Global Configuration + +**Laravel** (`config/flasher.php`): + +```php +'plugins' => [ + 'toastr' => [ + 'options' => [ + 'positionClass' => 'toast-top-right', + 'timeOut' => 5000, + 'progressBar' => true, + 'closeButton' => true, + ], + ], +], +``` + +**Symfony** (`config/packages/flasher.yaml`): + +```yaml +flasher: + plugins: + toastr: + options: + positionClass: toast-top-right + timeOut: 5000 + progressBar: true + closeButton: true ``` ## Documentation -For complete documentation, visit [php-flasher.io](https://php-flasher.io). +For complete documentation, visit [php-flasher.io/library/toastr](https://php-flasher.io/library/toastr). ## License