From 5a4d46b46b8770b547721995c417a4aa4dae55f3 Mon Sep 17 00:00:00 2001 From: Younes ENNAJI Date: Sat, 10 Jan 2026 04:19:17 +0100 Subject: [PATCH] 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 --- src/Noty/Prime/README.md | 35 ++++++++++++++-------------- src/Notyf/Prime/README.md | 41 ++++++++++++++++++--------------- src/SweetAlert/Prime/README.md | 42 +++++++++++++++++----------------- src/Toastr/Prime/README.md | 14 +++++------- 4 files changed, 67 insertions(+), 65 deletions(-) diff --git a/src/Noty/Prime/README.md b/src/Noty/Prime/README.md index aed4089b..34bf31e2 100644 --- a/src/Noty/Prime/README.md +++ b/src/Noty/Prime/README.md @@ -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 diff --git a/src/Notyf/Prime/README.md b/src/Notyf/Prime/README.md index 6b59ebed..e9ae5e2f 100644 --- a/src/Notyf/Prime/README.md +++ b/src/Notyf/Prime/README.md @@ -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 diff --git a/src/SweetAlert/Prime/README.md b/src/SweetAlert/Prime/README.md index ecfb5d17..41825f25 100644 --- a/src/SweetAlert/Prime/README.md +++ b/src/SweetAlert/Prime/README.md @@ -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 diff --git a/src/Toastr/Prime/README.md b/src/Toastr/Prime/README.md index 167aa654..224380d2 100644 --- a/src/Toastr/Prime/README.md +++ b/src/Toastr/Prime/README.md @@ -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