You've already forked php-flasher
mirror of
https://github.com/php-flasher/php-flasher.git
synced 2026-04-05 20:42:56 +01:00
Compare commits
38 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 46f2397cdc | |||
| 57d4665b62 | |||
| cf3943bc08 | |||
| 1da1392670 | |||
| 095b0d967d | |||
| 16c1764e73 | |||
| 453a0b9c77 | |||
| fd051dbf74 | |||
| 2eb8500799 | |||
| e1b075520b | |||
| 0477a319b4 | |||
| 7eaa7a1f46 | |||
| cdfe882322 | |||
| 2ff02a15bf | |||
| 09f53b1b63 | |||
| d0022aa0cb | |||
| 632c0662e4 | |||
| e8ee494e13 | |||
| fdaa8f8961 | |||
| aa645778e3 | |||
| aca71922e8 | |||
| 08b96bdd39 | |||
| 89d8c2cb7a | |||
| 004334f642 | |||
| 60d0f2ed30 | |||
| d82a12d8c8 | |||
| 7b190bf882 | |||
| 18763f1df0 | |||
| 486329be24 | |||
| c0c8d7d5da | |||
| 8cbf37b29b | |||
| 43affdc543 | |||
| b6afde2990 | |||
| e28123fb3c | |||
| 79717cae5c | |||
| 6fe3407fae | |||
| 8d0dff2224 | |||
| 8047c6f6fe |
@@ -1,9 +1,18 @@
|
||||
--ignore-dir=.idea
|
||||
--ignore-dir=.cache
|
||||
--ignore-dir=vendor
|
||||
--ignore-dir=yoeunes
|
||||
--ignore-dir=node_modules
|
||||
|
||||
--ignore-dir=demo/laravel/vendor
|
||||
--ignore-dir=demo/laravel/node_modules
|
||||
--ignore-dir=demo/laravel/storage
|
||||
--ignore-dir=demo/laravel/bootstrap/cache
|
||||
|
||||
--ignore-dir=demo/symfony/vendor
|
||||
--ignore-dir=.cache
|
||||
--ignore-dir=demo/symfony/node_modules
|
||||
--ignore-dir=demo/symfony/var
|
||||
|
||||
--ignore-dir=docs/.jekyll-cache
|
||||
--ignore-dir=docs/_site
|
||||
--ignore-dir=docs/node_modules
|
||||
|
||||
+14
-17
@@ -1,22 +1,19 @@
|
||||
.idea/
|
||||
.DS_Store
|
||||
/.idea/
|
||||
/.DS_Store
|
||||
|
||||
vendor/
|
||||
node_modules/
|
||||
/vendor/
|
||||
/node_modules/
|
||||
|
||||
.cache/php-cs-fixer/
|
||||
.cache/phpunit/
|
||||
.cache/phpstan/
|
||||
.cache/phplint/
|
||||
.cache/nx/
|
||||
.nx/
|
||||
/.cache/php-cs-fixer/
|
||||
/.cache/phplint/
|
||||
/.cache/phpstan/
|
||||
/.cache/phpunit/
|
||||
|
||||
.php-cs-fixer.php
|
||||
phpunit.xml
|
||||
taskfile.yml
|
||||
phpstan.neon
|
||||
/.php-cs-fixer.php
|
||||
/phpunit.xml
|
||||
/taskfile.yml
|
||||
/phpstan.neon
|
||||
|
||||
lerna-debug.log
|
||||
npm-debug.log
|
||||
/npm-debug.log
|
||||
|
||||
tests/Symfony/Fixtures/project/public/vendor/
|
||||
/tests/Symfony/Fixtures/project/public/vendor/
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
*.log
|
||||
npm-debug.log*
|
||||
|
||||
# Coverage directory used by tools like istanbul
|
||||
coverage
|
||||
|
||||
# Dependency directories
|
||||
node_modules
|
||||
@@ -1,6 +1,3 @@
|
||||
pnpm-lock.yaml
|
||||
pnpm-workspace.yaml
|
||||
|
||||
**/node_modules
|
||||
src/**/Resources/public/**
|
||||
src/**/Resources/dist/**
|
||||
|
||||
-23
@@ -1,23 +0,0 @@
|
||||
name: Auto Closer PR
|
||||
|
||||
on:
|
||||
pull_request_target:
|
||||
types: [ opened ]
|
||||
|
||||
jobs:
|
||||
run:
|
||||
name: 🤖 PR Auto-Closure
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: superbrothers/close-pull-request@v3
|
||||
with:
|
||||
comment: |
|
||||
Hi there 👋,
|
||||
|
||||
First off, thanks for your effort! 🎉 Unfortunately, this repository is read-only because it's split from our primary monorepo repository.
|
||||
|
||||
🙏 We kindly ask if you could direct your valuable contribution to our main repository at https://github.com/php-flasher/php-flasher.
|
||||
|
||||
Once you've moved your contribution there, we'll review it and provide feedback. 🕵️♂️
|
||||
|
||||
Thanks again for your understanding and cooperation. We really appreciate it! 🙌
|
||||
+20
-1
@@ -1,6 +1,25 @@
|
||||
# CHANGELOG for 2.x
|
||||
|
||||
## [Unreleased](https://github.com/php-flasher/php-flasher/compare/v2.0.2...2.x)
|
||||
## [Unreleased](https://github.com/php-flasher/php-flasher/compare/v2.1.1...2.x)
|
||||
|
||||
## [v2.1.1](https://github.com/php-flasher/php-flasher/compare/v2.1.0...v2.1.1) - 2024-10-20
|
||||
|
||||
* feature [Laravel] Add `excluded_paths` option. See [PR #203](https://github.com/php-flasher/php-flasher/pull/203) by [yoeunes](https://github.com/yoeunes)
|
||||
|
||||
## [v2.1.0](https://github.com/php-flasher/php-flasher/compare/v2.0.4...v2.1.0) - 2024-10-19
|
||||
|
||||
* feature [Flasher] Update laravel and symfony configuration documentation . See [PR #201](https://github.com/php-flasher/php-flasher/pull/201) by [yoeunes](https://github.com/yoeunes)
|
||||
* feature [Flasher] Improve Type Safety and IDE Support with Enhanced PHPDoc Annotations and Stricter PHPStan Validations. See [PR #200](https://github.com/php-flasher/php-flasher/pull/200) by [yoeunes](https://github.com/yoeunes)
|
||||
* feature [Symfony] Improve configuration descriptions and add examples. See [PR #199](https://github.com/php-flasher/php-flasher/pull/199) by [yoeunes](https://github.com/yoeunes)
|
||||
* feature [Symfony] Add Symfony Profiler integration for PHPFlasher. See [PR #198](https://github.com/php-flasher/php-flasher/pull/198) by [yoeunes](https://github.com/yoeunes)
|
||||
|
||||
## [v2.0.4](https://github.com/php-flasher/php-flasher/compare/v2.0.3...v2.0.4) - 2024-09-22
|
||||
|
||||
* bug [laravel] Changed HttpKernel import from `Illuminate\Foundation\Http\Kernel` to `Illuminate\Contracts\Http\Kernel` to use the contract interface instead of the concrete implementation. See [PR #197](https://github.com/php-flasher/php-flasher/pull/197) by [yoeunes](https://github.com/yoeunes)
|
||||
|
||||
## [v2.0.3](https://github.com/php-flasher/php-flasher/compare/v2.0.2...v2.0.3) - 2024-09-21
|
||||
|
||||
* remove border from flasher container by [yoeunes](https://github.com/yoeunes)
|
||||
|
||||
## [v2.0.2](https://github.com/php-flasher/php-flasher/compare/v2.0.1...v2.0.2) - 2024-09-19
|
||||
|
||||
|
||||
@@ -70,11 +70,11 @@ You can reach out with questions, bug reports, or feature requests on any of the
|
||||
- [Github Issues](https://github.com/php-flasher/php-flasher/issues)
|
||||
- [Github](https://github.com/yoeunes)
|
||||
- [Twitter](https://twitter.com/yoeunes)
|
||||
- [Linkedin](https://www.linkedin.com/in/younes-ennaji/)
|
||||
- [Email me directly](mailto:younes.ennaji@gmail.com)
|
||||
- [Linkedin](https://www.linkedin.com/in/younes--ennaji/)
|
||||
- [Email me directly](mailto:younes.ennaji.pro@gmail.com)
|
||||
|
||||
## License
|
||||
|
||||
PHPFlasher is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).
|
||||
|
||||
<p align="center"> <b>Made with ❤️ by <a href="https://www.linkedin.com/in/younes-ennaji/">Younes ENNAJI</a> </b> </p>
|
||||
<p align="center"> <b>Made with ❤️ by <a href="https://www.linkedin.com/in/younes--ennaji/">Younes ENNAJI</a> </b> </p>
|
||||
|
||||
@@ -1,50 +1,70 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
require __DIR__.'/../vendor/autoload.php';
|
||||
|
||||
use Symfony\Component\Filesystem\Filesystem;
|
||||
use Symfony\Component\Finder\Finder;
|
||||
|
||||
$filesystem = new Filesystem();
|
||||
|
||||
// Define the shared resources
|
||||
$shared = realpath(__DIR__.'/../.shared');
|
||||
|
||||
$resources = array(
|
||||
$resources = [
|
||||
$shared,
|
||||
__DIR__.'/../.github/FUNDING.yml',
|
||||
__DIR__.'/../README.md',
|
||||
__DIR__.'/../LICENSE',
|
||||
);
|
||||
];
|
||||
|
||||
$dirs = array(__DIR__.'/../packs', __DIR__.'/../src');
|
||||
// Directories to search for packages
|
||||
$dirs = [__DIR__.'/../src'];
|
||||
|
||||
$packages = array_reduce($dirs, function ($files, $dir) {
|
||||
return array_merge($files, glob("$dir/*/composer.json"), glob("$dir/*/*/composer.json"));
|
||||
}, array());
|
||||
// Find all composer.json files within the specified directories
|
||||
$finder = new Finder();
|
||||
$finder->files()
|
||||
->in($dirs)
|
||||
->name('composer.json')
|
||||
->depth('< 3'); // Adjust depth as needed
|
||||
|
||||
foreach ($packages as $package) {
|
||||
$package = realpath(dirname($package));
|
||||
$packages = [];
|
||||
|
||||
// Collect package directories
|
||||
foreach ($finder as $file) {
|
||||
$packages[] = dirname($file->getRealPath());
|
||||
}
|
||||
|
||||
foreach ($packages as $packageDir) {
|
||||
foreach ($resources as $resource) {
|
||||
$resource = realpath($resource);
|
||||
$dest = $package.str_replace(realpath(__DIR__.'/../'), '', $resource);
|
||||
|
||||
if (!is_dir($resource) && file_exists($resource)) {
|
||||
copy($resource, $dest);
|
||||
if (!is_string($resource)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$files = new RecursiveIteratorIterator(
|
||||
new RecursiveDirectoryIterator($resource, FilesystemIterator::SKIP_DOTS),
|
||||
RecursiveIteratorIterator::SELF_FIRST
|
||||
);
|
||||
$resourcePath = realpath($resource);
|
||||
|
||||
foreach ($files as $file) {
|
||||
$target = $resource === $shared
|
||||
? $package.str_replace($resource, '', $file->getPathname())
|
||||
: $dest .'/'. $file->getFilename();
|
||||
if (!$resourcePath) {
|
||||
continue; // Skip if the resource doesn't exist
|
||||
}
|
||||
|
||||
if ($file->isDir()) {
|
||||
system('rm -rf -- ' . escapeshellarg($dest));
|
||||
@mkdir(dirname($target), 0777, true);
|
||||
continue;
|
||||
$relativePath = str_replace(realpath(__DIR__.'/../') ?: '', '', $resourcePath);
|
||||
$destination = $packageDir.$relativePath;
|
||||
|
||||
if (is_file($resourcePath)) {
|
||||
// Ensure the destination directory exists
|
||||
$filesystem->mkdir(dirname($destination));
|
||||
// Copy the file
|
||||
$filesystem->copy($resourcePath, $destination, true);
|
||||
} elseif (is_dir($resourcePath)) {
|
||||
if ($resourcePath === $shared) {
|
||||
// Copy contents of the shared directory into the package directory
|
||||
$filesystem->mirror($shared, $packageDir, null, ['override' => true]);
|
||||
} else {
|
||||
// Copy the entire directory to the destination
|
||||
$filesystem->mirror($resourcePath, $destination, null, ['override' => true]);
|
||||
}
|
||||
|
||||
@mkdir(dirname($target), 0777, true);
|
||||
@copy($file->getPathname(), $target);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+21
-19
@@ -21,27 +21,14 @@
|
||||
"prefer-stable": true,
|
||||
"require": {
|
||||
"php": ">=8.2",
|
||||
"ext-intl": "*"
|
||||
},
|
||||
"require-dev": {
|
||||
"ext-intl": "*",
|
||||
"illuminate/contracts": "^11.0",
|
||||
"illuminate/routing": "^11.0",
|
||||
"illuminate/support": "^11.0",
|
||||
"larastan/larastan": "^2.9",
|
||||
"laravel/octane": "^2.3",
|
||||
"livewire/livewire": "^3.5",
|
||||
"mockery/mockery": "^1.6",
|
||||
"orchestra/testbench": "^9.4",
|
||||
"overtrue/phplint": "^9.4",
|
||||
"php-cs-fixer/shim": "^3.64",
|
||||
"phpstan/phpstan": "^1.12",
|
||||
"phpstan/phpstan-mockery": "^1.1",
|
||||
"phpstan/phpstan-phpunit": "^1.4",
|
||||
"phpstan/phpstan-symfony": "^1.4",
|
||||
"phpunit/phpunit": "^10.5",
|
||||
"livewire/livewire": "^3.0",
|
||||
"paragonie/random_compat": "^2.0",
|
||||
"psr/container": "^1.1|^2.0",
|
||||
"rector/rector": "^1.2",
|
||||
"rector/swiss-knife": "^0.2",
|
||||
"spatie/ray": "^1.41",
|
||||
"symfony/config": "^7.0",
|
||||
"symfony/console": "^7.0",
|
||||
"symfony/dependency-injection": "^7.0",
|
||||
@@ -49,8 +36,23 @@
|
||||
"symfony/http-kernel": "^7.0",
|
||||
"symfony/translation": "^7.0",
|
||||
"symfony/twig-bundle": "^7.0",
|
||||
"symfony/ux-twig-component": "^2.19",
|
||||
"symplify/monorepo-builder": "^11.2"
|
||||
"symfony/ux-twig-component": "^2.19"
|
||||
},
|
||||
"require-dev": {
|
||||
"larastan/larastan": "^2.9.9",
|
||||
"mockery/mockery": "^1.6.12",
|
||||
"orchestra/testbench": "^9.5.2",
|
||||
"overtrue/phplint": "^9.5.3",
|
||||
"php-cs-fixer/shim": "^3.64.0",
|
||||
"phpstan/phpstan": "^1.12.7",
|
||||
"phpstan/phpstan-mockery": "^1.1.3",
|
||||
"phpstan/phpstan-phpunit": "^1.4.0",
|
||||
"phpstan/phpstan-symfony": "^1.4.10",
|
||||
"phpunit/phpunit": "^10.5.26",
|
||||
"rector/rector": "^1.2.8",
|
||||
"rector/swiss-knife": "^1.0.0",
|
||||
"spatie/ray": "^1.41.2",
|
||||
"symplify/monorepo-builder": "^11.2.22"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
|
||||
Generated
+5362
-5351
File diff suppressed because it is too large
Load Diff
@@ -2,6 +2,7 @@
|
||||
/node_modules
|
||||
/public/build
|
||||
/public/hot
|
||||
/public/vendor/flasher
|
||||
/public/storage
|
||||
/storage/*.key
|
||||
/vendor
|
||||
|
||||
@@ -3,16 +3,20 @@
|
||||
use Illuminate\Foundation\Application;
|
||||
use Illuminate\Foundation\Configuration\Exceptions;
|
||||
use Illuminate\Foundation\Configuration\Middleware;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
return Application::configure(basePath: dirname(__DIR__))
|
||||
->withRouting(
|
||||
web: __DIR__.'/../routes/web.php',
|
||||
commands: __DIR__.'/../routes/console.php',
|
||||
health: '/up',
|
||||
then: function () {
|
||||
Route::middleware('web')->group(base_path('routes/issues.php'));
|
||||
},
|
||||
)
|
||||
->withMiddleware(function (Middleware $middleware) {
|
||||
$middleware->web(append: [
|
||||
\App\Http\Middleware\HandleInertiaRequests::class,
|
||||
App\Http\Middleware\HandleInertiaRequests::class,
|
||||
]);
|
||||
})
|
||||
->withExceptions(function (Exceptions $exceptions) {
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
"spatie/laravel-ray": "^1.36"
|
||||
},
|
||||
"require-dev": {
|
||||
"barryvdh/laravel-debugbar": "^3.14",
|
||||
"fakerphp/faker": "^1.23",
|
||||
"larastan/larastan": "^2.9",
|
||||
"laravel/pint": "^1.13",
|
||||
@@ -32,7 +33,8 @@
|
||||
"nunomaduro/collision": "^8.0",
|
||||
"pestphp/pest": "^2.34",
|
||||
"pestphp/pest-plugin-laravel": "^2.3",
|
||||
"spatie/laravel-ignition": "^2.4"
|
||||
"spatie/laravel-ignition": "^2.4",
|
||||
"spatie/ray": "^1.41"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
@@ -49,13 +51,16 @@
|
||||
"scripts": {
|
||||
"post-autoload-dump": [
|
||||
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
|
||||
"@php artisan package:discover --ansi"
|
||||
"@php artisan package:discover --ansi",
|
||||
"@php artisan flasher:install --symlink"
|
||||
],
|
||||
"post-update-cmd": [
|
||||
"@php artisan vendor:publish --tag=laravel-assets --ansi --force"
|
||||
"@php artisan vendor:publish --tag=laravel-assets --ansi --force",
|
||||
"@php artisan flasher:install --symlink"
|
||||
],
|
||||
"post-root-package-install": [
|
||||
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
|
||||
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\"",
|
||||
"@php artisan flasher:install --symlink"
|
||||
],
|
||||
"post-create-project-cmd": [
|
||||
"@php artisan key:generate --ansi",
|
||||
|
||||
Generated
+2169
-446
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
Route::get('/issues/190', function () {
|
||||
flash()->success('Your order has been placed successfully.');
|
||||
// Passing another success message with the view
|
||||
return redirect('/issues/190/redirect')->with('success', 'Your order will be delivered in 3-5 business days.');
|
||||
});
|
||||
|
||||
Route::get('/issues/190/redirect', function () {
|
||||
return view('welcome');
|
||||
});
|
||||
+16
-12
@@ -1,23 +1,27 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use App\Entity\Book;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
Route::get('/', function () {
|
||||
// sweetalert()->timerProgressBar()->success('hello from Home Controller');
|
||||
// noty()->layout('topCenter')->success('hello from Home Controller');
|
||||
// notyf()->ripple(false)->warning('hello from Home Controller');
|
||||
// toastr()->positionClass('toast-bottom-left')->error('hello from Home Controller');
|
||||
// flash()->use('flasher')->success('hello from flasher factory');
|
||||
|
||||
// flash()->created(new Book('lord of the rings'));
|
||||
// flash()->saved(new Book('harry potter'));
|
||||
|
||||
session()->flash('success', 'this from laravel session flash');
|
||||
|
||||
return redirect('/redirect');
|
||||
sweetalert()->timerProgressBar()->success('Your account has been successfully created!');
|
||||
noty()->layout('topCenter')->success('Welcome back, John Doe!');
|
||||
notyf()->ripple(false)->warning('Your subscription is about to expire in 3 days.');
|
||||
toastr()->positionClass('toast-bottom-left')->error('Payment failed. Please try again.');
|
||||
flash()->use('flasher')->success('Your profile has been updated successfully.');
|
||||
flash()->created(new Book('The Great Gatsby'));
|
||||
flash()->saved(new Book('1984'));
|
||||
session()->flash('success', 'Your settings have been saved.');
|
||||
return view('welcome');
|
||||
})->name('app_home');
|
||||
|
||||
Route::get('/redirect', function () {
|
||||
session()->flash('success', 'You have been redirected successfully.');
|
||||
return redirect('/destination');
|
||||
});
|
||||
|
||||
Route::get('/destination', function () {
|
||||
return view('welcome');
|
||||
});
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
*
|
||||
!.gitignore
|
||||
@@ -0,0 +1,4 @@
|
||||
--ignore-dir=vendor
|
||||
--ignore-dir=yoeunes
|
||||
--ignore-dir=node_modules
|
||||
--ignore-dir=var
|
||||
@@ -5,6 +5,7 @@
|
||||
/.env.*.local
|
||||
/config/secrets/prod/prod.decrypt.private.php
|
||||
/public/bundles/
|
||||
/public/vendor/flasherg
|
||||
/var/
|
||||
/vendor/
|
||||
###< symfony/framework-bundle ###
|
||||
|
||||
@@ -23,6 +23,8 @@
|
||||
"symfony/dotenv": "7.0.*",
|
||||
"symfony/flex": "^2",
|
||||
"symfony/framework-bundle": "7.0.*",
|
||||
"symfony/monolog-bundle": "^3.10",
|
||||
"symfony/notifier": "7.0.*",
|
||||
"symfony/runtime": "7.0.*",
|
||||
"symfony/translation": "7.0.*",
|
||||
"symfony/twig-bundle": "7.0.*",
|
||||
@@ -61,7 +63,8 @@
|
||||
"scripts": {
|
||||
"auto-scripts": {
|
||||
"cache:clear": "symfony-cmd",
|
||||
"assets:install %PUBLIC_DIR%": "symfony-cmd"
|
||||
"assets:install %PUBLIC_DIR%": "symfony-cmd",
|
||||
"flasher:install": "symfony-cmd"
|
||||
},
|
||||
"post-install-cmd": [
|
||||
"@auto-scripts"
|
||||
@@ -80,6 +83,9 @@
|
||||
}
|
||||
},
|
||||
"require-dev": {
|
||||
"symfony/maker-bundle": "^1.58"
|
||||
"spatie/ray": "^1.41",
|
||||
"symfony/maker-bundle": "^1.58",
|
||||
"symfony/stopwatch": "7.0.*",
|
||||
"symfony/web-profiler-bundle": "7.0.*"
|
||||
}
|
||||
}
|
||||
|
||||
Generated
+940
-16
File diff suppressed because it is too large
Load Diff
@@ -11,4 +11,6 @@ return [
|
||||
Twig\Extra\TwigExtraBundle\TwigExtraBundle::class => ['all' => true],
|
||||
Symfony\Bundle\MakerBundle\MakerBundle::class => ['dev' => true],
|
||||
Nelmio\SecurityBundle\NelmioSecurityBundle::class => ['all' => true],
|
||||
Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class => ['dev' => true, 'test' => true],
|
||||
Symfony\Bundle\MonologBundle\MonologBundle::class => ['all' => true],
|
||||
];
|
||||
|
||||
@@ -32,4 +32,4 @@ flasher:
|
||||
# Criteria to filter displayed notifications (limit, types)
|
||||
filter:
|
||||
# Limit number of displayed notifications
|
||||
limit: 5
|
||||
# limit: 5
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
monolog:
|
||||
channels:
|
||||
- deprecation # Deprecations are logged in the dedicated "deprecation" channel when it exists
|
||||
|
||||
when@dev:
|
||||
monolog:
|
||||
handlers:
|
||||
main:
|
||||
type: stream
|
||||
path: "%kernel.logs_dir%/%kernel.environment%.log"
|
||||
level: debug
|
||||
channels: ["!event"]
|
||||
# uncomment to get logging in your browser
|
||||
# you may have to allow bigger header sizes in your Web server configuration
|
||||
#firephp:
|
||||
# type: firephp
|
||||
# level: info
|
||||
#chromephp:
|
||||
# type: chromephp
|
||||
# level: info
|
||||
console:
|
||||
type: console
|
||||
process_psr_3_messages: false
|
||||
channels: ["!event", "!doctrine", "!console"]
|
||||
|
||||
when@test:
|
||||
monolog:
|
||||
handlers:
|
||||
main:
|
||||
type: fingers_crossed
|
||||
action_level: error
|
||||
handler: nested
|
||||
excluded_http_codes: [404, 405]
|
||||
channels: ["!event"]
|
||||
nested:
|
||||
type: stream
|
||||
path: "%kernel.logs_dir%/%kernel.environment%.log"
|
||||
level: debug
|
||||
|
||||
when@prod:
|
||||
monolog:
|
||||
handlers:
|
||||
main:
|
||||
type: fingers_crossed
|
||||
action_level: error
|
||||
handler: nested
|
||||
excluded_http_codes: [404, 405]
|
||||
buffer_size: 50 # How many messages should be saved? Prevent memory leaks
|
||||
nested:
|
||||
type: stream
|
||||
path: php://stderr
|
||||
level: debug
|
||||
formatter: monolog.formatter.json
|
||||
console:
|
||||
type: console
|
||||
process_psr_3_messages: false
|
||||
channels: ["!event", "!doctrine"]
|
||||
deprecation:
|
||||
type: stream
|
||||
channels: [deprecation]
|
||||
path: php://stderr
|
||||
formatter: monolog.formatter.json
|
||||
@@ -0,0 +1,12 @@
|
||||
framework:
|
||||
notifier:
|
||||
chatter_transports:
|
||||
texter_transports:
|
||||
channel_policy:
|
||||
# use chat/slack, chat/telegram, sms/twilio or sms/nexmo
|
||||
urgent: ['email']
|
||||
high: ['email']
|
||||
medium: ['email']
|
||||
low: ['email']
|
||||
admin_recipients:
|
||||
- { email: admin@example.com }
|
||||
@@ -0,0 +1,17 @@
|
||||
when@dev:
|
||||
web_profiler:
|
||||
toolbar: true
|
||||
intercept_redirects: false
|
||||
|
||||
framework:
|
||||
profiler:
|
||||
only_exceptions: false
|
||||
collect_serializer_data: true
|
||||
|
||||
when@test:
|
||||
web_profiler:
|
||||
toolbar: false
|
||||
intercept_redirects: false
|
||||
|
||||
framework:
|
||||
profiler: { collect: false }
|
||||
@@ -0,0 +1,8 @@
|
||||
when@dev:
|
||||
web_profiler_wdt:
|
||||
resource: '@WebProfilerBundle/Resources/config/routing/wdt.xml'
|
||||
prefix: /_wdt
|
||||
|
||||
web_profiler_profiler:
|
||||
resource: '@WebProfilerBundle/Resources/config/routing/profiler.xml'
|
||||
prefix: /_profiler
|
||||
@@ -21,11 +21,9 @@ class HomeController extends AbstractController
|
||||
flash()->created(new Book('lord of the rings'));
|
||||
flash()->saved(new Book('harry potter'));
|
||||
|
||||
// flash()->updated();
|
||||
// flash()->deleted();
|
||||
flash()->updated();
|
||||
flash()->deleted();
|
||||
|
||||
return $this->render('home/index.html.twig', [
|
||||
'controller_name' => 'HomeController',
|
||||
]);
|
||||
return $this->render('home/index.html.twig');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,6 +75,30 @@
|
||||
"ref": "fadbfe33303a76e25cb63401050439aa9b1a9c7f"
|
||||
}
|
||||
},
|
||||
"symfony/monolog-bundle": {
|
||||
"version": "3.10",
|
||||
"recipe": {
|
||||
"repo": "github.com/symfony/recipes",
|
||||
"branch": "main",
|
||||
"version": "3.7",
|
||||
"ref": "aff23899c4440dd995907613c1dd709b6f59503f"
|
||||
},
|
||||
"files": [
|
||||
"config/packages/monolog.yaml"
|
||||
]
|
||||
},
|
||||
"symfony/notifier": {
|
||||
"version": "7.0",
|
||||
"recipe": {
|
||||
"repo": "github.com/symfony/recipes",
|
||||
"branch": "main",
|
||||
"version": "5.0",
|
||||
"ref": "178877daf79d2dbd62129dd03612cb1a2cb407cc"
|
||||
},
|
||||
"files": [
|
||||
"config/packages/notifier.yaml"
|
||||
]
|
||||
},
|
||||
"symfony/routing": {
|
||||
"version": "7.0",
|
||||
"recipe": {
|
||||
@@ -114,6 +138,19 @@
|
||||
"templates/base.html.twig"
|
||||
]
|
||||
},
|
||||
"symfony/web-profiler-bundle": {
|
||||
"version": "7.0",
|
||||
"recipe": {
|
||||
"repo": "github.com/symfony/recipes",
|
||||
"branch": "main",
|
||||
"version": "6.1",
|
||||
"ref": "e42b3f0177df239add25373083a564e5ead4e13a"
|
||||
},
|
||||
"files": [
|
||||
"config/packages/web_profiler.yaml",
|
||||
"config/routes/web_profiler.yaml"
|
||||
]
|
||||
},
|
||||
"twig/extra-bundle": {
|
||||
"version": "v3.8.0"
|
||||
}
|
||||
|
||||
+1
-1
@@ -4,4 +4,4 @@
|
||||
npm install --force
|
||||
npm run build
|
||||
bundle exec jekyll serve --livereload
|
||||
```
|
||||
```
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"dist/main.css": "/dist/main.6f6df8ca.css",
|
||||
"dist/main.js": "/dist/main.a8422ec5.js",
|
||||
"dist/main.css": "/dist/main.6f20ecba.css",
|
||||
"dist/main.js": "/dist/main.36e31cce.js",
|
||||
"dist/455.3a7b4474.css": "/dist/455.3a7b4474.css",
|
||||
"dist/455.095e6545.js": "/dist/455.095e6545.js",
|
||||
"dist/411.29cd993e.css": "/dist/411.29cd993e.css",
|
||||
|
||||
@@ -58,13 +58,12 @@
|
||||
</div>
|
||||
|
||||
<blockquote>
|
||||
<p>
|
||||
If you find <strong><span class="text-indigo-900">PHP<span class="text-indigo-500">Flasher</span></span></strong> useful,
|
||||
we would greatly appreciate your support in the form of a <strong>star</strong> rating ⭐
|
||||
on <a href="https://github.com/php-flasher/php-flasher"><i class="fab fa-github text-black"></i> GitHub</a>
|
||||
or by sharing the project on Twitter <a href="http://twitter.com/share?text=I%20really%20like%20this%20nice%20PHP%20package%2C%20that%20allows%20you%20to%20implement%20flash%20notifications%20in%20your%20app%20fast%20%F0%9F%9A%80%0A%0A%E2%86%92%20https%3A%2F%2Fphp-flasher.io%20by%20%40yoeunes%0A%0A%23php%20%23laravel%20%23symfony%20%23opensource"><i class="fab fa-twitter"></i> click here</a>.
|
||||
Your feedback helps us keep the package up-to-date and well-maintained. <strong>Thank you</strong> <i class="fa-solid fa-heart text-red-600"></i>
|
||||
</p>
|
||||
<p>
|
||||
If you find <strong><span class="text-indigo-900">PHP<span class="text-indigo-500">Flasher</span></span></strong> useful,
|
||||
please consider giving it a <strong>⭐ star</strong> on <a href="https://github.com/php-flasher/php-flasher"><i class="fab fa-github text-black"></i> GitHub</a> 😊.
|
||||
If you spot any typos or have suggestions, feel free to contribute to the documentation 📝.
|
||||
Your feedback helps keep the project up-to-date and well-maintained. <strong>Thank you</strong> <i class="fa-solid fa-heart text-red-600"></i>
|
||||
</p>
|
||||
</blockquote>
|
||||
|
||||
<hr>
|
||||
|
||||
Vendored
+2
-2
@@ -2,10 +2,10 @@
|
||||
"entrypoints": {
|
||||
"main": {
|
||||
"css": [
|
||||
"/dist/main.6f6df8ca.css"
|
||||
"/dist/main.6f20ecba.css"
|
||||
],
|
||||
"js": [
|
||||
"/dist/main.a8422ec5.js"
|
||||
"/dist/main.36e31cce.js"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Generated
+406
-2346
File diff suppressed because it is too large
Load Diff
+3
-3
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@flasher/docs",
|
||||
"version": "2.0.0",
|
||||
"version": "2.1.0",
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
"build": "cross-env NODE_ENV=production encore production --progress",
|
||||
@@ -17,7 +17,7 @@
|
||||
"@flasher/flasher-toastr": "file:../src/Toastr/Prime/Resources",
|
||||
"@hotwired/stimulus": "^3.2.2",
|
||||
"@symfony/stimulus-bridge": "^3.2.2",
|
||||
"@symfony/webpack-encore": "^4.7.0",
|
||||
"@symfony/webpack-encore": "^5.0.1",
|
||||
"noty": "^3.2.0-beta-deprecated",
|
||||
"notyf": "^3.10.0",
|
||||
"prismjs": "^1.29.0",
|
||||
@@ -30,7 +30,7 @@
|
||||
"node-ray": "^2.1.2",
|
||||
"postcss-import": "^16.1.0",
|
||||
"postcss-loader": "^7.3.4",
|
||||
"tailwindcss": "^3.4.12",
|
||||
"tailwindcss": "^3.4.14",
|
||||
"webpack-notifier": "^1.15.0"
|
||||
},
|
||||
"browserslist": [
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
---
|
||||
permalink: /
|
||||
description: PHPFlasher is an open-source tool for easily adding flash messages to Laravel or Symfony projects, improving user interaction with minimal effort.
|
||||
description: PHPFlasher is an open-source tool that makes it easy to add flash messages to your Laravel or Symfony projects. Improve user interaction with minimal effort using simple, customizable notifications.
|
||||
data-controller: flasher
|
||||
---
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
permalink: /inertia/
|
||||
title: Inertia
|
||||
description: Easily add flash notification messages to your Inertia application with PHPFlasher. Follow our step-by-step guide to install and use the library in your project, and start engaging and informing your users with powerful flash messages.
|
||||
description: Discover how to integrate flash notifications into your Inertia.js application with PHPFlasher. Follow this guide to set up the library and enhance your user interface with dynamic messages.
|
||||
---
|
||||
|
||||
<strong><span class="text-indigo-900">PHP<span class="text-indigo-500">Flasher</span></span></strong> works well with Inertia.js.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
permalink: /installation/
|
||||
title: Installation
|
||||
description: Install only the specific components you need for your project with PHPFlasher, a modular PHP library for displaying flash notification messages. Simply include the library in your composer.json file and run the composer install command to get started.
|
||||
description: Install PHPFlasher in your project easily. It’s modular, so you can install only the parts you need. Just include the library in your composer.json file and run composer install to get started.
|
||||
---
|
||||
|
||||
**<span class="text-indigo-900">PHP<span class="text-indigo-500">Flasher</span></span>** is modular and consists of multiple libraries,
|
||||
|
||||
+28
-19
@@ -2,7 +2,7 @@
|
||||
permalink: /laravel/
|
||||
title: Laravel
|
||||
handler: flasher
|
||||
description: Easily add flash notification messages to your Laravel application with PHPFlasher. Follow our step-by-step guide to install and use the library in your project, and start engaging and informing your users with powerful flash messages.
|
||||
description: Add flash notifications to your Laravel application with PHPFlasher. Follow our step-by-step guide to install and use the library, and start informing your users with powerful flash messages.
|
||||
framework: laravel
|
||||
---
|
||||
|
||||
@@ -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',
|
||||
// ],
|
||||
// ],
|
||||
];
|
||||
|
||||
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
permalink: /library/noty/
|
||||
title: Noty
|
||||
description: Elevate your user experience with Noty, a popular JavaScript library for creating customizable, stylish notification messages. Easy to install and use, Noty is perfect for any project that wants to engage and inform users in a dynamic way.
|
||||
description: Enhance your user experience with Noty, a JavaScript library for creating customizable notification messages. Learn how to use Noty with PHPFlasher to display stylish notifications in your project.
|
||||
handler: noty
|
||||
data-controller: noty
|
||||
---
|
||||
@@ -22,6 +22,8 @@ php artisan flasher:install
|
||||
|
||||
<p id="laravel-configuration"><a href="#laravel-configuration" class="anchor"><i class="fa-duotone fa-link"></i> Configuration</a></p>
|
||||
|
||||
> <strong>Note:</strong> The configuration settings below are the default ones. You only need to change them if you want to customize the default behavior.
|
||||
|
||||
```php
|
||||
<?php // config/flasher.php
|
||||
|
||||
@@ -38,7 +40,7 @@ return [
|
||||
],
|
||||
'options' => [
|
||||
// Optional: Add global options here
|
||||
'layout' => 'topRight'
|
||||
// 'layout' => 'topRight'
|
||||
],
|
||||
],
|
||||
],
|
||||
@@ -62,6 +64,8 @@ php bin/console flasher:install
|
||||
|
||||
<p id="symfony-configuration"><a href="#symfony-configuration" class="anchor"><i class="fa-duotone fa-link"></i> Configuration</a></p>
|
||||
|
||||
> <strong>Note:</strong> The configuration settings below are the default ones. You only need to change them if you want to customize the default behavior.
|
||||
|
||||
```yaml
|
||||
# config/packages/flasher.yaml
|
||||
|
||||
@@ -76,7 +80,7 @@ flasher:
|
||||
- '/vendor/flasher/mint.css'
|
||||
options:
|
||||
# Optional: Add global options here
|
||||
layout: topRight
|
||||
# layout: topRight
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
permalink: /library/notyf/
|
||||
title: Notyf
|
||||
description: Add lightweight, customizable notification messages to your web projects with Notyf, a popular JavaScript library. With a focus on simplicity and accessibility, Notyf is easy to install and use, making it a great choice for any project that wants to engage and inform users.
|
||||
description: Add lightweight, customizable notifications to your web projects with Notyf. This guide shows you how to integrate Notyf with PHPFlasher to engage and inform your users effectively.
|
||||
handler: notyf
|
||||
data-controller: notyf
|
||||
---
|
||||
@@ -23,6 +23,8 @@ php artisan flasher:install
|
||||
|
||||
<p id="laravel-configuration"><a href="#laravel-configuration" class="anchor"><i class="fa-duotone fa-link"></i> Configuration</a></p>
|
||||
|
||||
> <strong>Note:</strong> The configuration settings below are the default ones. You only need to change them if you want to customize the default behavior.
|
||||
|
||||
```php
|
||||
<?php // config/flasher.php
|
||||
|
||||
@@ -37,7 +39,7 @@ return [
|
||||
],
|
||||
'options' => [
|
||||
// Optional: Add global options here
|
||||
'dismissible' => true,
|
||||
// 'dismissible' => true,
|
||||
],
|
||||
],
|
||||
],
|
||||
@@ -60,6 +62,8 @@ php bin/console flasher:install
|
||||
|
||||
<p id="symfony-configuration"><a href="#symfony-configuration" class="anchor"><i class="fa-duotone fa-link"></i> Configuration</a></p>
|
||||
|
||||
> <strong>Note:</strong> The configuration settings below are the default ones. You only need to change them if you want to customize the default behavior.
|
||||
|
||||
```yaml
|
||||
# config/packages/flasher.yaml
|
||||
|
||||
@@ -72,7 +76,7 @@ flasher:
|
||||
- '/vendor/flasher/flasher-notyf.min.css'
|
||||
options:
|
||||
# Optional: Add global options here
|
||||
dismissible: true
|
||||
# dismissible: true
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
permalink: /library/sweetalert/
|
||||
title: Sweetalert
|
||||
description: Add beautiful, customizable alert messages to your web projects with SweetAlert2, a popular JavaScript library. Easy to install and use, SweetAlert2 is perfect for any project that wants to engage and inform users in a visually appealing way.
|
||||
description: Integrate beautiful alert messages into your web projects with SweetAlert2. This guide demonstrates how to use SweetAlert2 with PHPFlasher to inform users in a visually appealing way.
|
||||
handler: sweetalert
|
||||
data-controller: sweetalert
|
||||
---
|
||||
@@ -22,6 +22,8 @@ php artisan flasher:install
|
||||
|
||||
<p id="laravel-configuration"><a href="#laravel-configuration" class="anchor"><i class="fa-duotone fa-link"></i> Configuration</a></p>
|
||||
|
||||
> <strong>Note:</strong> The configuration settings below are the default ones. You only need to change them if you want to customize the default behavior.
|
||||
|
||||
```php
|
||||
<?php // config/flasher.php
|
||||
|
||||
@@ -37,7 +39,7 @@ return [
|
||||
],
|
||||
'options' => [
|
||||
// Optional: Add global options here
|
||||
'position' => 'center'
|
||||
// 'position' => 'center'
|
||||
],
|
||||
],
|
||||
],
|
||||
@@ -61,6 +63,8 @@ php bin/console flasher:install
|
||||
|
||||
<p id="symfony-configuration"><a href="#symfony-configuration" class="anchor"><i class="fa-duotone fa-link"></i> Configuration</a></p>
|
||||
|
||||
> <strong>Note:</strong> The configuration settings below are the default ones. You only need to change them if you want to customize the default behavior.
|
||||
|
||||
```yaml
|
||||
# config/packages/flasher.yaml
|
||||
|
||||
@@ -74,7 +78,7 @@ flasher:
|
||||
- '/vendor/flasher/sweetalert2.min.css'
|
||||
options:
|
||||
# Optional: Add global options here
|
||||
position: center
|
||||
# position: center
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
permalink: /library/toastr/
|
||||
title: Toastr
|
||||
description: Easily add customizable, stylish notification messages to your web projects with Toastr, a popular JavaScript library. With a focus on simplicity and flexibility, Toastr is easy to install and use, making it a great choice for any project that wants to engage and inform users.
|
||||
description: Use Toastr with PHPFlasher to add stylish notifications to your web projects. Improve user engagement with easy-to-use, customizable notification messages.
|
||||
handler: toastr
|
||||
data-controller: toastr
|
||||
---
|
||||
@@ -22,6 +22,8 @@ php artisan flasher:install
|
||||
|
||||
<p id="laravel-configuration"><a href="#laravel-configuration" class="anchor"><i class="fa-duotone fa-link"></i> Configuration</a></p>
|
||||
|
||||
> <strong>Note:</strong> The configuration settings below are the default ones. You only need to change them if you want to customize the default behavior.
|
||||
|
||||
```php
|
||||
<?php // config/flasher.php
|
||||
|
||||
@@ -38,7 +40,7 @@ return [
|
||||
],
|
||||
'options' => [
|
||||
// Optional: Add global options here
|
||||
'closeButton' => true
|
||||
// 'closeButton' => true
|
||||
],
|
||||
],
|
||||
],
|
||||
@@ -63,6 +65,8 @@ php bin/console flasher:install
|
||||
|
||||
<p id="symfony-configuration"><a href="#symfony-configuration" class="anchor"><i class="fa-duotone fa-link"></i> Configuration</a></p>
|
||||
|
||||
> <strong>Note:</strong> The configuration settings below are the default ones. You only need to change them if you want to customize the default behavior.
|
||||
|
||||
```yaml
|
||||
# config/packages/flasher.yaml
|
||||
|
||||
@@ -77,7 +81,7 @@ flasher:
|
||||
- '/vendor/flasher/toastr.min.css'
|
||||
options:
|
||||
# Optional: Add global options here
|
||||
closeButton: true
|
||||
# closeButton: true
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
permalink: /livewire/
|
||||
title: Livewire
|
||||
description: Learn how to easily add flash notification messages to your Livewire application with PHPFlasher. Follow our step-by-step guide to install and use the library in your project, and start engaging and informing your users with powerful flash messages.
|
||||
description: Learn how to add flash notifications to your Livewire application using PHPFlasher. This guide walks you through installation and usage, so you can engage your users with informative messages.
|
||||
adapter: flasher
|
||||
---
|
||||
|
||||
|
||||
+37
-23
@@ -1,7 +1,7 @@
|
||||
---
|
||||
permalink: /symfony/
|
||||
title: Symfony
|
||||
description: Integrate PHPFlasher in your Symfony application to enhance user experience with flash notifications. This open-source package simplifies the addition of engaging messages following user actions.
|
||||
description: Integrate PHPFlasher into your Symfony application to enhance user experience with flash notifications. This guide shows you how to add engaging messages after user actions using PHPFlasher in Symfony.
|
||||
framework: symfony
|
||||
---
|
||||
|
||||
@@ -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
|
||||
|
||||
# Automatically inject PHPFlasher assets in HTML response
|
||||
# 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 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']
|
||||
success: ['success']
|
||||
error: ['error', 'danger']
|
||||
warning: ['warning', 'alarm']
|
||||
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
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
@@ -8,4 +8,6 @@ return static function (MBConfig $config) {
|
||||
$config->packageDirectories([
|
||||
__DIR__.'/src',
|
||||
]);
|
||||
|
||||
$config->packageAliasFormat('2.x-dev');
|
||||
};
|
||||
|
||||
Generated
+3543
-3339
File diff suppressed because it is too large
Load Diff
+17
-17
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@flasher/php-flasher",
|
||||
"type": "module",
|
||||
"version": "2.0.0",
|
||||
"version": "2.1.1",
|
||||
"license": "MIT",
|
||||
"workspaces": [
|
||||
"src/Prime/Resources",
|
||||
@@ -18,42 +18,42 @@
|
||||
"ncu": "ncu -u && npm run ncu --workspaces"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@antfu/eslint-config": "2.12.2",
|
||||
"@babel/core": "^7.25.2",
|
||||
"@babel/preset-env": "^7.25.4",
|
||||
"@antfu/eslint-config": "^2.27.3",
|
||||
"@babel/core": "^7.25.8",
|
||||
"@babel/preset-env": "^7.25.8",
|
||||
"@rollup/plugin-babel": "^6.0.4",
|
||||
"@rollup/plugin-commonjs": "^25.0.8",
|
||||
"@rollup/plugin-eslint": "^9.0.5",
|
||||
"@rollup/plugin-node-resolve": "^15.2.3",
|
||||
"@rollup/plugin-node-resolve": "^15.3.0",
|
||||
"@rollup/plugin-terser": "^0.4.4",
|
||||
"@rollup/plugin-typescript": "^11.1.6",
|
||||
"@types/node": "^20.16.5",
|
||||
"@typescript-eslint/eslint-plugin": "7.5.0",
|
||||
"@types/node": "^20.16.13",
|
||||
"@typescript-eslint/eslint-plugin": "^7.18.0",
|
||||
"@typescript-eslint/parser": "^7.18.0",
|
||||
"all-contributors-cli": "^6.26.1",
|
||||
"autoprefixer": "^10.4.20",
|
||||
"browserslist": "^4.23.3",
|
||||
"cross-env": "7.0.3",
|
||||
"browserslist": "^4.24.0",
|
||||
"cross-env": "^7.0.3",
|
||||
"cssnano": "^6.1.2",
|
||||
"eslint": "^8.57.1",
|
||||
"eslint-config-airbnb-typescript": "^18.0.0",
|
||||
"eslint-config-prettier": "^9.1.0",
|
||||
"eslint-import-resolver-typescript": "^3.6.3",
|
||||
"eslint-plugin-babel": "5.3.1",
|
||||
"eslint-plugin-import": "^2.30.0",
|
||||
"eslint-plugin-babel": "^5.3.1",
|
||||
"eslint-plugin-import": "^2.31.0",
|
||||
"eslint-plugin-prettier": "^5.2.1",
|
||||
"postcss-discard-comments": "^6.0.2",
|
||||
"punycode": "2.3.1",
|
||||
"rollup": "^4.22.4",
|
||||
"punycode": "^2.3.1",
|
||||
"rollup": "^4.24.0",
|
||||
"rollup-plugin-cleanup": "^3.2.1",
|
||||
"rollup-plugin-clear": "^2.0.7",
|
||||
"rollup-plugin-copy": "3.5.0",
|
||||
"rollup-plugin-copy": "^3.5.0",
|
||||
"rollup-plugin-filesize": "^10.0.0",
|
||||
"rollup-plugin-postcss": "^4.0.2",
|
||||
"rollup-plugin-progress": "^1.1.2",
|
||||
"sass": "^1.79.3",
|
||||
"sass": "^1.80.3",
|
||||
"ts-node": "^10.9.2",
|
||||
"tslib": "^2.7.0",
|
||||
"typescript": "^5.6.2"
|
||||
"tslib": "^2.8.0",
|
||||
"typescript": "^5.6.3"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,9 +35,9 @@ use Flasher\Prime\Storage\Storage;
|
||||
use Flasher\Prime\Storage\StorageManager;
|
||||
use Illuminate\Container\Container;
|
||||
use Illuminate\Contracts\Events\Dispatcher;
|
||||
use Illuminate\Contracts\Http\Kernel as HttpKernel;
|
||||
use Illuminate\Foundation\Application;
|
||||
use Illuminate\Foundation\Console\AboutCommand;
|
||||
use Illuminate\Foundation\Http\Kernel as HttpKernel;
|
||||
use Illuminate\View\Compilers\BladeCompiler;
|
||||
use Laravel\Octane\Events\RequestReceived;
|
||||
use Livewire\LivewireManager;
|
||||
@@ -227,32 +227,18 @@ final class FlasherServiceProvider extends PluginServiceProvider
|
||||
}
|
||||
|
||||
$this->app->singleton(FlasherMiddleware::class, static function (Application $app) {
|
||||
$config = $app->make('config');
|
||||
|
||||
$flasher = $app->make('flasher');
|
||||
$cspHandler = $app->make('flasher.csp_handler');
|
||||
$excludedPaths = $config->get('flasher.excluded_paths', []) ?: [];
|
||||
|
||||
return new FlasherMiddleware(new ResponseExtension($flasher, $cspHandler));
|
||||
return new FlasherMiddleware(new ResponseExtension($flasher, $cspHandler, $excludedPaths));
|
||||
});
|
||||
|
||||
$this->pushMiddlewareToGroup(FlasherMiddleware::class);
|
||||
}
|
||||
|
||||
private function registerCspHandler(): void
|
||||
{
|
||||
$this->app->singleton('flasher.csp_handler', static function () {
|
||||
return new ContentSecurityPolicyHandler(new NonceGenerator());
|
||||
});
|
||||
}
|
||||
|
||||
private function registerAssetManager(): void
|
||||
{
|
||||
$this->app->singleton('flasher.asset_manager', static function () {
|
||||
$publicDir = public_path('/');
|
||||
$manifestPath = public_path('vendor'.\DIRECTORY_SEPARATOR.'flasher'.\DIRECTORY_SEPARATOR.'manifest.json');
|
||||
|
||||
return new AssetManager($publicDir, $manifestPath);
|
||||
});
|
||||
}
|
||||
|
||||
private function registerSessionMiddleware(): void
|
||||
{
|
||||
if (!$this->getConfig('flash_bag')) {
|
||||
@@ -278,6 +264,23 @@ final class FlasherServiceProvider extends PluginServiceProvider
|
||||
});
|
||||
}
|
||||
|
||||
private function registerCspHandler(): void
|
||||
{
|
||||
$this->app->singleton('flasher.csp_handler', static function () {
|
||||
return new ContentSecurityPolicyHandler(new NonceGenerator());
|
||||
});
|
||||
}
|
||||
|
||||
private function registerAssetManager(): void
|
||||
{
|
||||
$this->app->singleton('flasher.asset_manager', static function () {
|
||||
$publicDir = public_path('/');
|
||||
$manifestPath = public_path('vendor'.\DIRECTORY_SEPARATOR.'flasher'.\DIRECTORY_SEPARATOR.'manifest.json');
|
||||
|
||||
return new AssetManager($publicDir, $manifestPath);
|
||||
});
|
||||
}
|
||||
|
||||
private function registerBladeDirectives(BladeCompiler $blade): void
|
||||
{
|
||||
$blade->directive('flasher_render', function (string $expression = '') {
|
||||
|
||||
@@ -14,6 +14,11 @@ final readonly class Request implements RequestInterface
|
||||
{
|
||||
}
|
||||
|
||||
public function getUri(): string
|
||||
{
|
||||
return $this->request->getUri();
|
||||
}
|
||||
|
||||
public function isXmlHttpRequest(): bool
|
||||
{
|
||||
return $this->request->ajax();
|
||||
|
||||
@@ -13,6 +13,7 @@ namespace Illuminate\Contracts\Config;
|
||||
* scripts: string[],
|
||||
* styles: string[],
|
||||
* options: array<string, mixed>,
|
||||
* excluded_paths?: list<non-empty-string>,
|
||||
* filter: array<string, mixed>,
|
||||
* flash_bag: array<string, string[]>,
|
||||
* presets: array<string, PresetType>,
|
||||
@@ -44,7 +45,8 @@ interface Repository
|
||||
* ($key is 'flasher.presets' ? array<string, PresetType> :
|
||||
* ($key is 'flasher.plugins' ? array<string, PluginType> :
|
||||
* ($key is 'flasher.flash_bag' ? array<string, string[]> :
|
||||
* mixed)))))))
|
||||
* ($key is 'flasher.excluded_paths' ? list<non-empty-string> :
|
||||
* mixed))))))))
|
||||
*/
|
||||
public function get(string|array $key, mixed $default = null): mixed;
|
||||
}
|
||||
|
||||
@@ -114,7 +114,7 @@ flash()
|
||||
<table>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td align="center" valign="top" width="14.28%"><a href="https://www.linkedin.com/in/younes-ennaji/"><img src="https://avatars.githubusercontent.com/u/10859693?v=4?s=100" width="100px;" alt="Younes ENNAJI"/><br /><sub><b>Younes ENNAJI</b></sub></a><br /><a href="https://github.com/php-flasher/php-flasher/commits?author=yoeunes" title="Code">💻</a> <a href="https://github.com/php-flasher/php-flasher/commits?author=yoeunes" title="Documentation">📖</a> <a href="#maintenance-yoeunes" title="Maintenance">🚧</a></td>
|
||||
<td align="center" valign="top" width="14.28%"><a href="https://www.linkedin.com/in/younes--ennaji/"><img src="https://avatars.githubusercontent.com/u/10859693?v=4?s=100" width="100px;" alt="Younes ENNAJI"/><br /><sub><b>Younes ENNAJI</b></sub></a><br /><a href="https://github.com/php-flasher/php-flasher/commits?author=yoeunes" title="Code">💻</a> <a href="https://github.com/php-flasher/php-flasher/commits?author=yoeunes" title="Documentation">📖</a> <a href="#maintenance-yoeunes" title="Maintenance">🚧</a></td>
|
||||
<td align="center" valign="top" width="14.28%"><a href="https://github.com/salmayno"><img src="https://avatars.githubusercontent.com/u/27933199?v=4?s=100" width="100px;" alt="Salma Mourad"/><br /><sub><b>Salma Mourad</b></sub></a><br /><a href="#financial-salmayno" title="Financial">💵</a></td>
|
||||
<td align="center" valign="top" width="14.28%"><a href="https://www.youtube.com/rstacode"><img src="https://avatars.githubusercontent.com/u/35005761?v=4?s=100" width="100px;" alt="Nashwan Abdullah"/><br /><sub><b>Nashwan Abdullah</b></sub></a><br /><a href="#financial-codenashwan" title="Financial">💵</a></td>
|
||||
<td align="center" valign="top" width="14.28%"><a href="https://darvis.nl/"><img src="https://avatars.githubusercontent.com/u/7394837?v=4?s=100" width="100px;" alt="Arvid de Jong"/><br /><sub><b>Arvid de Jong</b></sub></a><br /><a href="#financial-darviscommerce" title="Financial">💵</a></td>
|
||||
|
||||
@@ -2,34 +2,36 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Flasher\Laravel\Resources;
|
||||
use Flasher\Prime\Configuration;
|
||||
|
||||
return [
|
||||
// Default notification library (e.g., 'flasher', 'toastr', 'noty', etc.)
|
||||
return Configuration::from([
|
||||
// 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 +39,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',
|
||||
// ],
|
||||
// ],
|
||||
]);
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
"require": {
|
||||
"php": ">=8.2",
|
||||
"illuminate/support": "^11.0",
|
||||
"php-flasher/flasher": "^2.0.1"
|
||||
"php-flasher/flasher": "^2.1.1"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
|
||||
@@ -28,8 +28,8 @@
|
||||
"prefer-stable": true,
|
||||
"require": {
|
||||
"php": ">=8.2",
|
||||
"php-flasher/flasher-laravel": "^2.0.1",
|
||||
"php-flasher/flasher-noty": "^2.0.1"
|
||||
"php-flasher/flasher-laravel": "^2.1.1",
|
||||
"php-flasher/flasher-noty": "^2.1.1"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
|
||||
+130
-13
@@ -4,10 +4,110 @@ declare(strict_types=1);
|
||||
|
||||
namespace Flasher\Noty\Prime;
|
||||
|
||||
use Flasher\Prime\Notification\Envelope;
|
||||
use Flasher\Prime\Notification\NotificationBuilder;
|
||||
|
||||
/**
|
||||
* @phpstan-type NotificationType "success"|"info"|"warning"|"error"|"alert"|"information"
|
||||
* @phpstan-type OptionsType array{
|
||||
* layout?: "top"|"topLeft"|"topCenter"|"topRight"|"center"|"centerLeft"|"centerRight"|"bottom"|"bottomLeft"|"bottomCenter"|"bottomRight",
|
||||
* theme?: "relax"|"mint"|"metroui",
|
||||
* timeout?: false|int,
|
||||
* progressBar?: bool,
|
||||
* closeWith?: string[],
|
||||
* animation?: array{
|
||||
* open?: string|null,
|
||||
* close?: string|null,
|
||||
* },
|
||||
* sounds?: array{
|
||||
* sources?: string[],
|
||||
* volume?: int,
|
||||
* conditions?: string[],
|
||||
* },
|
||||
* docTitle?: array{
|
||||
* conditions?: string[],
|
||||
* },
|
||||
* modal?: bool,
|
||||
* id?: bool|string,
|
||||
* force?: bool,
|
||||
* queue?: string,
|
||||
* killer?: bool|string,
|
||||
* container?: false|string,
|
||||
* buttons?: string[],
|
||||
* visibilityControl?: bool,
|
||||
* }
|
||||
*/
|
||||
final class NotyBuilder extends NotificationBuilder
|
||||
{
|
||||
/**
|
||||
* @phpstan-param NotificationType $type
|
||||
*/
|
||||
public function type(string $type): static
|
||||
{
|
||||
return parent::type($type);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param OptionsType $options
|
||||
*/
|
||||
public function success(string $message, array $options = [], ?string $title = null): Envelope
|
||||
{
|
||||
return parent::success($message, $options, $title);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param OptionsType $options
|
||||
*/
|
||||
public function error(string $message, array $options = [], ?string $title = null): Envelope
|
||||
{
|
||||
return parent::error($message, $options, $title);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param OptionsType $options
|
||||
*/
|
||||
public function info(string $message, array $options = [], ?string $title = null): Envelope
|
||||
{
|
||||
return parent::info($message, $options, $title);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param OptionsType $options
|
||||
*/
|
||||
public function warning(string $message, array $options = [], ?string $title = null): Envelope
|
||||
{
|
||||
return parent::warning($message, $options, $title);
|
||||
}
|
||||
|
||||
/**
|
||||
* @phpstan-param NotificationType $type
|
||||
* @phpstan-param OptionsType $options
|
||||
*/
|
||||
public function flash(?string $type = null, ?string $message = null, array $options = [], ?string $title = null): Envelope
|
||||
{
|
||||
return parent::flash($type, $message, $options, $title);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param OptionsType $options
|
||||
*/
|
||||
public function options(array $options, bool $append = true): static
|
||||
{
|
||||
return parent::options($options, $append);
|
||||
}
|
||||
|
||||
/**
|
||||
* @template T of OptionsType
|
||||
* @template K of key-of<T>
|
||||
*
|
||||
* @phpstan-param K $name
|
||||
* @phpstan-param T[K] $value
|
||||
*/
|
||||
public function option(string $name, mixed $value): static
|
||||
{
|
||||
return parent::option($name, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* This string can contain HTML too. But be careful and don't pass user inputs to this parameter.
|
||||
*/
|
||||
@@ -17,7 +117,7 @@ final class NotyBuilder extends NotificationBuilder
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<string, mixed> $options
|
||||
* @param OptionsType $options
|
||||
*/
|
||||
public function alert(?string $message = null, ?string $title = null, array $options = []): self
|
||||
{
|
||||
@@ -39,7 +139,7 @@ final class NotyBuilder extends NotificationBuilder
|
||||
}
|
||||
|
||||
/**
|
||||
* @param "top"|"topLeft"|"topCenter"|"topRight"|"center"|"centerLeft"|"centerRight"|"bottom"|"bottomLeft"|"bottomCenter"|"bottomRight" $layout
|
||||
* @phpstan-param OptionsType['layout'] $layout
|
||||
*
|
||||
* - ClassName generator uses this value → noty_layout__${layout}
|
||||
*/
|
||||
@@ -51,7 +151,7 @@ final class NotyBuilder extends NotificationBuilder
|
||||
}
|
||||
|
||||
/**
|
||||
* @param "relax"|"mint"|"metroui" $theme
|
||||
* @phpstan-param OptionsType['theme'] $theme
|
||||
*
|
||||
* ClassName generator uses this value → noty_theme__${theme}
|
||||
*/
|
||||
@@ -65,7 +165,7 @@ final class NotyBuilder extends NotificationBuilder
|
||||
/**
|
||||
* false, 1000, 3000, 3500, etc. Delay for closing event in milliseconds (ms). Set 'false' for sticky notifications.
|
||||
*/
|
||||
public function timeout(bool|int $timeout): self
|
||||
public function timeout(false|int $timeout): self
|
||||
{
|
||||
$this->option('timeout', $timeout);
|
||||
|
||||
@@ -95,35 +195,52 @@ final class NotyBuilder extends NotificationBuilder
|
||||
}
|
||||
|
||||
/**
|
||||
* @param "open"|"close" $animation
|
||||
* @param "open"|"close" $option
|
||||
* @param "noty_effects_open"|"noty_effects_close"|string $effect
|
||||
*
|
||||
* If string, assumed to be CSS class name. If null, no animation at all. If function, runs the function. (v3.0.1+)
|
||||
* You can use animate.css class names or your custom css animations as well.
|
||||
*/
|
||||
public function animation(string $animation, string $effect): self
|
||||
public function animation(string $option, string $effect): self
|
||||
{
|
||||
$this->option('animation.'.$animation, $effect);
|
||||
/** @phpstan-var OptionsType['animation'] $animation */
|
||||
$animation = $this->getEnvelope()->getOption('animation', []);
|
||||
$animation[$option] = $effect;
|
||||
|
||||
$this->option('animation', $animation);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param "sources"|"volume"|"conditions" $option
|
||||
* @phpstan-param "sources"|"volume"|"conditions" $option
|
||||
* @phpstan-param ($option is "sources" ? string[] :
|
||||
* ($option is "volume" ? int :
|
||||
* ($option is "conditions" ? string[] :
|
||||
* mixed))) $value
|
||||
*/
|
||||
public function sounds(string $option, mixed $value): self
|
||||
{
|
||||
$this->option('sounds.'.$option, $value);
|
||||
/** @phpstan-var OptionsType['sounds'] $sounds */
|
||||
$sounds = $this->getEnvelope()->getOption('sounds', []);
|
||||
$sounds[$option] = $value;
|
||||
|
||||
$this->option('sounds', $sounds); // @phpstan-ignore-line
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param "conditions"|string $option
|
||||
* @phpstan-param "conditions"|string $option
|
||||
* @phpstan-param ($option is "conditions" ? string[] : mixed) $value
|
||||
*/
|
||||
public function docTitle(string $option, string $docTitle): self
|
||||
public function docTitle(string $option, mixed $value): self
|
||||
{
|
||||
$this->option('docTitle'.$option, $docTitle);
|
||||
/** @phpstan-var OptionsType['docTitle'] $docTitle */
|
||||
$docTitle = $this->getEnvelope()->getOption('docTitle', []);
|
||||
$docTitle[$option] = $value;
|
||||
|
||||
$this->option('docTitle', $docTitle); // @phpstan-ignore-line
|
||||
|
||||
return $this;
|
||||
}
|
||||
@@ -176,7 +293,7 @@ final class NotyBuilder extends NotificationBuilder
|
||||
/**
|
||||
* Custom container selector string. Like '.my-custom-container'. Layout parameter will be ignored.
|
||||
*/
|
||||
public function container(bool|string $container): self
|
||||
public function container(false|string $container): self
|
||||
{
|
||||
$this->option('container', $container);
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@flasher/flasher-noty",
|
||||
"version": "2.0.0",
|
||||
"version": "2.1.1",
|
||||
"type": "module",
|
||||
"license": "MIT",
|
||||
"main": "dist/flasher-noty.cjs.js",
|
||||
@@ -11,7 +11,7 @@
|
||||
"ncu": "ncu -u"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@flasher/flasher": "^2.0.0",
|
||||
"@flasher/flasher": "^2.1.1",
|
||||
"noty": "^3.2.0-beta-deprecated"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
"prefer-stable": true,
|
||||
"require": {
|
||||
"php": ">=8.2",
|
||||
"php-flasher/flasher": "^2.0.1"
|
||||
"php-flasher/flasher": "^2.1.1"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
|
||||
@@ -16,10 +16,36 @@ if (!\function_exists('Flasher\Noty\Prime\noty')) {
|
||||
* When called with no arguments, it returns an instance of NotyInterface.
|
||||
* When called with arguments, it creates a Noty notification and returns an Envelope.
|
||||
*
|
||||
* @param string|null $message the message content of the notification
|
||||
* @param string $type The type of the notification (e.g., success, error, warning, info).
|
||||
* @param array<string, mixed> $options additional options for the Noty notification
|
||||
* @param string|null $title the title of the notification
|
||||
* @param string|null $message the message content of the notification
|
||||
* @param "success"|"info"|"warning"|"error"|"alert"|"information" $type The type of the notification (e.g., success, error, warning, info).
|
||||
* @param array{
|
||||
* layout?: "top"|"topLeft"|"topCenter"|"topRight"|"center"|"centerLeft"|"centerRight"|"bottom"|"bottomLeft"|"bottomCenter"|"bottomRight",
|
||||
* theme?: "relax"|"mint"|"metroui",
|
||||
* timeout?: false|int,
|
||||
* progressBar?: bool,
|
||||
* closeWith?: string[],
|
||||
* animation?: array{
|
||||
* open?: string|null,
|
||||
* close?: string|null,
|
||||
* },
|
||||
* sounds?: array{
|
||||
* sources?: string[],
|
||||
* volume?: int,
|
||||
* conditions?: string[],
|
||||
* },
|
||||
* docTitle?: array{
|
||||
* conditions?: string[],
|
||||
* },
|
||||
* modal?: bool,
|
||||
* id?: bool|string,
|
||||
* force?: bool,
|
||||
* queue?: string,
|
||||
* killer?: bool|string,
|
||||
* container?: false|string,
|
||||
* buttons?: string[],
|
||||
* visibilityControl?: bool,
|
||||
* } $options additional options for the Noty notification
|
||||
* @param string|null $title the title of the notification
|
||||
*
|
||||
* @return Envelope|NotyInterface Returns an Envelope containing the notification details when arguments are provided.
|
||||
* Returns an instance of NotyInterface when no arguments are provided.
|
||||
|
||||
@@ -15,10 +15,36 @@ if (!function_exists('noty')) {
|
||||
* When called with no arguments, it returns an instance of NotyInterface.
|
||||
* When called with arguments, it creates a Noty notification and returns an Envelope.
|
||||
*
|
||||
* @param string|null $message the message content of the notification
|
||||
* @param string $type The type of the notification (e.g., success, error, warning, info).
|
||||
* @param array<string, mixed> $options additional options for the Noty notification
|
||||
* @param string|null $title the title of the notification
|
||||
* @param string|null $message the message content of the notification
|
||||
* @param "success"|"info"|"warning"|"error"|"alert"|"information" $type The type of the notification (e.g., success, error, warning, info).
|
||||
* @param array{
|
||||
* layout?: "top"|"topLeft"|"topCenter"|"topRight"|"center"|"centerLeft"|"centerRight"|"bottom"|"bottomLeft"|"bottomCenter"|"bottomRight",
|
||||
* theme?: "relax"|"mint"|"metroui",
|
||||
* timeout?: false|int,
|
||||
* progressBar?: bool,
|
||||
* closeWith?: string[],
|
||||
* animation?: array{
|
||||
* open?: string|null,
|
||||
* close?: string|null,
|
||||
* },
|
||||
* sounds?: array{
|
||||
* sources?: string[],
|
||||
* volume?: int,
|
||||
* conditions?: string[],
|
||||
* },
|
||||
* docTitle?: array{
|
||||
* conditions?: string[],
|
||||
* },
|
||||
* modal?: bool,
|
||||
* id?: bool|string,
|
||||
* force?: bool,
|
||||
* queue?: string,
|
||||
* killer?: bool|string,
|
||||
* container?: false|string,
|
||||
* buttons?: string[],
|
||||
* visibilityControl?: bool,
|
||||
* } $options additional options for the Noty notification
|
||||
* @param string|null $title the title of the notification
|
||||
*
|
||||
* @return Envelope|NotyInterface Returns an Envelope containing the notification details when arguments are provided.
|
||||
* Returns an instance of NotyInterface when no arguments are provided.
|
||||
|
||||
@@ -28,8 +28,8 @@
|
||||
"prefer-stable": true,
|
||||
"require": {
|
||||
"php": ">=8.2",
|
||||
"php-flasher/flasher-noty": "^2.0.1",
|
||||
"php-flasher/flasher-symfony": "^2.0.1"
|
||||
"php-flasher/flasher-noty": "^2.1.1",
|
||||
"php-flasher/flasher-symfony": "^2.1.1"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
|
||||
@@ -29,8 +29,8 @@
|
||||
"prefer-stable": true,
|
||||
"require": {
|
||||
"php": ">=8.2",
|
||||
"php-flasher/flasher-laravel": "^2.0.1",
|
||||
"php-flasher/flasher-notyf": "^2.0.1"
|
||||
"php-flasher/flasher-laravel": "^2.1.1",
|
||||
"php-flasher/flasher-notyf": "^2.1.1"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
|
||||
@@ -6,6 +6,19 @@ namespace Flasher\Notyf\Prime;
|
||||
|
||||
use Flasher\Prime\Notification\NotificationBuilder;
|
||||
|
||||
/**
|
||||
* @phpstan-type NotificationType "success"|"info"|"warning"|"error"
|
||||
* @phpstan-type OptionsType array{
|
||||
* duration?: int,
|
||||
* ripple?: bool,
|
||||
* position?: array{
|
||||
* x: "left"|"center"|"right",
|
||||
* y: "top"|"center"|"bottom",
|
||||
* },
|
||||
* dismissible?: bool,
|
||||
* background?: string,
|
||||
* }
|
||||
*/
|
||||
final class NotyfBuilder extends NotificationBuilder
|
||||
{
|
||||
/**
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@flasher/flasher-notyf",
|
||||
"version": "2.0.0",
|
||||
"version": "2.1.1",
|
||||
"type": "module",
|
||||
"license": "MIT",
|
||||
"main": "dist/flasher-notyf.cjs.js",
|
||||
@@ -11,7 +11,7 @@
|
||||
"ncu": "ncu -u"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@flasher/flasher": "^2.0.0",
|
||||
"@flasher/flasher": "^2.1.1",
|
||||
"notyf": "^3.10.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
"prefer-stable": true,
|
||||
"require": {
|
||||
"php": ">=8.2",
|
||||
"php-flasher/flasher": "^2.0.1"
|
||||
"php-flasher/flasher": "^2.1.1"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
|
||||
@@ -16,10 +16,19 @@ if (!\function_exists('Flasher\Notyf\Prime\notyf')) {
|
||||
* When called with no arguments, it returns an instance of NotyfInterface.
|
||||
* When called with arguments, it creates a Notyf notification and returns an Envelope.
|
||||
*
|
||||
* @param string|null $message the message content of the notification
|
||||
* @param string $type The type of the notification (e.g., success, error, warning, info).
|
||||
* @param array<string, mixed> $options additional options for the Notyf notification
|
||||
* @param string|null $title the title of the notification
|
||||
* @param string|null $message the message content of the notification
|
||||
* @param "success"|"info"|"warning"|"error" $type The type of the notification (e.g., success, error, warning, info).
|
||||
* @param array{
|
||||
* duration?: int,
|
||||
* ripple?: bool,
|
||||
* position?: array{
|
||||
* x: "left"|"center"|"right",
|
||||
* y: "top"|"center"|"bottom",
|
||||
* },
|
||||
* dismissible?: bool,
|
||||
* background?: string,
|
||||
* } $options additional options for the Notyf notification
|
||||
* @param string|null $title the title of the notification
|
||||
*
|
||||
* @return Envelope|NotyfInterface Returns an Envelope containing the notification details when arguments are provided.
|
||||
* Returns an instance of NotyfInterface when no arguments are provided.
|
||||
|
||||
@@ -15,10 +15,19 @@ if (!function_exists('notyf')) {
|
||||
* When called with no arguments, it returns an instance of NotyfInterface.
|
||||
* When called with arguments, it creates a Notyf notification and returns an Envelope.
|
||||
*
|
||||
* @param string|null $message the message content of the notification
|
||||
* @param string $type The type of the notification (e.g., success, error, warning, info).
|
||||
* @param array<string, mixed> $options additional options for the Notyf notification
|
||||
* @param string|null $title the title of the notification
|
||||
* @param string|null $message the message content of the notification
|
||||
* @param "success"|"info"|"warning"|"error" $type The type of the notification (e.g., success, error, warning, info).
|
||||
* @param array{
|
||||
* duration?: int,
|
||||
* ripple?: bool,
|
||||
* position?: array{
|
||||
* x: "left"|"center"|"right",
|
||||
* y: "top"|"center"|"bottom",
|
||||
* },
|
||||
* dismissible?: bool,
|
||||
* background?: string,
|
||||
* } $options additional options for the Notyf notification
|
||||
* @param string|null $title the title of the notification
|
||||
*
|
||||
* @return Envelope|NotyfInterface Returns an Envelope containing the notification details when arguments are provided.
|
||||
* Returns an instance of NotyfInterface when no arguments are provided.
|
||||
|
||||
@@ -29,8 +29,8 @@
|
||||
"prefer-stable": true,
|
||||
"require": {
|
||||
"php": ">=8.2",
|
||||
"php-flasher/flasher-notyf": "^2.0.1",
|
||||
"php-flasher/flasher-symfony": "^2.0.1"
|
||||
"php-flasher/flasher-notyf": "^2.1.1",
|
||||
"php-flasher/flasher-symfony": "^2.1.1"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
|
||||
@@ -20,3 +20,4 @@ expectedReturnValues(\Flasher\Prime\Notification\NotificationInterface::getType(
|
||||
expectedArguments(\Flasher\Prime\Notification\NotificationBuilderInterface::handler(), 0, 'flasher', 'toastr', 'noty', 'notyf', 'sweetalert');
|
||||
|
||||
expectedArguments(\Flasher\Prime\FlasherInterface::render(), 0, 'html', 'json', 'array');
|
||||
expectedArguments(\Flasher\Prime\Notification\FlasherBuilder::option(), 0, 'timeout', 'timeouts', 'fps', 'position', 'direction', 'rtl', 'style', 'escapeHtml');
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Flasher\Prime;
|
||||
|
||||
/**
|
||||
* @phpstan-type ConfigType array{
|
||||
* default: string,
|
||||
* main_script?: string,
|
||||
* scripts?: string[],
|
||||
* styles?: string[],
|
||||
* inject_assets?: bool,
|
||||
* translate?: bool,
|
||||
* excluded_paths?: list<non-empty-string>,
|
||||
* options?: array<string, mixed>,
|
||||
* filter?: array<string, mixed>,
|
||||
* flash_bag?: false|array<string, string[]>,
|
||||
* presets?: array<string, array{
|
||||
* type: string,
|
||||
* title: string,
|
||||
* message: string,
|
||||
* options: array<string, mixed>,
|
||||
* }>,
|
||||
* plugins?: array<string, array{
|
||||
* scripts?: string[],
|
||||
* styles?: string[],
|
||||
* options?: array<string, mixed>,
|
||||
* }>,
|
||||
* }
|
||||
*/
|
||||
final class Configuration
|
||||
{
|
||||
/**
|
||||
* @param array{
|
||||
* default: string,
|
||||
* main_script?: string,
|
||||
* scripts?: string[],
|
||||
* styles?: string[],
|
||||
* inject_assets?: bool,
|
||||
* translate?: bool,
|
||||
* excluded_paths?: list<non-empty-string>,
|
||||
* options?: array<string, mixed>,
|
||||
* filter?: array<string, mixed>,
|
||||
* flash_bag?: false|array<string, string[]>,
|
||||
* presets?: array<string, array{
|
||||
* type: string,
|
||||
* title: string,
|
||||
* message: string,
|
||||
* options: array<string, mixed>,
|
||||
* }>,
|
||||
* plugins?: array<string, array{
|
||||
* scripts?: string[],
|
||||
* styles?: string[],
|
||||
* options?: array<string, mixed>,
|
||||
* }>,
|
||||
* } $config
|
||||
*
|
||||
* @phpstan-param ConfigType $config
|
||||
*
|
||||
* @return ConfigType
|
||||
*/
|
||||
public static function from(array $config): array
|
||||
{
|
||||
return $config;
|
||||
}
|
||||
}
|
||||
@@ -4,30 +4,33 @@ declare(strict_types=1);
|
||||
|
||||
namespace Flasher\Prime\EventDispatcher\Event;
|
||||
|
||||
use Flasher\Prime\Notification\NotificationInterface;
|
||||
use Flasher\Prime\Notification\Envelope;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
final class NotificationEvents
|
||||
{
|
||||
/** @var NotificationInterface[] */
|
||||
private array $notifications = [];
|
||||
/** @var Envelope[] */
|
||||
private array $envelopes = [];
|
||||
|
||||
public function add(NotificationInterface ...$notifications): void
|
||||
public function add(Envelope ...$notifications): void
|
||||
{
|
||||
foreach ($notifications as $notification) {
|
||||
$this->addNotification($notification);
|
||||
$this->addEnvelope($notification);
|
||||
}
|
||||
}
|
||||
|
||||
public function addNotification(NotificationInterface $notification): void
|
||||
public function addEnvelope(Envelope $notification): void
|
||||
{
|
||||
$this->notifications[] = $notification;
|
||||
$this->envelopes[] = $notification;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return NotificationInterface[]
|
||||
* @return Envelope[]
|
||||
*/
|
||||
public function getNotifications(): array
|
||||
public function getEnvelopes(): array
|
||||
{
|
||||
return $this->notifications;
|
||||
return $this->envelopes;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,34 +5,69 @@ declare(strict_types=1);
|
||||
namespace Flasher\Prime\EventDispatcher\EventListener;
|
||||
|
||||
use Flasher\Prime\EventDispatcher\Event\NotificationEvents;
|
||||
use Flasher\Prime\EventDispatcher\Event\PersistEvent;
|
||||
use Flasher\Prime\EventDispatcher\Event\PresentationEvent;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
final class NotificationLoggerListener implements EventListenerInterface
|
||||
{
|
||||
private NotificationEvents $events;
|
||||
private NotificationEvents $dispatchedEnvelopes;
|
||||
|
||||
private NotificationEvents $displayedEnvelopes;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->events = new NotificationEvents();
|
||||
$this->dispatchedEnvelopes = new NotificationEvents();
|
||||
$this->displayedEnvelopes = new NotificationEvents();
|
||||
}
|
||||
|
||||
public function reset(): void
|
||||
{
|
||||
$this->events = new NotificationEvents();
|
||||
$this->dispatchedEnvelopes = new NotificationEvents();
|
||||
$this->displayedEnvelopes = new NotificationEvents();
|
||||
}
|
||||
|
||||
public function __invoke(PresentationEvent $event): void
|
||||
public function __invoke(object $event): void
|
||||
{
|
||||
$this->events->add(...$event->getEnvelopes());
|
||||
if ($event instanceof PersistEvent) {
|
||||
$this->onPersist($event);
|
||||
}
|
||||
|
||||
if ($event instanceof PresentationEvent) {
|
||||
$this->onPresentation($event);
|
||||
}
|
||||
}
|
||||
|
||||
public function getEvents(): NotificationEvents
|
||||
public function onPersist(PersistEvent $event): void
|
||||
{
|
||||
return $this->events;
|
||||
$this->dispatchedEnvelopes->add(...$event->getEnvelopes());
|
||||
}
|
||||
|
||||
public function getSubscribedEvents(): string
|
||||
public function onPresentation(PresentationEvent $event): void
|
||||
{
|
||||
return PresentationEvent::class;
|
||||
$this->displayedEnvelopes->add(...$event->getEnvelopes());
|
||||
}
|
||||
|
||||
public function getDispatchedEnvelopes(): NotificationEvents
|
||||
{
|
||||
return $this->dispatchedEnvelopes;
|
||||
}
|
||||
|
||||
public function getDisplayedEnvelopes(): NotificationEvents
|
||||
{
|
||||
return $this->displayedEnvelopes;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string[]
|
||||
*/
|
||||
public function getSubscribedEvents(): array
|
||||
{
|
||||
return [
|
||||
PersistEvent::class,
|
||||
PresentationEvent::class,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ final readonly class Flasher implements FlasherInterface
|
||||
{
|
||||
use ForwardsCalls;
|
||||
|
||||
public const VERSION = '2.0.0';
|
||||
public const VERSION = '2.1.1';
|
||||
|
||||
public function __construct(
|
||||
private string $default,
|
||||
|
||||
@@ -8,7 +8,7 @@ use Flasher\Prime\Factory\NotificationFactoryInterface;
|
||||
use Flasher\Prime\Response\Presenter\ArrayPresenter;
|
||||
|
||||
/**
|
||||
* @mixin \Flasher\Prime\Notification\FlasherBuilder
|
||||
* @mixin \Flasher\Prime\Notification\NotificationBuilder
|
||||
*
|
||||
* @phpstan-import-type ArrayPresenterType from ArrayPresenter
|
||||
*/
|
||||
|
||||
@@ -4,8 +4,13 @@ declare(strict_types=1);
|
||||
|
||||
namespace Flasher\Prime\Http;
|
||||
|
||||
/**
|
||||
* @method string getUri()
|
||||
*/
|
||||
interface RequestInterface
|
||||
{
|
||||
// public function getUri(): string;
|
||||
|
||||
public function isXmlHttpRequest(): bool;
|
||||
|
||||
public function isHtmlRequestFormat(): bool;
|
||||
|
||||
@@ -10,8 +10,14 @@ use Flasher\Prime\Response\Presenter\HtmlPresenter;
|
||||
|
||||
final readonly class ResponseExtension implements ResponseExtensionInterface
|
||||
{
|
||||
public function __construct(private FlasherInterface $flasher, private ContentSecurityPolicyHandlerInterface $cspHandler)
|
||||
{
|
||||
/**
|
||||
* @param list<non-empty-string> $excludedPaths
|
||||
*/
|
||||
public function __construct(
|
||||
private FlasherInterface $flasher,
|
||||
private ContentSecurityPolicyHandlerInterface $cspHandler,
|
||||
private array $excludedPaths = [],
|
||||
) {
|
||||
}
|
||||
|
||||
public function render(RequestInterface $request, ResponseInterface $response): ResponseInterface
|
||||
@@ -69,7 +75,8 @@ final readonly class ResponseExtension implements ResponseExtensionInterface
|
||||
|
||||
private function isRenderable(RequestInterface $request, ResponseInterface $response): bool
|
||||
{
|
||||
return !$request->isXmlHttpRequest()
|
||||
return !$this->isPathExcluded($request)
|
||||
&& !$request->isXmlHttpRequest()
|
||||
&& $request->isHtmlRequestFormat()
|
||||
&& $response->isHtml()
|
||||
&& $response->isSuccessful()
|
||||
@@ -77,4 +84,21 @@ final readonly class ResponseExtension implements ResponseExtensionInterface
|
||||
&& !$response->isAttachment()
|
||||
&& !$response->isJson();
|
||||
}
|
||||
|
||||
private function isPathExcluded(RequestInterface $request): bool
|
||||
{
|
||||
if (!method_exists($request, 'getUri')) { // @phpstan-ignore-line
|
||||
return false;
|
||||
}
|
||||
|
||||
$url = $request->getUri();
|
||||
|
||||
foreach ($this->excludedPaths as $regexPattern) {
|
||||
if (preg_match($regexPattern, $url)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -103,7 +103,10 @@ final class Envelope implements NotificationInterface
|
||||
*/
|
||||
public function get(string $type): ?StampInterface
|
||||
{
|
||||
return $this->stamps[$type] ?? null; // @phpstan-ignore-line
|
||||
/** @var T|null $stamp */
|
||||
$stamp = $this->stamps[$type] ?? null;
|
||||
|
||||
return $stamp;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -4,8 +4,90 @@ declare(strict_types=1);
|
||||
|
||||
namespace Flasher\Prime\Notification;
|
||||
|
||||
/**
|
||||
* @phpstan-type NotificationType "success"|"info"|"warning"|"error"
|
||||
* @phpstan-type OptionsType array{
|
||||
* timeout?: int,
|
||||
* timeouts?: array<string, int>,
|
||||
* fps?: int,
|
||||
* position?: "top-right"|"top-left"|"top-center"|"bottom-right"|"bottom-left"|"bottom-center",
|
||||
* direction?: "top"|"bottom",
|
||||
* rtl?: bool,
|
||||
* style?: array<string, mixed>,
|
||||
* escapeHtml?: bool,
|
||||
* }
|
||||
*/
|
||||
final class FlasherBuilder extends NotificationBuilder
|
||||
{
|
||||
/**
|
||||
* @phpstan-param NotificationType $type
|
||||
*/
|
||||
public function type(string $type): static
|
||||
{
|
||||
return parent::type($type);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param OptionsType $options
|
||||
*/
|
||||
public function success(string $message, array $options = [], ?string $title = null): Envelope
|
||||
{
|
||||
return parent::success($message, $options, $title);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param OptionsType $options
|
||||
*/
|
||||
public function error(string $message, array $options = [], ?string $title = null): Envelope
|
||||
{
|
||||
return parent::error($message, $options, $title);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param OptionsType $options
|
||||
*/
|
||||
public function info(string $message, array $options = [], ?string $title = null): Envelope
|
||||
{
|
||||
return parent::info($message, $options, $title);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param OptionsType $options
|
||||
*/
|
||||
public function warning(string $message, array $options = [], ?string $title = null): Envelope
|
||||
{
|
||||
return parent::warning($message, $options, $title);
|
||||
}
|
||||
|
||||
/**
|
||||
* @phpstan-param NotificationType $type
|
||||
* @phpstan-param OptionsType $options
|
||||
*/
|
||||
public function flash(?string $type = null, ?string $message = null, array $options = [], ?string $title = null): Envelope
|
||||
{
|
||||
return parent::flash($type, $message, $options, $title);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param OptionsType $options
|
||||
*/
|
||||
public function options(array $options, bool $append = true): static
|
||||
{
|
||||
return parent::options($options, $append);
|
||||
}
|
||||
|
||||
/**
|
||||
* @template T of OptionsType
|
||||
* @template K of key-of<T>
|
||||
*
|
||||
* @phpstan-param K $name
|
||||
* @phpstan-param T[K] $value
|
||||
*/
|
||||
public function option(string $name, mixed $value): static
|
||||
{
|
||||
return parent::option($name, $value);
|
||||
}
|
||||
|
||||
public function timeout(int $milliseconds): self
|
||||
{
|
||||
$this->option('timeout', $milliseconds);
|
||||
@@ -13,6 +95,9 @@ final class FlasherBuilder extends NotificationBuilder
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param "top"|"bottom" $direction
|
||||
*/
|
||||
public function direction(string $direction): self
|
||||
{
|
||||
$this->option('direction', $direction);
|
||||
@@ -20,6 +105,9 @@ final class FlasherBuilder extends NotificationBuilder
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @phpstan-param OptionsType['position'] $position
|
||||
*/
|
||||
public function position(string $position): self
|
||||
{
|
||||
$this->option('position', $position);
|
||||
|
||||
@@ -14,6 +14,7 @@ use Flasher\Prime\Notification\Type;
|
||||
* main_script: string,
|
||||
* translate: bool,
|
||||
* inject_assets: bool,
|
||||
* excluded_paths: list<non-empty-string>,
|
||||
* scripts: string[],
|
||||
* styles: string[],
|
||||
* options: array<string, mixed>,
|
||||
@@ -188,6 +189,7 @@ final class FlasherPlugin extends Plugin
|
||||
* main_script?: string|null,
|
||||
* translate?: bool,
|
||||
* inject_assets?: bool,
|
||||
* excluded_paths?: list<non-empty-string>,
|
||||
* filter?: array<string, mixed>,
|
||||
* scripts: string[],
|
||||
* styles: string[],
|
||||
@@ -201,6 +203,7 @@ final class FlasherPlugin extends Plugin
|
||||
* main_script: string|null,
|
||||
* translate: bool,
|
||||
* inject_assets: bool,
|
||||
* excluded_paths?: list<non-empty-string>,
|
||||
* filter: array<string, mixed>,
|
||||
* scripts: string[],
|
||||
* styles: string[],
|
||||
@@ -234,6 +237,7 @@ final class FlasherPlugin extends Plugin
|
||||
* main_script: string|null,
|
||||
* translate: bool,
|
||||
* inject_assets: bool,
|
||||
* excluded_paths?: list<non-empty-string>,
|
||||
* filter: array<string, mixed>,
|
||||
* scripts: string[],
|
||||
* styles: string[],
|
||||
@@ -248,6 +252,7 @@ final class FlasherPlugin extends Plugin
|
||||
* main_script: string|null,
|
||||
* translate: bool,
|
||||
* inject_assets: bool,
|
||||
* excluded_paths?: list<non-empty-string>,
|
||||
* filter: array<string, mixed>,
|
||||
* scripts: string[],
|
||||
* styles: string[],
|
||||
@@ -285,6 +290,7 @@ final class FlasherPlugin extends Plugin
|
||||
* main_script: string|null,
|
||||
* translate: bool,
|
||||
* inject_assets: bool,
|
||||
* excluded_paths?: list<non-empty-string>,
|
||||
* filter: array<string, mixed>,
|
||||
* scripts: string[],
|
||||
* styles: string[],
|
||||
@@ -299,6 +305,7 @@ final class FlasherPlugin extends Plugin
|
||||
* main_script: string|null,
|
||||
* translate: bool,
|
||||
* inject_assets: bool,
|
||||
* excluded_paths?: list<non-empty-string>,
|
||||
* filter: array<string, mixed>,
|
||||
* scripts: string[],
|
||||
* styles: string[],
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
@use "sass:meta";
|
||||
:root {
|
||||
--background-color: rgb(255, 255, 255);
|
||||
--text-color: rgb(75, 85, 99);
|
||||
@@ -13,7 +14,7 @@
|
||||
--error-color-light: hsl(0deg, 75%, 90%);
|
||||
}
|
||||
|
||||
@import "wrapper";
|
||||
@import "container";
|
||||
@import "icons";
|
||||
@import "progress";
|
||||
@include meta.load-css("wrapper");
|
||||
@include meta.load-css("container");
|
||||
@include meta.load-css("icons");
|
||||
@include meta.load-css("progress");
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@flasher/flasher",
|
||||
"version": "2.0.0",
|
||||
"version": "2.1.1",
|
||||
"type": "module",
|
||||
"license": "MIT",
|
||||
"main": "dist/flasher.cjs.js",
|
||||
|
||||
@@ -59,7 +59,7 @@ final class Notification extends Constraint
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach ($other->getNotifications() as $notification) {
|
||||
foreach ($other->getEnvelopes() as $notification) {
|
||||
if ($this->isNotificationMatching($notification)) {
|
||||
return true;
|
||||
}
|
||||
@@ -89,7 +89,7 @@ final class Notification extends Constraint
|
||||
$notification->getMessage(),
|
||||
json_encode($notification->getOptions()),
|
||||
);
|
||||
}, $other->getNotifications());
|
||||
}, $other->getEnvelopes());
|
||||
|
||||
if (empty($foundNotifications)) {
|
||||
$foundNotifications[] = 'No notifications found';
|
||||
|
||||
@@ -57,6 +57,6 @@ final class NotificationCount extends Constraint
|
||||
*/
|
||||
private function countNotifications(NotificationEvents $events): int
|
||||
{
|
||||
return \count($events->getNotifications());
|
||||
return \count($events->getEnvelopes());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ final class NotificationMessage extends Constraint
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach ($other->getNotifications() as $notification) {
|
||||
foreach ($other->getEnvelopes() as $notification) {
|
||||
if (str_contains($notification->getMessage(), $this->expectedMessage)) {
|
||||
return true;
|
||||
}
|
||||
@@ -45,7 +45,7 @@ final class NotificationMessage extends Constraint
|
||||
|
||||
$foundMessages = array_map(function (NotificationInterface $notification) {
|
||||
return \sprintf('"%s"', $notification->getMessage());
|
||||
}, $other->getNotifications());
|
||||
}, $other->getEnvelopes());
|
||||
|
||||
if (empty($foundMessages)) {
|
||||
return \sprintf(
|
||||
|
||||
@@ -38,7 +38,7 @@ final class NotificationOption extends Constraint
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach ($other->getNotifications() as $notification) {
|
||||
foreach ($other->getEnvelopes() as $notification) {
|
||||
if ($this->isOptionMatching($notification)) {
|
||||
return true;
|
||||
}
|
||||
@@ -58,7 +58,7 @@ final class NotificationOption extends Constraint
|
||||
{
|
||||
$actualOptions = [];
|
||||
if ($other instanceof NotificationEvents) {
|
||||
foreach ($other->getNotifications() as $notification) {
|
||||
foreach ($other->getEnvelopes() as $notification) {
|
||||
$actualOptions[] = json_encode($notification->getOptions());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ final class NotificationOptions extends Constraint
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach ($other->getNotifications() as $notification) {
|
||||
foreach ($other->getEnvelopes() as $notification) {
|
||||
if (!array_diff_assoc($this->expectedOptions, $notification->getOptions())) {
|
||||
return true;
|
||||
}
|
||||
@@ -43,7 +43,7 @@ final class NotificationOptions extends Constraint
|
||||
{
|
||||
$actualOptions = [];
|
||||
if ($other instanceof NotificationEvents) {
|
||||
foreach ($other->getNotifications() as $notification) {
|
||||
foreach ($other->getEnvelopes() as $notification) {
|
||||
$actualOptions[] = json_encode($notification->getOptions());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ final class NotificationTitle extends Constraint
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach ($other->getNotifications() as $notification) {
|
||||
foreach ($other->getEnvelopes() as $notification) {
|
||||
if (str_contains($notification->getTitle(), $this->expectedTitle)) {
|
||||
return true;
|
||||
}
|
||||
@@ -48,7 +48,7 @@ final class NotificationTitle extends Constraint
|
||||
|
||||
$foundTitles = array_map(function (NotificationInterface $notification) {
|
||||
return \sprintf('"%s"', $notification->getTitle());
|
||||
}, $other->getNotifications());
|
||||
}, $other->getEnvelopes());
|
||||
|
||||
if (empty($foundTitles)) {
|
||||
return \sprintf(
|
||||
|
||||
@@ -40,7 +40,7 @@ final class NotificationType extends Constraint
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach ($other->getNotifications() as $notification) {
|
||||
foreach ($other->getEnvelopes() as $notification) {
|
||||
if ($notification->getType() === $this->expectedType) {
|
||||
return true;
|
||||
}
|
||||
@@ -60,7 +60,7 @@ final class NotificationType extends Constraint
|
||||
{
|
||||
$actualTypes = array_map(function (NotificationInterface $notification) {
|
||||
return $notification->getType();
|
||||
}, $other->getNotifications());
|
||||
}, $other->getEnvelopes());
|
||||
|
||||
$uniqueTypes = array_unique($actualTypes);
|
||||
$typesList = implode(', ', $uniqueTypes);
|
||||
|
||||
@@ -53,7 +53,7 @@ final class FlasherAssert
|
||||
*/
|
||||
public static function hasNotifications(string $message = 'Expected at least one notification to exist.'): self
|
||||
{
|
||||
return self::fluent(static fn () => Assert::assertNotEmpty(self::getNotificationEvents()->getNotifications(), $message));
|
||||
return self::fluent(static fn () => Assert::assertNotEmpty(self::getNotificationEvents()->getEnvelopes(), $message));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -66,7 +66,7 @@ final class FlasherAssert
|
||||
*/
|
||||
public static function noNotifications(string $message = 'Expected no notifications to exist.'): self
|
||||
{
|
||||
return self::fluent(static fn () => Assert::assertEmpty(self::getNotificationEvents()->getNotifications(), $message));
|
||||
return self::fluent(static fn () => Assert::assertEmpty(self::getNotificationEvents()->getEnvelopes(), $message));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -411,6 +411,6 @@ final class FlasherAssert
|
||||
/** @var NotificationLoggerListener $listener */
|
||||
$listener = $container->get('flasher.notification_logger_listener');
|
||||
|
||||
return $listener->getEvents();
|
||||
return $listener->getDisplayedEnvelopes();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,8 +30,8 @@
|
||||
"prefer-stable": true,
|
||||
"require": {
|
||||
"php": ">=8.2",
|
||||
"php-flasher/flasher-laravel": "^2.0.1",
|
||||
"php-flasher/flasher-sweetalert": "^2.0.1"
|
||||
"php-flasher/flasher-laravel": "^2.1.1",
|
||||
"php-flasher/flasher-sweetalert": "^2.1.1"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@flasher/flasher-sweetalert",
|
||||
"version": "2.0.0",
|
||||
"version": "2.1.1",
|
||||
"type": "module",
|
||||
"license": "MIT",
|
||||
"main": "dist/flasher-sweetalert.cjs.js",
|
||||
@@ -11,7 +11,7 @@
|
||||
"ncu": "ncu -u"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@flasher/flasher": "^2.0.0",
|
||||
"@flasher/flasher": "^2.1.1",
|
||||
"sweetalert2": "^11.6.13"
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -7,8 +7,150 @@ namespace Flasher\SweetAlert\Prime;
|
||||
use Flasher\Prime\Notification\Envelope;
|
||||
use Flasher\Prime\Notification\NotificationBuilder;
|
||||
|
||||
/**
|
||||
* @phpstan-type NotificationType "success"|"info"|"warning"|"error"|"question"
|
||||
* @phpstan-type CustomClassType "container"|"popup"|"header"|"title"|"closeButton"|"icon"|"image"|"content"|"input"|"inputLabel"|"validationMessage"|"actions"|"confirmButton"|"denyButton"|"cancelButton"|"loader"|"footer"
|
||||
* @phpstan-type OptionsType array{
|
||||
* title?: string,
|
||||
* titleText?: string,
|
||||
* html?: string,
|
||||
* text?: string,
|
||||
* icon?: string,
|
||||
* iconColor?: string,
|
||||
* iconHtml?: string,
|
||||
* showClass?: mixed,
|
||||
* hideClass?: mixed,
|
||||
* footer?: string,
|
||||
* backdrop?: bool|string,
|
||||
* toast?: bool,
|
||||
* target?: string,
|
||||
* input?: "text"|"email"|"password"|"number"|"tel"|"range"|"textarea"|"search"|"url"|"select"|"radio"|"checkbox"|"file"|"date"|"datetime-local"|"time"|"week"|"month",
|
||||
* width?: string,
|
||||
* padding?: string,
|
||||
* background?: string,
|
||||
* position?: "top"|"top-start"|"top-end"|"center"|"center-start"|"center-end"|"bottom"|"bottom-start"|"bottom-end",
|
||||
* grow?: "column"|"fullscreen"|"row"|false,
|
||||
* customClass?: array<CustomClassType, string>,
|
||||
* timer?: int,
|
||||
* timerProgressBar?: bool,
|
||||
* heightAuto?: bool,
|
||||
* allowOutsideClick?: bool|string,
|
||||
* allowEscapeKey?: bool|string,
|
||||
* allowEnterKey?: bool|string,
|
||||
* stopKeydownPropagation?: bool,
|
||||
* keydownListenerCapture?: bool,
|
||||
* showConfirmButton?: bool,
|
||||
* showDenyButton?: bool,
|
||||
* showCancelButton?: bool,
|
||||
* confirmButtonText?: string,
|
||||
* denyButtonText?: string,
|
||||
* cancelButtonText?: string,
|
||||
* confirmButtonColor?: string,
|
||||
* denyButtonColor?: string,
|
||||
* cancelButtonColor?: string,
|
||||
* confirmButtonAriaLabel?: string,
|
||||
* denyButtonAriaLabel?: string,
|
||||
* cancelButtonAriaLabel?: string,
|
||||
* buttonsStyling?: bool,
|
||||
* reverseButtons?: bool,
|
||||
* focusConfirm?: bool,
|
||||
* focusDeny?: bool,
|
||||
* focusCancel?: bool,
|
||||
* showCloseButton?: bool,
|
||||
* closeButtonHtml?: string,
|
||||
* closeButtonAriaLabel?: string,
|
||||
* loaderHtml?: string,
|
||||
* showLoaderOnConfirm?: bool,
|
||||
* scrollbarPadding?: bool,
|
||||
* preConfirm?: bool|string,
|
||||
* preDeny?: string,
|
||||
* returnInputValueOnDeny?: bool,
|
||||
* animation?: bool,
|
||||
* imageUrl?: string,
|
||||
* imageWidth?: int,
|
||||
* imageHeight?: int,
|
||||
* imageAlt?: string,
|
||||
* inputLabel?: string,
|
||||
* inputPlaceholder?: string,
|
||||
* inputValue?: string,
|
||||
* inputOptions?: string,
|
||||
* inputAutoTrim?: bool,
|
||||
* inputAttributes?: string,
|
||||
* inputValidator?: string,
|
||||
* validationMessage?: string,
|
||||
* }
|
||||
*/
|
||||
final class SweetAlertBuilder extends NotificationBuilder
|
||||
{
|
||||
/**
|
||||
* @phpstan-param NotificationType $type
|
||||
*/
|
||||
public function type(string $type): static
|
||||
{
|
||||
return parent::type($type);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param OptionsType $options
|
||||
*/
|
||||
public function success(string $message, array $options = [], ?string $title = null): Envelope
|
||||
{
|
||||
return parent::success($message, $options, $title);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param OptionsType $options
|
||||
*/
|
||||
public function error(string $message, array $options = [], ?string $title = null): Envelope
|
||||
{
|
||||
return parent::error($message, $options, $title);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param OptionsType $options
|
||||
*/
|
||||
public function info(string $message, array $options = [], ?string $title = null): Envelope
|
||||
{
|
||||
return parent::info($message, $options, $title);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param OptionsType $options
|
||||
*/
|
||||
public function warning(string $message, array $options = [], ?string $title = null): Envelope
|
||||
{
|
||||
return parent::warning($message, $options, $title);
|
||||
}
|
||||
|
||||
/**
|
||||
* @phpstan-param NotificationType $type
|
||||
* @phpstan-param OptionsType $options
|
||||
*/
|
||||
public function flash(?string $type = null, ?string $message = null, array $options = [], ?string $title = null): Envelope
|
||||
{
|
||||
return parent::flash($type, $message, $options, $title);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param OptionsType $options
|
||||
*/
|
||||
public function options(array $options, bool $append = true): static
|
||||
{
|
||||
return parent::options($options, $append);
|
||||
}
|
||||
|
||||
/**
|
||||
* @template T of OptionsType
|
||||
* @template K of key-of<T>
|
||||
*
|
||||
* @phpstan-param K $name
|
||||
* @phpstan-param T[K] $value
|
||||
*/
|
||||
public function option(string $name, mixed $value): static
|
||||
{
|
||||
return parent::option($name, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a question typed alert message.
|
||||
*
|
||||
@@ -190,7 +332,7 @@ final class SweetAlertBuilder extends NotificationBuilder
|
||||
}
|
||||
|
||||
/**
|
||||
* @param "text"|"email"|"password"|"number"|"tel"|"range"|"textarea"|"search"|"url"|"select"|"radio"|"checkbox"|"file"|"date"|"datetime-local"|"time"|"week"|"month" $input
|
||||
* @phpstan-param OptionsType['input'] $input
|
||||
*
|
||||
* Input field type, can be text, email, password, number, tel, range, textarea, select, radio, checkbox, file and
|
||||
* url
|
||||
@@ -233,7 +375,7 @@ final class SweetAlertBuilder extends NotificationBuilder
|
||||
}
|
||||
|
||||
/**
|
||||
* @param "top"|"top-start"|"top-end"|"center"|"center-start"|"center-end"|"bottom"|"bottom-start"|"bottom-end" $position
|
||||
* @phpstan-param OptionsType['position'] $position
|
||||
*
|
||||
* Popup window position, can be 'top', 'top-start', 'top-end', 'center', 'center-start', 'center-end', 'bottom',
|
||||
* 'bottom-start', or 'bottom-end'
|
||||
@@ -246,12 +388,12 @@ final class SweetAlertBuilder extends NotificationBuilder
|
||||
}
|
||||
|
||||
/**
|
||||
* @param "row"|"column"|"fullscreen"|false $grow
|
||||
* @phpstan-param "column"|"fullscreen"|"row"|false $grow
|
||||
*
|
||||
* Paired with window position, sets the direction the popup should grow in, can be set to 'row', 'column',
|
||||
* 'fullscreen', or false
|
||||
*/
|
||||
public function grow(bool|string $grow): self
|
||||
public function grow(string|false $grow): self
|
||||
{
|
||||
$this->option('grow', $grow);
|
||||
|
||||
@@ -259,14 +401,15 @@ final class SweetAlertBuilder extends NotificationBuilder
|
||||
}
|
||||
|
||||
/**
|
||||
* @param "container"|"popup"|"header"|"title"|"closeButton"|"icon"|"image"|"content"|"input"|"inputLabel"|"validationMessage"|"actions"|"confirmButton"|"denyButton"|"cancelButton"|"loader"|"footer" $customClass
|
||||
* @phpstan-param CustomClassType $customClass
|
||||
*
|
||||
* A custom CSS class for the popup
|
||||
*/
|
||||
public function customClass(string $customClass, string $value): self
|
||||
{
|
||||
/** @var OptionsType['customClass'] $option */
|
||||
$option = $this->getEnvelope()->getOption('customClass', []);
|
||||
$option[$customClass] = $value; // @phpstan-ignore-line
|
||||
$option[$customClass] = $value;
|
||||
|
||||
$this->option('customClass', $option);
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
"prefer-stable": true,
|
||||
"require": {
|
||||
"php": ">=8.2",
|
||||
"php-flasher/flasher": "^2.0.1"
|
||||
"php-flasher/flasher": "^2.1.1"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
|
||||
@@ -16,10 +16,78 @@ if (!\function_exists('Flasher\SweetAlert\Prime\sweetalert')) {
|
||||
* When called with no arguments, it returns an instance of SweetAlertInterface.
|
||||
* When called with arguments, it creates a Sweetalert notification and returns an Envelope.
|
||||
*
|
||||
* @param string|null $message the message content of the notification
|
||||
* @param string $type The type of the notification (e.g., success, error, warning, info).
|
||||
* @param array<string, mixed> $options additional options for the Sweetalert notification
|
||||
* @param string|null $title the title of the notification
|
||||
* @param string|null $message the message content of the notification
|
||||
* @param "success"|"info"|"warning"|"error"|"question" $type The type of the notification (e.g., success, error, warning, info).
|
||||
* @param array{
|
||||
* title?: string,
|
||||
* titleText?: string,
|
||||
* html?: string,
|
||||
* text?: string,
|
||||
* icon?: string,
|
||||
* iconColor?: string,
|
||||
* iconHtml?: string,
|
||||
* showClass?: mixed,
|
||||
* hideClass?: mixed,
|
||||
* footer?: string,
|
||||
* backdrop?: bool|string,
|
||||
* toast?: bool,
|
||||
* target?: string,
|
||||
* input?: "text"|"email"|"password"|"number"|"tel"|"range"|"textarea"|"search"|"url"|"select"|"radio"|"checkbox"|"file"|"date"|"datetime-local"|"time"|"week"|"month",
|
||||
* width?: string,
|
||||
* padding?: string,
|
||||
* background?: string,
|
||||
* position?: "top"|"top-start"|"top-end"|"center"|"center-start"|"center-end"|"bottom"|"bottom-start"|"bottom-end",
|
||||
* grow?: "column"|"fullscreen"|"row"|false,
|
||||
* customClass?: array<"container"|"popup"|"header"|"title"|"closeButton"|"icon"|"image"|"content"|"input"|"inputLabel"|"validationMessage"|"actions"|"confirmButton"|"denyButton"|"cancelButton"|"loader"|"footer", string>,
|
||||
* timer?: int,
|
||||
* timerProgressBar?: bool,
|
||||
* heightAuto?: bool,
|
||||
* allowOutsideClick?: bool|string,
|
||||
* allowEscapeKey?: bool|string,
|
||||
* allowEnterKey?: bool|string,
|
||||
* stopKeydownPropagation?: bool,
|
||||
* keydownListenerCapture?: bool,
|
||||
* showConfirmButton?: bool,
|
||||
* showDenyButton?: bool,
|
||||
* showCancelButton?: bool,
|
||||
* confirmButtonText?: string,
|
||||
* denyButtonText?: string,
|
||||
* cancelButtonText?: string,
|
||||
* confirmButtonColor?: string,
|
||||
* denyButtonColor?: string,
|
||||
* cancelButtonColor?: string,
|
||||
* confirmButtonAriaLabel?: string,
|
||||
* denyButtonAriaLabel?: string,
|
||||
* cancelButtonAriaLabel?: string,
|
||||
* buttonsStyling?: bool,
|
||||
* reverseButtons?: bool,
|
||||
* focusConfirm?: bool,
|
||||
* focusDeny?: bool,
|
||||
* focusCancel?: bool,
|
||||
* showCloseButton?: bool,
|
||||
* closeButtonHtml?: string,
|
||||
* closeButtonAriaLabel?: string,
|
||||
* loaderHtml?: string,
|
||||
* showLoaderOnConfirm?: bool,
|
||||
* scrollbarPadding?: bool,
|
||||
* preConfirm?: bool|string,
|
||||
* preDeny?: string,
|
||||
* returnInputValueOnDeny?: bool,
|
||||
* animation?: bool,
|
||||
* imageUrl?: string,
|
||||
* imageWidth?: int,
|
||||
* imageHeight?: int,
|
||||
* imageAlt?: string,
|
||||
* inputLabel?: string,
|
||||
* inputPlaceholder?: string,
|
||||
* inputValue?: string,
|
||||
* inputOptions?: string,
|
||||
* inputAutoTrim?: bool,
|
||||
* inputAttributes?: string,
|
||||
* inputValidator?: string,
|
||||
* validationMessage?: string,
|
||||
* } $options additional options for the Sweetalert notification
|
||||
* @param string|null $title the title of the notification
|
||||
*
|
||||
* @return Envelope|SweetAlertInterface Returns an Envelope containing the notification details when arguments are provided.
|
||||
* Returns an instance of SweetAlertInterface when no arguments are provided.
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user