Fix incorrect code examples in Prime adapter READMEs

- Replace non-existent static method calls with correct helper functions
- Update examples to use sweetalert(), notyf(), noty(), toastr() helpers
- Pass options as arrays instead of invalid fluent chaining
This commit is contained in:
Younes ENNAJI
2026-01-10 04:19:17 +01:00
parent 0232edc9bd
commit 5a4d46b46b
4 changed files with 67 additions and 65 deletions
+17 -18
View File
@@ -20,23 +20,21 @@ composer require php-flasher/flasher-noty
## Quick Start
```php
use Flasher\Noty\Prime\NotyFactory;
// Basic usage
Noty::success('Operation completed successfully!');
Noty::error('An error occurred.');
Noty::info('Information message.');
Noty::warning('Warning message.');
noty('Operation completed successfully!', 'success');
noty('An error occurred.', 'error');
noty('Information message.', 'info');
noty('Warning message.', 'warning');
// With options
Noty::success('Success message', [
noty('Success message', 'success', [
'timeout' => 3000,
'layout' => 'topCenter',
'progressBar' => true,
]);
// Custom notification
Noty::flash('custom-type', 'Custom message');
noty('Custom message', 'custom-type');
```
## Features
@@ -51,25 +49,26 @@ Noty::flash('custom-type', 'Custom message');
```php
// Success notification
Noty::success($message, $title, $options);
noty($message, 'success', $options, $title);
// Error notification
Noty::error($message, $title, $options);
noty($message, 'error', $options, $title);
// Info notification
Noty::info($message, $title, $options);
noty($message, 'info', $options, $title);
// Warning notification
Noty::warning($message, $title, $options);
noty($message, 'warning', $options, $title);
// Custom notification type
Noty::flash($type, $message, $title, $options);
noty($message, $type, $options, $title);
// Set options
Noty::success($message)
->layout('topCenter')
->timeout(3000)
->theme('mint');
// With options
noty($message, 'success', [
'layout' => 'topCenter',
'timeout' => 3000,
'theme' => 'mint',
], $title);
```
## Documentation
+23 -18
View File
@@ -20,22 +20,23 @@ composer require php-flasher/flasher-notyf
## Quick Start
```php
use Flasher\Notyf\Prime\NotyfFactory;
// Basic usage
Notyf::success('Operation completed successfully!');
Notyf::error('An error occurred.');
Notyf::info('Information message.');
Notyf::warning('Warning message.');
notyf('Operation completed successfully!', 'success');
notyf('An error occurred.', 'error');
notyf('Information message.', 'info');
notyf('Warning message.', 'warning');
// With options
Notyf::success('Success message', [
notyf('Success message', 'success', [
'duration' => 4000,
'position' => 'top-right',
'position' => [
'x' => 'right',
'y' => 'top',
],
]);
// Custom notification
Notyf::flash('custom-type', 'Custom message');
notyf('Custom message', 'custom-type');
```
## Features
@@ -50,24 +51,28 @@ Notyf::flash('custom-type', 'Custom message');
```php
// Success notification
Notyf::success($message, $title, $options);
notyf($message, 'success', $options, $title);
// Error notification
Notyf::error($message, $title, $options);
notyf($message, 'error', $options, $title);
// Info notification
Notyf::info($message, $title, $options);
notyf($message, 'info', $options, $title);
// Warning notification
Notyf::warning($message, $title, $options);
notyf($message, 'warning', $options, $title);
// Custom notification type
Notyf::flash($type, $message, $title, $options);
notyf($message, $type, $options, $title);
// Set options
Notyf::success($message)
->duration(4000)
->position('top-right');
// With options
notyf($message, 'success', [
'duration' => 4000,
'position' => [
'x' => 'right',
'y' => 'top',
],
], $title);
```
## Documentation
+21 -21
View File
@@ -20,25 +20,24 @@ composer require php-flasher/flasher-sweetalert
## Quick Start
```php
use Flasher\SweetAlert\Prime\SweetAlertFactory;
// Basic usage
SweetAlert::success('Operation completed successfully!');
SweetAlert::error('An error occurred.');
SweetAlert::info('Information message.');
SweetAlert::warning('Warning message.');
sweetalert('Operation completed successfully!', 'success');
sweetalert('An error occurred.', 'error');
sweetalert('Information message.', 'info');
sweetalert('Warning message.', 'warning');
// With options
SweetAlert::success('Success message', [
sweetalert('Success message', 'success', [
'timer' => 3000,
'toast' => true,
'position' => 'top-end',
]);
// Modal dialog
SweetAlert::success('Profile updated!')
->confirmButtonText('Great!')
->timer(5000);
// Modal dialog with options
sweetalert('Profile updated!', 'success', [
'confirmButtonText' => 'Great!',
'timer' => 5000,
]);
```
## Features
@@ -53,25 +52,26 @@ SweetAlert::success('Profile updated!')
```php
// Success notification
SweetAlert::success($message, $title, $options);
sweetalert($message, 'success', $options, $title);
// Error notification
SweetAlert::error($message, $title, $options);
sweetalert($message, 'error', $options, $title);
// Info notification
SweetAlert::info($message, $title, $options);
sweetalert($message, 'info', $options, $title);
// Warning notification
SweetAlert::warning($message, $title, $options);
sweetalert($message, 'warning', $options, $title);
// Custom notification type
SweetAlert::flash($type, $message, $title, $options);
sweetalert($message, $type, $options, $title);
// Set options
SweetAlert::success($message)
->timer(3000)
->toast(true)
->position('top-end');
// With options
sweetalert($message, 'success', [
'timer' => 3000,
'toast' => true,
'position' => 'top-end',
], $title);
```
## Documentation
+6 -8
View File
@@ -20,23 +20,21 @@ composer require php-flasher/flasher-toastr
## Quick Start
```php
use Flasher\Toastr\Prime\ToastrFactory;
// Basic usage
Toastr::success('Operation completed successfully!');
Toastr::error('An error occurred.');
Toastr::info('Information message.');
Toastr::warning('Warning message.');
toastr('Operation completed successfully!', 'success');
toastr('An error occurred.', 'error');
toastr('Information message.', 'info');
toastr('Warning message.', 'warning');
// With options
Toastr::success('Success message', [
toastr('Success message', 'success', [
'timeOut' => 5000,
'positionClass' => 'toast-top-right',
'progressBar' => true,
]);
// Custom notification
Toastr::flash('custom-type', 'Custom message');
toastr('Custom message', 'custom-type');
```
## Features