Compare commits

...

83 Commits

Author SHA1 Message Date
Younes ENNAJI 46f2397cdc chore: bump flasher dependency to v2.1.1 2024-10-20 15:11:19 +01:00
Younes ENNAJI 57d4665b62 Merge pull request #203 from php-flasher/laravel-excluded-paths
chore: add Laravel excluded paths option
2024-10-20 15:08:15 +01:00
Younes ENNAJI cf3943bc08 fix: phpstan return type 2024-10-20 15:05:07 +01:00
Younes ENNAJI 1da1392670 chore: update CHANGELOG 2024-10-20 15:03:15 +01:00
Younes ENNAJI 095b0d967d chore: add Laravel excluded paths option 2024-10-20 15:01:07 +01:00
Younes ENNAJI 16c1764e73 Merge pull request #202 from php-flasher/symfony-ux
compile assets
2024-10-19 22:13:43 +01:00
Younes ENNAJI 453a0b9c77 chore: compile doc assets 2024-10-19 22:11:20 +01:00
Younes ENNAJI fd051dbf74 chore: compile assets 2024-10-19 22:01:40 +01:00
Younes ENNAJI 2eb8500799 chore: update CHANGELOG 2024-10-19 16:57:02 +01:00
Younes ENNAJI e1b075520b chore: update CHANGELOG 2024-10-19 16:52:53 +01:00
Younes ENNAJI 0477a319b4 chore: update CHANGELOG 2024-10-19 16:52:26 +01:00
Younes ENNAJI 7eaa7a1f46 chore: update CHANGELOG 2024-10-19 16:51:41 +01:00
Younes ENNAJI cdfe882322 chore: run php-cs-fixer 2024-10-19 02:08:58 +01:00
Younes ENNAJI 2ff02a15bf chore: upgrade dependencies 2024-10-19 02:03:11 +01:00
Younes ENNAJI 09f53b1b63 chore: validate and autocomplete flasher configuration 2024-10-19 02:02:53 +01:00
Younes ENNAJI d0022aa0cb docs: comment options array as that's the default value 2024-10-19 00:42:02 +01:00
Younes ENNAJI 632c0662e4 docs: add note about optional configuration values 2024-10-19 00:39:28 +01:00
Younes ENNAJI e8ee494e13 chore: remove whitespaces from docs 2024-10-13 23:54:46 +01:00
Younes ENNAJI fdaa8f8961 Merge pull request #201 from php-flasher/configuration
chore: update laravel and symfony configuration documentation
2024-10-13 23:52:41 +01:00
Younes ENNAJI aa645778e3 chore: update laravel and symfony configuration documentation 2024-10-13 23:51:34 +01:00
Younes ENNAJI aca71922e8 Merge pull request #200 from php-flasher/phpstan
Improve Type Safety and IDE Support with Enhanced PHPDoc Annotations and Stricter PHPStan Validations
2024-10-13 21:42:41 +01:00
Younes ENNAJI 08b96bdd39 chore: enhance type safety with detailed PHPDoc annotations and stricter PHPStan validations 2024-10-13 21:39:22 +01:00
Younes ENNAJI 89d8c2cb7a chore: upgrade dependencies 2024-10-06 16:24:45 +01:00
Younes ENNAJI 004334f642 chore: clean up build files 2024-10-06 15:54:53 +01:00
Younes ENNAJI 60d0f2ed30 remove .npmignore file 2024-10-06 15:23:10 +01:00
Younes ENNAJI d82a12d8c8 update docs description tag 2024-10-06 15:05:14 +01:00
Younes ENNAJI 7b190bf882 update Linkedin profile 2024-10-06 14:44:28 +01:00
Younes ENNAJI 18763f1df0 fix email address in README 2024-10-06 14:43:18 +01:00
Younes ENNAJI 486329be24 Merge pull request #199 from php-flasher/feat/config
[Symfony] Improve configuration descriptions and add examples
2024-10-06 14:33:05 +01:00
Younes ENNAJI c0c8d7d5da chore: improve configuration descriptions and add examples 2024-10-06 14:32:10 +01:00
Younes ENNAJI 8cbf37b29b Merge pull request #198 from php-flasher/feat/profiler
feat(Symfony): Add Symfony Profiler integration for PHPFlasher
2024-10-06 13:37:40 +01:00
Younes ENNAJI 43affdc543 chore: add Symfony Profiler integration for PHPFlasher 2024-10-05 15:34:57 +01:00
Younes ENNAJI b6afde2990 chore: update CHANGELOG 2024-09-22 15:32:58 +01:00
Younes ENNAJI e28123fb3c Merge pull request #197 from php-flasher/issues/190
refactor: FlasherServiceProvider Update HttpKernel import and reorder methods
2024-09-22 15:28:35 +01:00
Younes ENNAJI 79717cae5c refactor: FlasherServiceProvider Update HttpKernel import and reorder methods
- Changed HttpKernel import from Illuminate\Foundation\Http\Kernel to Illuminate\Contracts\Http\Kernel to use the contract interface instead of the concrete implementation.
- Moved registerCspHandler() and registerAssetManager() methods after registerSessionMiddleware() to improve code organization and ensure correct initialization order.
2024-09-22 15:26:49 +01:00
Younes ENNAJI 6fe3407fae chore: upgrade dependencies 2024-09-22 15:21:45 +01:00
Younes ENNAJI 8d0dff2224 Add a friendly call-to-action encouraging users to star the repo and contribute to the docs 2024-09-21 23:42:57 +01:00
Younes ENNAJI 8047c6f6fe chore: update CHANGELOG 2024-09-21 23:30:49 +01:00
Younes ENNAJI c6bdaca89c chore: compile assets 2024-09-21 23:26:23 +01:00
Younes ENNAJI 8e10065c25 style: remove unused border from flasher.scss 2024-09-21 23:25:57 +01:00
Younes ENNAJI cd592be772 docs: update inertial doc page 2024-09-21 23:15:00 +01:00
Younes ENNAJI 1a90c1347e docs: update livewire doc page 2024-09-21 23:12:03 +01:00
Younes ENNAJI 0e3d300390 docs: update laravel doc page 2024-09-21 23:07:48 +01:00
Younes ENNAJI e5507140c8 docs: update symfony doc page 2024-09-21 21:17:27 +01:00
Younes ENNAJI cd43f73b88 docs: update the homepage 2024-09-21 20:46:50 +01:00
Younes ENNAJI 8e026bea78 upgrade dependencies 2024-09-21 20:23:42 +01:00
Younes ENNAJI a5308b85da add palestine banner support to nested repositories 2024-09-21 19:14:36 +01:00
Younes ENNAJI ed522d51a5 chore: update palestine support banner 2024-09-21 19:10:56 +01:00
Younes ENNAJI d9c31820e0 chore: update palestine support banner 2024-09-21 19:03:22 +01:00
Younes ENNAJI eb60a63200 chore: add support palestine banner 2024-09-21 19:00:37 +01:00
Younes ENNAJI 58ca234a37 chore: upgrade dependencies 2024-09-21 18:33:59 +01:00
Younes ENNAJI ff2cd6e384 chore: update CHANGELOG 2024-09-19 07:44:09 +01:00
Younes ENNAJI 2012b6f5af Merge pull request #196 from php-flasher/issue-193
Introduce escapeHtml Option for Secure HTML Escaping in PHPFlasher
2024-09-19 07:41:45 +01:00
Younes ENNAJI 889fc4701e chore: add escapeHtml option for secure HTML escaping in notifications 2024-09-19 07:40:10 +01:00
Younes ENNAJI 74a71b36dc style: compile assets 2024-09-19 07:39:03 +01:00
Younes ENNAJI ae0b5e8f9a style: replace deprecated function darken with scss color module color.adjust 2024-09-19 07:38:53 +01:00
Younes ENNAJI e44c1d675e ci: fix phpstan errors 2024-09-19 07:32:04 +01:00
Younes ENNAJI 61bd5f7a96 chore: add rollup progress plugin 2024-09-19 07:00:51 +01:00
Younes ENNAJI faf827f248 docs: update inertia js documentation 2024-09-19 06:42:29 +01:00
Younes ENNAJI d59e37812d chore: run php-cs-fixer 2024-09-19 06:42:10 +01:00
Younes ENNAJI 51dd7dc6fb chore: upgrade dependencies 2024-09-19 06:39:52 +01:00
Younes ENNAJI 2c2326a4a9 chore: upgrade dependencies 2024-06-16 00:02:33 +01:00
Younes ENNAJI fb34c1525d chore: upgrade dependencies 2024-06-16 00:01:48 +01:00
Younes ENNAJI d496046d50 chore: upgrade dependencies 2024-06-15 21:34:46 +01:00
Younes ENNAJI 1c5b47ab52 chore: update dependencies 2024-05-31 16:02:55 +01:00
Younes ENNAJI 87f015341e chore: add parallel run php-cs-fixer config 2024-05-31 10:04:29 +01:00
Younes ENNAJI 6087a940c6 chore: upgrade npm dependencies 2024-05-31 10:01:33 +01:00
Younes ENNAJI be82ad0b69 chore: upgrade composer dependencies 2024-05-31 10:01:18 +01:00
Younes ENNAJI 88271276fc chore: add support for symfony v7.1 2024-05-31 09:59:01 +01:00
Younes ENNAJI 456e434474 chore: remove pr auto_closer github action 2024-05-27 00:40:47 +01:00
Younes ENNAJI b28525d718 chore: add and run phpstan phpunit 2024-05-27 00:34:47 +01:00
Younes ENNAJI a820277f25 chore: update CHANGELOG 2024-05-26 13:26:08 +01:00
Younes ENNAJI 10883353f2 Merge pull request #184 from php-flasher/issue-176
chore: Refactor middleware to use Symfony's base response class
2024-05-26 13:22:01 +01:00
Younes ENNAJI 6de67f7fb3 chore: Refactor middleware to use Symfony's base response class
This commit updates the FlasherMiddleware and SessionMiddleware to utilize Symfony's base response class instead of Laravel's. This change ensures broader compatibility and addresses the issue with flash message rendering after page refreshes as identified by the community. Preparing for release in v2.0.2.
2024-05-26 13:20:48 +01:00
Younes ENNAJI b08161f9ec docs: add Ahmed Gamal to the list of contributors 2024-05-26 01:51:51 +01:00
Younes ENNAJI c35e973524 Merge pull request #183 from AhmedGamal/2.x
Default configuration options
2024-05-26 01:21:49 +01:00
Ahmed Gamal f985ea2999 chore: Symfony config options update 2024-05-25 21:24:39 +03:00
Ahmed Gamal e42e91a1e0 chore: laravel config options update 2024-05-25 21:24:30 +03:00
Ahmed Gamal 08eb6089e1 docs: adding config options 2024-05-25 21:24:19 +03:00
Younes ENNAJI dd93f6e66d docs: allow users to switch between versions 2024-05-25 15:00:18 +01:00
Younes ENNAJI b6989336e7 chore: upgrade dependencies 2024-05-24 16:15:23 +01:00
Younes ENNAJI 79c6fc3bcb chore: restore .github/workflows/tests.yaml accidentally deleted in commit d2f019f 2024-05-24 13:39:01 +01:00
Younes ENNAJI f61a7d83ce test: add tests for FlasherMiddleware and SessionMiddleware registration 2024-05-24 13:33:25 +01:00
265 changed files with 16431 additions and 12785 deletions
+10 -1
View File
@@ -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
+10
View File
@@ -85,6 +85,16 @@
"contributions": [
"design"
]
},
{
"login": "AhmedGamal",
"name": "Ahmed Gamal",
"avatar_url": "https://avatars.githubusercontent.com/u/11786167?v=4",
"profile": "https://github.com/AhmedGamal",
"contributions": [
"code",
"doc"
]
}
]
}
+171
View File
@@ -0,0 +1,171 @@
name: 🧪 Run Tests & 🛠️ Static Analysis
on:
push:
branches:
- main
- 2.x
pull_request:
schedule:
- cron: '0 0 * * *' # Daily at midnight
jobs:
static-analysis:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php: [ 8.2 ]
name: 🐘 PHP ${{ matrix.php }} Static Analysis
steps:
- name: 📥 Checkout Code
uses: actions/checkout@v4
- name: 🔧 Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: none
- name: 🚚 Cache Composer Dependencies
uses: actions/cache@v4
with:
path: ~/.composer/cache
key: ${{ runner.os }}-composer-${{ matrix.php }}-${{ hashFiles('composer.json') }}
restore-keys: ${{ runner.os }}-composer-${{ matrix.php }}-
- name: 📦 Install Dependencies
run: |
composer config --global allow-plugins true
composer install
- name: 🧹 Run PHP CS Fixer (Code Style)
run: vendor/bin/php-cs-fixer fix --dry-run
- name: 🔍 Run PHPStan (Static Analysis)
run: vendor/bin/phpstan analyse
- name: 🚀 Run PHPLint (Syntax Check)
run: vendor/bin/phplint
prime-test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- { php: 8.4, phpunit: 10.5.* }
- { php: 8.3, phpunit: 10.5.* }
- { php: 8.2, phpunit: 10.5.* }
name: 🐘 PHP ${{ matrix.php }}
steps:
- name: 📥 Checkout code
uses: actions/checkout@v4
- name: 🔧 Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: none
- name: 🚚 Cache dependencies
uses: actions/cache@v4
with:
path: ~/.composer/cache
key: ${{ runner.os }}-composer-${{ matrix.php }}-${{ hashFiles('composer.json') }}
restore-keys: ${{ runner.os }}-composer-${{ matrix.php }}-
- name: 📦 Install dependencies
run: |
sed -i '/"require": {/,/},/d; /"require-dev": {/,/},/d' composer.json
composer config --global allow-plugins true
composer require "phpunit/phpunit:${{ matrix.phpunit }}" "mockery/mockery" "psr/container" --no-interaction --no-update
composer update --prefer-lowest -W
- name: ✅ Execute tests
run: vendor/bin/phpunit --testsuite prime
symfony-test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- { symfony: 7.2.*, php: 8.4, phpunit: 10.5.* }
- { symfony: 7.2.*, php: 8.3, phpunit: 10.5.* }
- { symfony: 7.2.*, php: 8.2, phpunit: 10.5.* }
- { symfony: 7.1.*, php: 8.2, phpunit: 10.5.* }
- { symfony: 7.0.*, php: 8.2, phpunit: 10.5.* }
name: 🌉 Symfony ${{ matrix.symfony }} PHP ${{ matrix.php }}
steps:
- name: 📥 Checkout code
uses: actions/checkout@v4
- name: 🔧 Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: none
- name: 🚚 Cache dependencies
uses: actions/cache@v4
with:
path: ~/.composer/cache
key: ${{ runner.os }}-composer-${{ matrix.php }}-${{ hashFiles('composer.json') }}
restore-keys: ${{ runner.os }}-composer-${{ matrix.php }}-
- name: 📦 Install dependencies
run: |
sed -i '/"require": {/,/},/d; /"require-dev": {/,/},/d' composer.json
composer config --global allow-plugins true
composer config extra.symfony.require "${{ matrix.symfony }}"
composer require "symfony/config:${{ matrix.symfony }}" "symfony/console:${{ matrix.symfony }}" "symfony/dependency-injection:${{ matrix.symfony }}" "symfony/framework-bundle:${{ matrix.symfony }}" "symfony/http-kernel:${{ matrix.symfony }}" "symfony/translation:${{ matrix.symfony }}" "symfony/twig-bundle:${{ matrix.symfony }}" "phpunit/phpunit:${{ matrix.phpunit }}" "mockery/mockery" "psr/container" "monolog/monolog" --no-interaction --no-update
composer update --prefer-lowest -W
- name: ✅ Execute tests
run: vendor/bin/phpunit --testsuite symfony
laravel-test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- { laravel: 11.*, testbench: 9.*, php: 8.3, phpunit: 10.5.* }
- { laravel: 11.*, testbench: 9.*, php: 8.2, phpunit: 10.5.* }
name: 🏗 Laravel ${{ matrix.laravel }} PHP ${{ matrix.php }}
steps:
- name: 📥 Checkout code
uses: actions/checkout@v4
- name: 🔧 Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: fileinfo
coverage: none
- name: 🚚 Cache dependencies
uses: actions/cache@v4
with:
path: ~/.composer/cache
key: ${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}
restore-keys: ${{ matrix.php }}-composer
- name: 📦 Install dependencies
run: |
sed -i '/\"require\": {/,/},/d; /\"require-dev\": {/,/},/d' composer.json
composer config --global allow-plugins true
composer require "laravel/framework:${{ matrix.laravel }}" "phpunit/phpunit:${{ matrix.phpunit }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update
composer update --prefer-lowest -W
- name: ✅ Execute tests
run: vendor/bin/phpunit --testsuite laravel
+14 -17
View File
@@ -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/
-8
View File
@@ -1,8 +0,0 @@
*.log
npm-debug.log*
# Coverage directory used by tools like istanbul
coverage
# Dependency directories
node_modules
+1 -1
View File
@@ -1 +1 @@
20.11.0
23.0.0
+7 -2
View File
@@ -2,7 +2,11 @@
declare(strict_types=1);
$finder = PhpCsFixer\Finder::create()
use PhpCsFixer\Config;
use PhpCsFixer\Finder;
use PhpCsFixer\Runner\Parallel\ParallelConfigFactory;
$finder = Finder::create()
->in([
__DIR__.'/src',
__DIR__.'/tests',
@@ -11,7 +15,8 @@ $finder = PhpCsFixer\Finder::create()
->append([__FILE__])
;
return (new PhpCsFixer\Config())
return (new Config())
->setParallelConfig(ParallelConfigFactory::detect())
->setRiskyAllowed(true)
->setRules([
'@PSR12' => true,
-3
View File
@@ -1,6 +1,3 @@
pnpm-lock.yaml
pnpm-workspace.yaml
**/node_modules
src/**/Resources/public/**
src/**/Resources/dist/**
-23
View File
@@ -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! 🙌
+30 -5
View File
@@ -1,10 +1,35 @@
# CHANGELOG for 2.x
## [Unreleased](https://github.com/php-flasher/php-flasher/compare/v2.0.1...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
* feature [Flasher] add escapeHtml option for secure HTML escaping in notifications. See [PR #196](https://github.com/php-flasher/php-flasher/pull/196) by [yoeunes](https://github.com/yoeunes)
* feature [Flasher] add Default configuration options. See [PR #183](https://github.com/php-flasher/php-flasher/pull/183) by [AhmedGamal](https://github.com/AhmedGamal)
* feature [Laravel] Refactor middleware to use Symfony's base response class, addressing compatibility issues. See [PR #184](https://github.com/php-flasher/php-flasher/pull/184) by [yoeunes](https://github.com/yoeunes)
## [v2.0.1](https://github.com/php-flasher/php-flasher/compare/v2.0.0...v2.0.1) - 2024-05-23
* bug [#176](https://github.com/php-flasher/php-flasher/issues/176) [Laravel] Correctly disable FlasherMiddleware when `inject_assets` is set to false. See [PR #177](https://github.com/php-flasher/php-flasher/pull/177)
* bug [#176](https://github.com/php-flasher/php-flasher/issues/176) [Flasher] Ensure global `timeout` option applies to all requests. See [PR #180](https://github.com/php-flasher/php-flasher/pull/180)
* bug [#176](https://github.com/php-flasher/php-flasher/issues/176) [Laravel] Allow disabling of default flash replacement by setting `flash_bag` to false. See [PR #181](https://github.com/php-flasher/php-flasher/pull/181)
* bug [#176](https://github.com/php-flasher/php-flasher/issues/176) [Flasher] Ensure `flash_bag` option overrides default values instead of appending. See [PR #182](https://github.com/php-flasher/php-flasher/pull/182)
* bug [#176](https://github.com/php-flasher/php-flasher/issues/176) [Laravel] Correctly disable FlasherMiddleware when `inject_assets` is set to false. See [PR #177](https://github.com/php-flasher/php-flasher/pull/177) by [yoeunes](https://github.com/yoeunes)
* bug [#176](https://github.com/php-flasher/php-flasher/issues/176) [Flasher] Ensure global `timeout` option applies to all requests. See [PR #180](https://github.com/php-flasher/php-flasher/pull/180) by [yoeunes](https://github.com/yoeunes)
* bug [#176](https://github.com/php-flasher/php-flasher/issues/176) [Laravel] Allow disabling of default flash replacement by setting `flash_bag` to false. See [PR #181](https://github.com/php-flasher/php-flasher/pull/181) by [yoeunes](https://github.com/yoeunes)
* bug [#176](https://github.com/php-flasher/php-flasher/issues/176) [Flasher] Ensure `flash_bag` option overrides default values instead of appending. See [PR #182](https://github.com/php-flasher/php-flasher/pull/182) by [yoeunes](https://github.com/yoeunes)
+11 -5
View File
@@ -1,3 +1,9 @@
<div align="center">
<a href="https://github.com/php-flasher/php-flasher/blob/2.x/docs/palestine.md">
<img src="https://raw.githubusercontent.com/php-flasher/art/main/palestine-banner-support.svg" width="800px" alt="Help Palestine"/>
</a>
</div>
<p align="center">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/php-flasher/art/main/php-flasher-github-dark.png">
@@ -36,7 +42,7 @@ Shining stars of our community:
<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>
@@ -46,7 +52,7 @@ Shining stars of our community:
</tr>
<tr>
<td align="center" valign="top" width="14.28%"><a href="https://www.instagram.com/lucas.maciel_z"><img src="https://avatars.githubusercontent.com/u/80225404?v=4?s=100" width="100px;" alt="Lucas Maciel"/><br /><sub><b>Lucas Maciel</b></sub></a><br /><a href="#design-LucasStorm" title="Design">🎨</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://siek.io/"><img src="https://avatars.githubusercontent.com/u/5730766?v=4?s=100" width="100px;" alt="Antoni Siek"/><br /><sub><b>Antoni Siek</b></sub></a><br /><a href="https://github.com/php-flasher/php-flasher/commits?author=ImJustToNy" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/AhmedGamal"><img src="https://avatars.githubusercontent.com/u/11786167?v=4?s=100" width="100px;" alt="Ahmed Gamal"/><br /><sub><b>Ahmed Gamal</b></sub></a><br /><a href="https://github.com/php-flasher/php-flasher/commits?author=AhmedGamal" title="Code">💻</a> <a href="https://github.com/php-flasher/php-flasher/commits?author=AhmedGamal" title="Documentation">📖</a></td>
</tr>
</tbody>
</table>
@@ -64,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>
+48 -28
View File
@@ -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 -17
View File
@@ -21,25 +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.6",
"laravel/octane": "^2.3",
"livewire/livewire": "^3.3",
"mockery/mockery": "^1.6.12",
"orchestra/testbench": "^9.0.4",
"overtrue/phplint": "^9.3.1",
"php-cs-fixer/shim": "^3.57.2",
"phpstan/phpstan": "^1.11.1",
"phpstan/phpstan-mockery": "^1.1.2",
"phpstan/phpstan-symfony": "^1.4.0",
"phpunit/phpunit": "^10.5.13",
"livewire/livewire": "^3.0",
"paragonie/random_compat": "^2.0",
"psr/container": "^1.1|^2.0",
"rector/rector": "^1.1.0",
"rector/swiss-knife": "^0.2.3",
"symfony/config": "^7.0",
"symfony/console": "^7.0",
"symfony/dependency-injection": "^7.0",
@@ -47,8 +36,23 @@
"symfony/http-kernel": "^7.0",
"symfony/translation": "^7.0",
"symfony/twig-bundle": "^7.0",
"symfony/ux-twig-component": "^2.14",
"symplify/monorepo-builder": "^11.2.20"
"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
+5517 -5305
View File
File diff suppressed because it is too large Load Diff
+1
View File
@@ -2,6 +2,7 @@
/node_modules
/public/build
/public/hot
/public/vendor/flasher
/public/storage
/storage/*.key
/vendor
+5 -1
View File
@@ -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) {
+9 -4
View File
@@ -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",
+2169 -446
View File
File diff suppressed because it is too large Load Diff
+2 -1
View File
@@ -4,7 +4,8 @@ return [
'inject_assets' => true,
'options' => [
'timeout' => 5_000,
'timeout' => 5000, // in milliseconds
'position' => 'top-right',
],
'flash_bag' => [
+15
View File
@@ -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
View File
@@ -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');
});
+2
View File
@@ -0,0 +1,2 @@
*
!.gitignore
+4
View File
@@ -0,0 +1,4 @@
--ignore-dir=vendor
--ignore-dir=yoeunes
--ignore-dir=node_modules
--ignore-dir=var
+1
View File
@@ -5,6 +5,7 @@
/.env.*.local
/config/secrets/prod/prod.decrypt.private.php
/public/bundles/
/public/vendor/flasherg
/var/
/vendor/
###< symfony/framework-bundle ###
+8 -2
View File
@@ -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.*"
}
}
+940 -16
View File
File diff suppressed because it is too large Load Diff
+2
View File
@@ -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],
];
+35
View File
@@ -0,0 +1,35 @@
flasher:
# Default notification library (e.g., 'flasher', 'toastr', 'noty', etc.)
default: flasher
# Path to the main JavaScript file of PHPFlasher
main_script: '/vendor/flasher/flasher.min.js'
# Path to the stylesheets for PHPFlasher 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
inject_assets: true
# Global options
options:
# timeout in milliseconds
timeout: 5000
position: 'top-right'
# Map Symfony session keys to PHPFlasher notification types
flash_bag:
success: ['success']
error: ['error', 'danger']
warning: ['warning', 'alarm']
info: ['info', 'notice', 'alert']
# Criteria to filter displayed notifications (limit, types)
filter:
# Limit number of displayed notifications
# limit: 5
+62
View File
@@ -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');
}
}
+37
View File
@@ -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
View File
@@ -4,4 +4,4 @@
npm install --force
npm run build
bundle exec jekyll serve --livereload
```
```
+2 -2
View File
@@ -1,6 +1,6 @@
{
"dist/main.css": "/dist/main.73b25228.css",
"dist/main.js": "/dist/main.09f63ce9.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",
+4
View File
@@ -3,3 +3,7 @@ version: "2.x"
title: "Easily add flash messages to your #Laravel or #Symfony projects with PHPFlasher - a powerful, easy-to-use package for improved user engagement & experience"
description: "PHPFlasher - A powerful & easy-to-use package for adding flash messages to Laravel or Symfony projects. Provides feedback to users, improves engagement & enhances user experience. Intuitive design for beginners & experienced developers. A reliable, flexible solution."
versions:
2.x: "https://php-flasher.io/"
1.x: "https://php-flasher.github.io/"
+31 -40
View File
@@ -1,7 +1,6 @@
## <i class="fa-duotone fa-list-radio"></i> Usage
To display a notification message, you can either use the `flash()` helper method or obtain an instance of `flasher` from the service container.
Then, before returning a view or redirecting, call the `success()` method and pass in the desired message to be displayed.
To show a notification message, you can use the `flash()` helper function or get an instance of `flasher` from the service container. Before you return a view or redirect, call one of the notification methods like `success()` and pass in the message you want to display.
{% assign id = '#/ PHPFlasher' %}
{% assign type = 'success' %}
@@ -24,7 +23,7 @@ class BookController
flash('{{ message }}');
// ... redirect or render the view
// ... redirect or render a view
}
/**
@@ -36,18 +35,16 @@ class BookController
$flasher->success('{{ site.data.messages["success"] | sample }}');
// ... redirect or render the view
// ... redirect or render a view
}
}
```
<br />
It's important to choose a message that is clear and concise, and that accurately reflects the outcome of the operation. <br />
In this case, `"Book has been created successfully!"` is already a good message,
but you may want to tailor it to fit the specific context and language of your application.
Choose a message that is clear and tells the user what happened. For example, `"Book has been created successfully!"` is a good message, but you can adjust it to fit your application's context and language.
> Using this package is actually pretty easy. Adding notifications to your application actually require only one line of code.
> Using this package is easy. You can add notifications to your application with just one line of code.
{% assign id = '#/ usage success' %}
{% assign type = 'success' %}
@@ -99,8 +96,7 @@ flash()->{{ type }}('{{ message }}');
---
These four methods `success()`, `error()`, `warning()`, `info()` are simply convenience shortcuts for the `flash()` method,
allowing you to specify the `type` and `message` in a single method call rather than having to pass both as separate arguments to the `flash()` method.
These four methods `success()`, `error()`, `warning()`, and `info()` are shortcuts for the `flash()` method. They let you specify the `type` and `message` in one method call instead of passing them separately to `flash()`.
```php
flash()->flash(string $type, string $message, string $title = null, array $options = [])
@@ -118,22 +114,19 @@ flash()->flash(string $type, string $message, string $title = null, array $optio
flash()->flash('{{ type }}', '{{ message }}');
```
| param | description |
|------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `$type` | Notification type : <span class="text-white bg-green-600 px-2 py-1 rounded">success</span>, <span class="text-white bg-red-600 px-2 py-1 rounded">error</span>, <span class="text-white bg-yellow-600 px-2 py-1 rounded">warning</span>, <span class="text-white bg-blue-600 px-2 py-1 rounded">info</span> |
| `$message` | The body of the message you want to deliver to your user. This may contain HTML. If you add links, be sure to add the appropriate classes for the framework you are using. |
| `$title` | The notification title, Can also include HTML |
| `$options` | Custom options for javascript libraries (toastr, noty, notyf ...etc) |
| Parameter | Description |
|------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `$type` | Notification type: <span class="text-white bg-green-600 px-2 py-1 rounded">success</span>, <span class="text-white bg-red-600 px-2 py-1 rounded">error</span>, <span class="text-white bg-yellow-600 px-2 py-1 rounded">warning</span>, <span class="text-white bg-blue-600 px-2 py-1 rounded">info</span> |
| `$message` | The message you want to show to the user. This can include HTML. If you add links, make sure to add the right classes for your framework. |
| `$title` | The notification title. Can also include HTML. |
| `$options` | Custom options for JavaScript libraries (toastr, noty, notyf, etc.). |
---
<p id="method-options"><a href="#method-options" class="anchor"><i class="fa-duotone fa-link"></i> options</a></p>
The `options()` method allows you to set multiple options at once by passing an array of `key-value` pairs,
while the `option()` method allows you to set a single option by specifying its name and value as separate arguments. <br /><br />
The optional `$append` argument for the `options()` method can be used to specify whether the new options should be appended to any existing options,
or whether they should overwrite them.
The `options()` method lets you set multiple options at once by passing an array of key-value pairs. The `option()` method lets you set a single option by specifying its name and value. The `$append` argument for `options()` decides whether the new options should be added to existing ones (`true`) or replace them (`false`).
```php
flash()->options(array $options, bool $append = true);
@@ -160,7 +153,7 @@ flash()
<p id="method-option"><a href="#method-option" class="anchor"><i class="fa-duotone fa-link"></i> option</a></p>
Set a single option by specifying its name and value as separate arguments.
To set a single option:
```php
flash()->option(string $option, mixed $value);
@@ -185,7 +178,7 @@ flash()
<p id="method-priority"><a href="#method-priority" class="anchor"><i class="fa-duotone fa-link"></i> priority</a></p>
Sets the priority of a flash message, the highest priority will be displayed first.
Set the priority of a flash message. Messages with higher priority appear first.
```php
flash()->priority(int $priority);
@@ -246,17 +239,17 @@ flash()
->info('{{ infoMessage }}');
```
| param | description |
|-------------|--------------------------------------------------------------------------------------------|
| `$priority` | The priority of the notification, the higher the priority, the sooner it will be displayed |
| param | description |
|-------------|-------------------------------------------------------------------|
| `$priority` | The priority of the notification. Higher numbers are shown first. |
---
<p id="method-hops"><a href="#method-hops" class="anchor"><i class="fa-duotone fa-link"></i> hops</a></p>
This method sets the number of requests that the flash message should persist for. By default, flash messages are only displayed for a single request and are then discarded. By setting the number of hops, the flash message will be persisted for multiple requests.
The `hops()` method sets how many requests the flash message should last for. By default, flash messages show for one request. Setting the number of hops makes the message stay for multiple requests.
As an example, with a multi-page form, you may want to store messages until all pages have been filled.
For example, in a multi-page form, you might want to keep messages until all pages are completed.
{% assign id = '#/ usage hops' %}
{% assign type = site.data.messages.types | sample %}
@@ -274,16 +267,15 @@ flash()
->{{ type }}('{{ message }}');
```
| param | description |
|---------|---------------------------------------------------------------|
| `$hops` | indicate how many requests the flash message will persist for |
| param | description |
|---------|-------------------------------------------------------|
| `$hops` | Number of requests the flash message will persist for |
---
<p id="method-translate"><a href="#method-translate" class="anchor"><i class="fa-duotone fa-link"></i> translate</a></p>
This method sets the `locale` to be used for the translation of the flash message. If a non-null value is provided,
the flash message will be translated into the specified language. If null is provided, the **default** `locale` will be used.
The `translate()` method sets the `locale` for translating the flash message. If you provide a locale, the message will be translated to that language. If you pass `null`, it uses the default locale.
```php
flash()->translate(string $locale = null);
@@ -320,18 +312,17 @@ flash()
->{{ type }}('Your request was processed successfully.', 'Congratulations!');
```
| param | description |
|-----------|------------------------------------------------------------------------------|
| `$locale` | The locale to be used for the translation, or null to use the default locale |
| param | description |
|-----------|--------------------------------------------------------------|
| `$locale` | The locale to use for translation, or `null` for the default |
It is **important** to note that the `translate()` method only sets the locale to be used for the translation of the flash message.
It does not actually perform the translation itself.
**Note:** The `translate()` method only sets the locale. It doesn't translate the message by itself.
In order to translate the flash message, you will need to provide the appropriate translation keys in your translation files.
To translate the message, you need to add the translation keys in your translation files.
{% if page.framework == 'laravel' %}
In the above example, to translate the flash message into `Arabic`, you will need to add the following keys to the `resources/lang/ar/messages.php` file:
For example, to translate the message into Arabic, add these keys to `resources/lang/ar/messages.php`:
```php
return [
@@ -342,7 +333,7 @@ return [
{% elsif page.framework == 'symfony' %}
In the above example, to translate the flash message into `Arabic`, you will need to add the following keys to the `translations/messages.ar.yaml` file:
For example, to translate the message into Arabic, add these keys to `translations/messages.ar.yaml`:
```yaml
Your request was processed successfully.: 'تمت العملية بنجاح.'
+14 -13
View File
@@ -18,12 +18,14 @@
<div class="h-16 z-10 top-0 w-screen bg-white border-b border-indigo-200 shadow">
<div id="header-logo" class="lg:container lg:mx-auto px-4 py-2">
<div class="flex items-center flex-no-shrink pt-1">
<a href="/" class="flex items-center">
<span class="pr-2 font-normal font-normal leading-none text-3xl text-indigo-900 hidden sm:block">
<img class="fill-current h-8 mr-2" src="/static/images/php-flasher-logo.svg" />
<sup class="text-xs relative text-grey-dark" style="top: -20px;">{{ site.data.project.version }}</sup>
<div class="flex items-center">
<span class="pr-2 font-normal leading-none text-3xl text-indigo-900 hidden sm:block">
<img class="fill-current h-8 mr-2" src="/static/images/php-flasher-logo.svg" alt="PHPFlasher Logo" />
{% for version in site.data.project.versions %}
<a href="{{ version[1] }}" class="{% if forloop.first %}text-white bg-indigo-500{% else %}text-indigo-600{% endif %} p-1 rounded text-xs relative text-grey-dark hover:bg-indigo-500 hover:scale-110 hover:text-white" style="top: -20px;">{{ version[0] }}</a>
{% endfor %}
</span>
</a>
</div>
<div class="flex-grow"></div>
<a href="#" id="menu-toggle" class="block lg:hidden h-8 w-8 border p-1 border-transparent text-gray-200 hover:text-grey menu-closed">
<svg class="menu-closed:shown fill-current h-full w-full" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20">
@@ -44,7 +46,7 @@
<ul class="list-reset mb-8">
{% for link in section[1] %}
<li class="{% if page.url == link[1] %}bg-indigo-500 {% endif %}px-6 rounded">
<a class="leading-loose text-md inline-block w-full {% if page.url == link[1] %}text-white{% else %}text-gray-900{% endif %}" href="{{ link[1] }}">{{ link[0] }}</a>
<a href="{{ link[1] }}" class="leading-loose text-md inline-block w-full {% if page.url == link[1] %}text-white{% else %}text-gray-900{% endif %}">{{ link[0] }}</a>
</li>
{% endfor %}
</ul>
@@ -56,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>
+2 -2
View File
@@ -2,10 +2,10 @@
"entrypoints": {
"main": {
"css": [
"/dist/main.73b25228.css"
"/dist/main.6f20ecba.css"
],
"js": [
"/dist/main.09f63ce9.js"
"/dist/main.36e31cce.js"
]
}
}
-2
View File
File diff suppressed because one or more lines are too long
+2
View File
File diff suppressed because one or more lines are too long
+1
View File
File diff suppressed because one or more lines are too long
-2
View File
File diff suppressed because one or more lines are too long
+463 -2417
View File
File diff suppressed because it is too large Load Diff
+4 -4
View File
@@ -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,11 +17,11 @@
"@flasher/flasher-toastr": "file:../src/Toastr/Prime/Resources",
"@hotwired/stimulus": "^3.2.2",
"@symfony/stimulus-bridge": "^3.2.2",
"@symfony/webpack-encore": "^4.6.1",
"@symfony/webpack-encore": "^5.0.1",
"noty": "^3.2.0-beta-deprecated",
"notyf": "^3.10.0",
"prismjs": "^1.29.0",
"sweetalert2": "^11.10.8",
"sweetalert2": "^11.6.13",
"toastr": "^2.1.4"
},
"devDependencies": {
@@ -30,7 +30,7 @@
"node-ray": "^2.1.2",
"postcss-import": "^16.1.0",
"postcss-loader": "^7.3.4",
"tailwindcss": "^3.4.3",
"tailwindcss": "^3.4.14",
"webpack-notifier": "^1.15.0"
},
"browserslist": [
+16 -16
View File
@@ -1,6 +1,6 @@
---
permalink: /
description: PHPFlasher is a robust, open-source tool for seamlessly adding flash messages to Laravel or Symfony projects, aimed at improving user interaction and feedback with minimal developer 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
---
@@ -33,36 +33,36 @@ data-controller: flasher
## <i class="fa-duotone fa-list-radio"></i> Introduction
<strong><span class="text-indigo-900">PHP<span class="text-indigo-500">Flasher</span></span></strong> is a powerful, community-driven, open-source project designed to enhance your web applications by providing an intuitive way to display flash messages. These messages serve as immediate feedback for user actions, significantly improving user experience by confirming actions like form submissions, warnings, or errors.
<strong><span class="text-indigo-900">PHP<span class="text-indigo-500">Flasher</span></span></strong> is an open-source tool that helps you add flash messages to your web applications. Flash messages are short messages that give feedback to users after they do something, like submitting a form or encountering an error. These messages improve the user experience by letting users know what happened.
Flash messages are crucial for interactive applications, and <strong><span class="text-indigo-900">PHP<span class="text-indigo-500">Flasher</span></span></strong> makes implementing them in <i class="fa-brands fa-laravel text-red-900 fa-xl"></i> <strong>Laravel</strong> or <i class="fa-brands fa-symfony text-black fa-xl"></i> <strong>Symfony</strong> projects straightforward. With support for session-based message storage, <strong><span class="text-indigo-900">PHP<span class="text-indigo-500">Flasher</span></span></strong> ensures that messages can be easily set and then retrieved for display on subsequent pages, without complex setup.
Flash messages are important for interactive applications. **<strong><span class="text-indigo-900">PHP<span class="text-indigo-500">Flasher</span></span></strong>** makes it easy to add them to **<i class="fa-brands fa-laravel text-red-900 fa-xl"></i> Laravel** or **<i class="fa-brands fa-symfony text-black fa-xl"></i> Symfony** projects. It uses sessions to store messages, so you can set a message on one page and show it on another, without complex setup.
---
### <i class="fa-duotone fa-list-radio"></i> Notification Types
<strong><span class="text-indigo-900">PHP<span class="text-indigo-500">Flasher</span></span></strong> can handle a variety of notification types to suit different feedback scenarios:
**<strong><span class="text-indigo-900">PHP<span class="text-indigo-500">Flasher</span></span></strong>** supports different types of notifications:
> <div class="mt-2"><span class="text-green-700"><i class="fa-solid fa-circle-check fa-xl"></i> success : </span> indicates successful completion of an action.</div>
> <div class="mt-2"><span class="text-blue-600"><i class="fa-solid fa-circle-info fa-xl"></i> info : </span> provides informational messages to users.</div>
> <div class="mt-2"><span class="text-yellow-600"><i class="fa-solid fa-circle-exclamation fa-xl"></i> warning : </span> alerts users to potential issues that are not errors.</div>
> <div class="mt-2"><span class="text-red-600"><i class="fa-solid fa-circle-xmark fa-xl"></i> error : </span> notifies users of errors or problems encountered.</div>
> <div class="mt-2"><span class="text-green-700"><i class="fa-solid fa-circle-check fa-xl"></i> Success</span>: Shows when something works well.</div>
> <div class="mt-2"><span class="text-blue-600"><i class="fa-solid fa-circle-info fa-xl"></i> Info</span>: Gives information to the user.</div>
> <div class="mt-2"><span class="text-yellow-600"><i class="fa-solid fa-circle-exclamation fa-xl"></i> Warning</span>: Alerts about potential issues.</div>
> <div class="mt-2"><span class="text-red-600"><i class="fa-solid fa-circle-xmark fa-xl"></i> Error</span>: Tells the user about an error.</div>
---
## <i class="fa-duotone fa-list-radio"></i> Why <strong><span class="text-indigo-900">PHP<span class="text-indigo-500">Flasher</span></span></strong> ?
## <i class="fa-duotone fa-list-radio"></i> Why **<strong><span class="text-indigo-900">PHP<span class="text-indigo-500">Flasher</span></span></strong>**?
- **Broad Library Support**: PHPFlasher integrates with several popular notification libraries, including [toastr.js](/library/toastr/), [SweetAlert 2](/library/sweetalert/), [Noty](/library/noty/), and [Notyf](/library/notyf/).
- **Ease of Use**: Designed with all levels of developers in mind, from beginners to experienced professionals.
- **Flexibility**: Offers extensive customization options for notification styling and behaviors.
- **Framework Compatibility**: Seamlessly integrates with <i class="fa-brands fa-laravel text-red-900 fa-xl"></i> <strong>Laravel</strong> and <i class="fa-brands fa-symfony text-black fa-xl"></i> <strong>Symfony</strong>, with options for custom adapter creation.
- **Developer Friendly**: Features PHPStorm autocomplete for easier coding and integration.
- **Supports Many Libraries**: Works with popular notification libraries like [toastr.js](/library/toastr/), [SweetAlert 2](/library/sweetalert/), [Noty](/library/noty/), and [Notyf](/library/notyf/).
- **Easy to Use**: Designed for all developers, from beginners to experts.
- **Flexible**: You can customize how the notifications look and behave.
- **Framework Compatibility**: Integrates smoothly with <i class="fa-brands fa-laravel text-red-900 fa-xl"></i> <strong>Laravel</strong> and <i class="fa-brands fa-symfony text-black fa-xl"></i> <strong>Symfony</strong>. You can also create custom adapters.
- **Developer-Friendly**: Features like autocomplete in PHPStorm make coding easier.
---
## <i class="fa-duotone fa-list-radio"></i> Getting Started
Dive into <strong><span class="text-indigo-900">PHP<span class="text-indigo-500">Flasher</span></span></strong> with our straightforward guides and documentation to seamlessly integrate flash messaging into your projects:
Start using **<strong><span class="text-indigo-900">PHP<span class="text-indigo-500">Flasher</span></span></strong>** with our easy guides:
- [**Symfony Guide**](/Symfony/)
- [**Laravel Guide**](/Laravel/)
@@ -73,4 +73,4 @@ Dive into <strong><span class="text-indigo-900">PHP<span class="text-indigo-500"
## <i class="fa-duotone fa-list-radio"></i> Contributions
<strong><span class="text-indigo-900">PHP<span class="text-indigo-500">Flasher</span></span></strong> thrives on community contributions. Your feedback, code contributions, and feature suggestions are invaluable to us. Explore our [GitHub repository](https://github.com/php-flasher/php-flasher) to see how you can become part of the <strong><span class="text-indigo-900">PHP<span class="text-indigo-500">Flasher</span></span></strong> community. Let's build something great together <i class="fa-solid fa-heart text-red-600"></i>!
**<strong><span class="text-indigo-900">PHP<span class="text-indigo-500">Flasher</span></span></strong>** grows with help from the community. We welcome your feedback, code contributions, and ideas. Check out our [GitHub repository](https://github.com/php-flasher/php-flasher) to join the **<strong><span class="text-indigo-900">PHP<span class="text-indigo-500">Flasher</span></span></strong>** community. Let's build something great together! <i class="fa-solid fa-heart text-red-600"></i>
+8 -8
View File
@@ -1,16 +1,16 @@
---
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> offers a solid integration with Inertia.js
<strong><span class="text-indigo-900">PHP<span class="text-indigo-500">Flasher</span></span></strong> works well with Inertia.js.
## <i class="fa-duotone fa-list-radio"></i> Installation
To integrate <strong><span class="text-indigo-900">PHP<span class="text-indigo-500">Flasher</span></span></strong> with Inertia.js, follow the same installation steps as for the [Laravel Installation](/laravel) package.
To use **<strong><span class="text-indigo-900">PHP<span class="text-indigo-500">Flasher</span></span></strong>** with Inertia.js, install it the same way as in the [Laravel Installation](/laravel) guide.
Additionally, include `@flasher/flasher` in your package.json by adding the following line:
Also, add `@flasher/flasher` to your `package.json`:
```json
"@flasher/flasher": "file:vendor/php-flasher/flasher/Resources"
@@ -26,7 +26,7 @@ npm install --force
## <i class="fa-duotone fa-list-radio"></i> Usage
Dispatch `notifications` from your `HandleInertiaRequests` middleware shared data.
Send `notifications` from your `HandleInertiaRequests` middleware.
```php
<?php
@@ -37,7 +37,7 @@ class HandleInertiaRequests extends Middleware
public function share(Request $request): array
{
return array_merge(parent::share($request), [
'messages' => flash()->render([], 'array'),
'messages' => flash()->render('array'),
]);
}
}
@@ -45,7 +45,7 @@ class HandleInertiaRequests extends Middleware
---
Then render your `notifications` from your `Layout.vue` file like the following:
Then, display your `notifications` in your `Layout.vue` file:
```html
// resources/js/Shared/Layout.vue
@@ -65,7 +65,7 @@ export default {
</script>
```
All you have to do now, is to trigger you notification from anywhere in your application.
Now, you can trigger notifications from anywhere in your application.
```php
<?php
+1 -1
View File
@@ -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. Its 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,
+85 -69
View File
@@ -2,15 +2,15 @@
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
---
## <i class="fa-duotone fa-list-radio"></i> Requirements
<strong><span class="text-indigo-900">PHP<span class="text-indigo-500">Flasher</span></span></strong> offers a seamless way to incorporate flash notifications in <i class="fa-brands fa-laravel text-red-900 fa-xl"></i> <strong>Laravel</strong> projects, enhancing user feedback with minimal setup.
**<strong><span class="text-indigo-900">PHP<span class="text-indigo-500">Flasher</span></span></strong>** helps you easily add flash notifications to your **<i class="fa-brands fa-laravel text-red-900 fa-xl"></i> Laravel** projects, improving user feedback with minimal setup.
Requirements for using <strong><span class="text-indigo-900">PHP<span class="text-indigo-500">Flasher</span></span></strong> with Laravel:
To use **<strong><span class="text-indigo-900">PHP<span class="text-indigo-500">Flasher</span></span></strong>** with Laravel, you need:
> <i class="fa-brands fa-php fa-2xl text-blue-900 mr-1 mb-1"></i> **PHP** v8.2 or higher
> <i class="fa-brands fa-laravel fa-2xl text-red-900 mr-1 ml-4"></i> **Laravel** v11.0 or higher
@@ -19,13 +19,15 @@ Requirements for using <strong><span class="text-indigo-900">PHP<span class="tex
## <i class="fa-duotone fa-list-radio"></i> Installation
<strong><span class="text-indigo-900">PHP<span class="text-indigo-500">Flasher</span></span></strong>'s modular design lets you select and install only the components your project needs.
**PHPFlasher** is modular, so you can install only the parts you need.
Run this command to install it:
```shell
composer require php-flasher/flasher-laravel
```
After installation, you need to run another command to set up the necessary assets for <strong><span class="text-indigo-900">PHP<span class="text-indigo-500">Flasher</span></span></strong>:
After installing, run this command to set up the required assets:
```shell
php artisan flasher:install
@@ -39,37 +41,42 @@ php artisan flasher:install
## <i class="fa-duotone fa-list-radio"></i> Configuration
As optional, if you want to modify the default configuration, you can publish the configuration file:
If you want to change the default settings, you can publish the configuration file:
```bash
php artisan flasher:install --config
```
The configuration file will be located at `config/flasher.php` and will have the following content:
This will create a file at `config/flasher.php` with the following content:
```php
<?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,
// Configuration for the flash bag (converting Laravel flash messages)
// Map Laravel session keys to PHPFlasher types
// Enable message translation using Laravel's translation service
'translate' => true,
// Map Laravel flash message keys to notification types
'flash_bag' => [
'success' => ['success'],
'error' => ['error', 'danger'],
@@ -77,22 +84,33 @@ 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',
// ],
// ],
];
```
---
## <i class="fa-duotone fa-list-radio"></i> Presets
You can create a preset for a custom notification that you want to reuse in multiple places by adding a presets entry in the configuration file.
You can create a preset for a custom notification that you want to reuse in multiple places by adding a `presets` entry in the configuration file.
> You can think of a preset as a pre-defined message that you can use in multiple locations. <br>
> A preset is like a pre-defined message you can use in many places.
For example, you can create a preset named `entity_saved` in the configuration file and then use
For example, create a preset named `entity_saved`:
{% assign id = '#/ laravel preset' %}
{% assign type = 'success' %}
@@ -115,7 +133,7 @@ return [
];
```
To use the preset, you can call the `preset()` method and pass the name of the preset as the first argument:
To use the preset, call the `preset()` method and pass the name of the preset:
```php
{{ id }}
@@ -139,7 +157,7 @@ class BookController
<p id="preset-variables"><a href="#preset-variables" class="anchor"><i class="fa-duotone fa-link"></i> Variables</a></p>
Presets can also contain variables that can be substituted by using the translation system. Take the following example where you have a preset showing a personalised welcome message to the user.
Presets can also have variables that you can replace using the translation system. For example, you can have a preset that shows a personalized welcome message.
```php
<?php // config/flasher.php
@@ -154,7 +172,7 @@ return [
];
```
In the translations file you can define `welcome_back_user` with the message containing the variable `:username`.
In your translation file, define `welcome_back_user` with a message containing the variable `:username`.
```php
<?php // /resources/lang/vendor/flasher/en/messages.php
@@ -164,7 +182,7 @@ return [
];
```
If you want to substitute the `:username` in the above translation with a username in the controller, you can achieve this by passing an array of values to be substituted as the second argument.
To replace `:username` with the actual username in your controller, pass an array with the values to substitute as the second argument:
```php
class BookController
@@ -180,10 +198,9 @@ class BookController
## <i class="fa-duotone fa-list-radio"></i> RTL support
<strong><span class="text-indigo-900">PHP<span class="text-indigo-500">Flasher</span></span></strong> makes it easy to incorporate <i class="fa-duotone fa-signs-post text-indigo-900 mr-1 fa-lg"></i> **right-to-left** languages like `Arabic` or `Hebrew`.
it automatically detects the text direction and handles the necessary adjustments for you.
<strong><span class="text-indigo-900">PHP<span class="text-indigo-500">Flasher</span></span></strong> makes it easy to use <i class="fa-duotone fa-signs-post text-indigo-900 mr-1 fa-lg"></i> **right-to-left** languages like `Arabic` or `Hebrew`. It automatically detects the text direction and adjusts accordingly.
Simply make sure the translation service is enabled and let <strong><span class="text-indigo-900">PHP<span class="text-indigo-500">Flasher</span></span></strong> handle the rest.
Just make sure the translation service is enabled, and <strong><span class="text-indigo-900">PHP<span class="text-indigo-500">Flasher</span></span></strong> will handle the rest.
{% assign id = '#/ phpflasher rtl' %}
{% assign type = 'success' %}
@@ -204,14 +221,13 @@ flash()
## <i class="fa-duotone fa-list-radio"></i> Translation
<strong><span class="text-indigo-900">PHP<span class="text-indigo-500">Flasher</span></span></strong> allows you to translate your notification `messages` and `presets`, it comes with `Arabic`, `English`, `French`, `German`, `Spanish`, `Portuguese`, `Russian`, and `Chinese` translations out of the box. but you can easily add your own translations.
<strong><span class="text-indigo-900">PHP<span class="text-indigo-500">Flasher</span></span></strong> lets you translate your notification `messages` and `presets`. It comes with translations for `Arabic`, `English`, `French`, `German`, `Spanish`, `Portuguese`, `Russian`, and `Chinese`. You can also add your own translations.
For example, to override the `English` translation strings for <strong><span class="text-indigo-900">PHP<span class="text-indigo-500">Flasher</span></span></strong>, you can create a language file at the following location:
**`/resources/lang/vendor/flasher/en/messages.php`**.
To override the `English` translations for <strong><span class="text-indigo-900">PHP<span class="text-indigo-500">Flasher</span></span></strong>, create a file at `/resources/lang/vendor/flasher/en/messages.php`.
In this file, you should **only** define the translation strings you want to override. Any translation strings that you don't override will still be loaded from <strong><span class="text-indigo-900">PHP<span class="text-indigo-500">Flasher</span></span></strong>'s original language files.
In this file, define only the translation strings you want to change. Any strings you don't override will use <strong><span class="text-indigo-900">PHP<span class="text-indigo-500">Flasher</span></span></strong>'s default translations.
Here are examples of the default translation keys for `Arabic`, `English`, and `French` in <strong><span class="text-indigo-900">PHP<span class="text-indigo-500">Flasher</span></span></strong>:
Here are examples of the default translation keys for `Arabic`, `English`, and `French`:
```php
<?php // /resources/lang/vendor/flasher/ar/messages.php
@@ -267,7 +283,7 @@ return [
];
```
> These translation files facilitate localizing notifications to match user preferences and ensure that your applications can communicate effectively across different linguistic contexts.
> These translation files help you localize notifications to match user preferences, so your application can communicate effectively in different languages.
{% assign id = '#/ laravel arabic translations' %}
{% assign successMessage = 'تم إنشاء الملف' %}
@@ -276,33 +292,33 @@ return [
{% assign infoMessage = 'سيتم تحديث هذه الصفحة في غضون 10 دقائق.' %}
<script type="text/javascript">
messages["{{ id }}"] = [
messages['{{ id }}'] = [
{
handler: "flasher",
type: "success",
message: "{{ successMessage }}",
title: "نجاح",
handler: 'flasher',
type: 'success',
message: '{{ successMessage }}',
title: 'نجاح',
options: {},
},
{
handler: "flasher",
type: "error",
message: "{{ errorMessage }}",
title: "خطأ",
handler: 'flasher',
type: 'error',
message: '{{ errorMessage }}',
title: 'خطأ',
options: {},
},
{
handler: "flasher",
type: "warning",
message: "{{ warningMessage }}",
title: "تحذير",
handler: 'flasher',
type: 'warning',
message: '{{ warningMessage }}',
title: 'تحذير',
options: {},
},
{
handler: "flasher",
type: "info",
message: "{{ infoMessage }}",
title: "معلومة",
handler: 'flasher',
type: 'info',
message: '{{ infoMessage }}',
title: 'معلومة',
options: {},
},
@@ -332,33 +348,33 @@ flash()->info('{{ infoMessage }}');
{% assign infoMessage = "Cette page sera mise à jour dans 10 minutes."%}
<script type="text/javascript">
messages["{{ id }}"] = [
messages['{{ id }}'] = [
{
handler: "flasher",
type: "success",
message: "{{ successMessage }}",
title: "Succès",
handler: 'flasher',
type: 'success',
message: '{{ successMessage }}',
title: 'Succès',
options: {},
},
{
handler: "flasher",
type: "error",
message: "{{ errorMessage }}",
title: "Erreur",
handler: 'flasher',
type: 'error',
message: '{{ errorMessage }}',
title: 'Erreur',
options: {},
},
{
handler: "flasher",
type: "warning",
message: "{{ warningMessage }}",
title: "Avertissement",
handler: 'flasher',
type: 'warning',
message: '{{ warningMessage }}',
title: 'Avertissement',
options: {},
},
{
handler: "flasher",
type: "info",
message: "{{ infoMessage }}",
title: "Information",
handler: 'flasher',
type: 'info',
message: '{{ infoMessage }}',
title: 'Information',
options: {},
},
+7 -3
View File
@@ -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
```
---
+7 -3
View File
@@ -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
```
---
+7 -3
View File
@@ -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
```
---
+7 -3
View File
@@ -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
```
---
+8 -9
View File
@@ -1,11 +1,11 @@
---
permalink: /livewire/
title: Livewire
description: Learn how to seamlessly integrate flash notification messages into 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
---
<strong><span class="text-indigo-900">PHP<span class="text-indigo-500">Flasher</span></span></strong> provides a seamless integration with Livewire v3.
**<strong><span class="text-indigo-900">PHP<span class="text-indigo-500">Flasher</span></span></strong>** works seamlessly with Livewire v3.
## <i class="fa-duotone fa-list-radio"></i> Requirements
@@ -16,13 +16,13 @@ adapter: flasher
## <i class="fa-duotone fa-list-radio"></i> Installation
To integrate <strong><span class="text-indigo-900">PHP<span class="text-indigo-500">Flasher</span></span></strong> with Livewire, follow the same installation steps as for the [Laravel Installation](/laravel) package.
To use **<strong><span class="text-indigo-900">PHP<span class="text-indigo-500">Flasher</span></span></strong>** with Livewire, follow the same installation steps as in the [Laravel Installation](/laravel) guide.
```shell
composer require php-flasher/flasher-laravel
```
After installation, you need to run another command to set up the necessary assets for <strong><span class="text-indigo-900">PHP<span class="text-indigo-500">Flasher</span></span></strong>:
After installing, run this command to set up the required assets:
```shell
php artisan flasher:install
@@ -64,7 +64,7 @@ class UserComponent extends Component
## <i class="fa-duotone fa-list-radio"></i> Events
For sweetalert you can listen to `sweetalert:confirmed`, `sweetalert:denied` and `sweetalert:dismissed` from withing you component
For SweetAlert, you can listen to `sweetalert:confirmed`, `sweetalert:denied`, and `sweetalert:dismissed` events within your component.
<script type="text/javascript">
messages["#/ livewire events"] = {
@@ -125,7 +125,7 @@ class UserComponent extends Component
### <i class="fa-duotone fa-list-radio"></i> event handlers context
Every listener method accept an **array $payload** parameter which contain the following data :
Each listener method accepts an **array $payload** parameter, which contains:
```php
public function sweetalertConfirmed(array $payload)
@@ -135,6 +135,5 @@ public function sweetalertConfirmed(array $payload)
}
```
> **promise** : the resolved promise from **sweetalert**.
> **envelope** : the notification where the event happened.
- **promise**: The resolved promise from **SweetAlert**.
- **envelope**: The notification where the event happened.
+62 -41
View File
@@ -1,15 +1,15 @@
---
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
---
## <i class="fa-duotone fa-list-radio"></i> Requirements
<strong><span class="text-indigo-900">PHP<span class="text-indigo-500">Flasher</span></span></strong> offers a seamless way to incorporate flash notifications in <i class="fa-brands fa-symfony text-black fa-xl"></i> <strong>Symfony</strong> projects, enhancing user feedback with minimal setup.
**<strong><span class="text-indigo-900">PHP<span class="text-indigo-500">Flasher</span></span></strong>** helps you easily add flash notifications to your **<i class="fa-brands fa-symfony text-black fa-xl"></i> Symfony** projects, improving user feedback with minimal setup.
Requirements for using <strong><span class="text-indigo-900">PHP<span class="text-indigo-500">Flasher</span></span></strong> with Symfony:
To use **<strong><span class="text-indigo-900">PHP<span class="text-indigo-500">Flasher</span></span></strong>** with Symfony, you need:
> <i class="fa-brands fa-php fa-2xl text-blue-900 mr-1 mb-1"></i> **PHP** v8.2 or higher
> <i class="fa-brands fa-symfony fa-2xl text-black mr-1 ml-4"></i> **Symfony** v7.0 or higher
@@ -18,13 +18,15 @@ Requirements for using <strong><span class="text-indigo-900">PHP<span class="tex
## <i class="fa-duotone fa-list-radio"></i> Installation
<strong><span class="text-indigo-900">PHP<span class="text-indigo-500">Flasher</span></span></strong>'s modular design lets you select and install only the components your project needs.
**<strong><span class="text-indigo-900">PHP<span class="text-indigo-500">Flasher</span></span></strong>** is modular. You can install only the parts you need.
Run this command to install it:
```shell
composer require php-flasher/flasher-symfony
```
After installation, you need to run another command to set up the necessary assets for <strong><span class="text-indigo-900">PHP<span class="text-indigo-500">Flasher</span></span></strong>:
After installing, run this command to set up the required assets:
```shell
php bin/console flasher:install
@@ -38,56 +40,77 @@ php bin/console flasher:install
## <i class="fa-duotone fa-list-radio"></i> Configuration
As optional, if you want to modify the default configuration, you can publish the configuration file:
If you want to change the default settings, you can publish the configuration file:
```bash
php bin/console flasher:install --config
```
The configuration file will be located at `config/packages/flasher.yaml` and will have the following content:
This will create a file at `config/packages/flasher.yaml` with the following content:
```yaml
# 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
# Map Symfony session keys to PHPFlasher notification types
flash_bag:
success: ['success']
error: ['error', 'danger']
warning: ['warning', 'alarm']
info: ['info', 'notice', 'alert']
# Enable message translation using Symfony's translation service
translate: true
# 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']
# 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
```
---
## <i class="fa-duotone fa-list-radio"></i> Presets
You can create a preset for a custom notification that you want to reuse in multiple places by adding a presets entry in the configuration file.
You can create a preset for a custom notification that you want to reuse in multiple places. Add a `presets` entry in the configuration file.
> You can think of a preset as a pre-defined message that you can use in multiple locations. <br>
> A preset is like a pre-defined message you can use in many places.
For example, you can create a preset named `entity_saved` in the configuration file and then use
For example, create a preset named `entity_saved`:
{% assign id = '#/ symfony preset' %}
{% assign type = 'success' %}
@@ -107,7 +130,7 @@ flasher:
title: '{{ title }}'
```
To use the preset, you can call the `preset()` method and pass the name of the preset as the first argument:
To use the preset, call the `preset()` method and pass the name of the preset:
```php
{{ id }}
@@ -119,7 +142,7 @@ class BookController
flash()->preset('entity_saved');
```
This is equivalent to:
This is the same as:
```php
class BookController
@@ -131,7 +154,7 @@ class BookController
<p id="preset-variables"><a href="#preset-variables" class="anchor"><i class="fa-duotone fa-link"></i> Variables</a></p>
Presets can also contain variables that can be substituted by using the translation system. Take the following example where you have a preset showing a personalised welcome message to the user.
Presets can also have variables that you can replace using the translation system. For example, you can have a preset that shows a personalized welcome message.
```yaml
# config/packages/flasher.yaml
@@ -143,7 +166,7 @@ flasher:
message: welcome_back_user
```
In the translations file you can define `welcome_back_user` with the message containing the variable `:username`.
In your translation file, define `welcome_back_user` with a message containing the variable `:username`.
```yaml
# translations/flasher.en.yaml
@@ -151,7 +174,7 @@ In the translations file you can define `welcome_back_user` with the message con
welcome_back_user: Welcome back :username
```
If you want to substitute the `:username` in the above translation with a username in the controller, you can achieve this by passing an array of values to be substituted as the second argument.
To replace `:username` with the actual username in your controller, pass an array with the values to substitute as the second argument:
```php
class BookController
@@ -169,10 +192,9 @@ class BookController
## <i class="fa-duotone fa-list-radio"></i> RTL support
<strong><span class="text-indigo-900">PHP<span class="text-indigo-500">Flasher</span></span></strong> makes it easy to incorporate <i class="fa-duotone fa-signs-post text-indigo-900 mr-1 fa-lg"></i> **right-to-left** languages like `Arabic` or `Hebrew`.
it automatically detects the text direction and handles the necessary adjustments for you.
**<strong><span class="text-indigo-900">PHP<span class="text-indigo-500">Flasher</span></span></strong>** makes it easy to use <i class="fa-duotone fa-signs-post text-indigo-900 mr-1 fa-lg"></i> **right-to-left** languages like `Arabic` or `Hebrew`. It automatically detects the text direction and adjusts accordingly.
Simply make sure the translation service is enabled and let <strong><span class="text-indigo-900">PHP<span class="text-indigo-500">Flasher</span></span></strong> handle the rest.
Just make sure the translation service is enabled, and **<strong><span class="text-indigo-900">PHP<span class="text-indigo-500">Flasher</span></span></strong>** will handle the rest.
{% assign id = '#/ phpflasher rtl' %}
{% assign type = 'success' %}
@@ -193,14 +215,13 @@ flash()
## <i class="fa-duotone fa-list-radio"></i> Translation
<strong><span class="text-indigo-900">PHP<span class="text-indigo-500">Flasher</span></span></strong> allows you to translate your notification `messages` and `presets`, it comes with `Arabic`, `English`, `French`, `German`, `Spanish`, `Portuguese`, `Russian`, and `Chinese` translations out of the box. but you can easily add your own translations.
**<strong><span class="text-indigo-900">PHP<span class="text-indigo-500">Flasher</span></span></strong>** lets you translate your notification `messages` and `presets`. It comes with translations for `Arabic`, `English`, `French`, `German`, `Spanish`, `Portuguese`, `Russian`, and `Chinese`. You can also add your own translations.
For example, to override the `English` translation strings for <strong><span class="text-indigo-900">PHP<span class="text-indigo-500">Flasher</span></span></strong>, you can create a language file at the following location:
**`translations/flasher.en.yaml`**.
To override the `English` translations for <strong><span class="text-indigo-900">PHP<span class="text-indigo-500">Flasher</span></span></strong>, create a file at `translations/flasher.en.yaml`.
In this file, you should **only** define the translation strings you want to override. Any translation strings that you don't override will still be loaded from <strong><span class="text-indigo-900">PHP<span class="text-indigo-500">Flasher</span></span></strong>'s original language files.
In this file, define **only** the translation strings you want to change. Any strings you don't override will use <strong><span class="text-indigo-900">PHP<span class="text-indigo-500">Flasher</span></span></strong>'s default translations.
Here are examples of the default translation keys for `Arabic`, `English`, and `French` in <strong><span class="text-indigo-900">PHP<span class="text-indigo-500">Flasher</span></span></strong>:
Here are examples of the default translation keys for `Arabic`, `English`, and `French`:
```yaml
# translations/flasher.ar.yaml
@@ -250,7 +271,7 @@ The resource was deleted: 'La ressource :resource a été supprimée'
resource: ''
```
> These translation files facilitate localizing notifications to match user preferences and ensure that your applications can communicate effectively across different linguistic contexts.
> These translation files help you localize notifications to match user preferences, so your application can communicate effectively in different languages.
{% assign id = '#/ symfony arabic translations' %}
{% assign successMessage = 'تم إنشاء الملف' %}
+31
View File
@@ -0,0 +1,31 @@
# Support Palestine
# Donate via trusted institutions
**Donate via trusted institutions**
The best way to financially support Palestine is by donating directly to one of the trusted institutions in your country.
**Donate to associations acting in Palestine**
- [Doctors without borders](https://donate.doctorswithoutborders.org/secure/rr-donate-monthly-web?source=ADU2011U0W46) : Provides medical help to palestinians.
- [WFP - World Food Programme](https://donate.wfp.org/1244/donation/single/?campaign=3493) : Provides food to palestinians.
- [Palestine red crescent society](https://www.palestinercs.org/en/Donation) : Provides medical help to palestinians.
- [UNRWA - United Nations Relief and Works](https://donate.unrwa.org/-landing-page/en_EN) : Provides food and cash assistance to palestinians.
- [Save the children](https://donate.savethechildren.org/en) : Provides protection for children.
- [Alkhidmat](https://alkhidmat.org/donate) : Provides food and medical help to palestinians.
**Other way to support**
- 🗣 Dont be silent:
- Add banners to your open source project and profile.
- Protest against the war in your city.
- Demand severe sanctions against Israel and support for Palestine from your leaders.
- Reach out to Palestinian friends, offer help.
- ❌ Boycott Israeli businesses:
- Cancel subscriptions and stop giving your money to Israeli software, dependencies and infrastructure companies.
- Cancel subscriptions and stop giving your money to companies which support israel.
- Suffocate Israeli economy to limit its ability to fund the war!
- 📰 Resist propaganda:
- Educate yourself and others on the Israeli threat.
- Check out common misbeliefs.
+1 -2
View File
@@ -1,7 +1,6 @@
/** @type {import('tailwindcss').Config} */
module.exports = {
content: [
'./_site/**/*.html',
'./_site/**/*.js',
'./_site/**/*.{html,js}',
],
}
+2
View File
@@ -8,4 +8,6 @@ return static function (MBConfig $config) {
$config->packageDirectories([
__DIR__.'/src',
]);
$config->packageAliasFormat('2.x-dev');
};
+4368 -3437
View File
File diff suppressed because it is too large Load Diff
+24 -22
View File
@@ -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,40 +18,42 @@
"ncu": "ncu -u && npm run ncu --workspaces"
},
"devDependencies": {
"@antfu/eslint-config": "2.12.2",
"@babel/core": "^7.24.5",
"@babel/preset-env": "^7.24.5",
"@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.12.12",
"@typescript-eslint/eslint-plugin": "7.5.0",
"@typescript-eslint/parser": "^7.10.0",
"autoprefixer": "^10.4.19",
"browserslist": "^4.23.0",
"cross-env": "7.0.3",
"@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.24.0",
"cross-env": "^7.0.3",
"cssnano": "^6.1.2",
"eslint": "^8.57.0",
"eslint": "^8.57.1",
"eslint-config-airbnb-typescript": "^18.0.0",
"eslint-config-prettier": "^9.1.0",
"eslint-import-resolver-typescript": "^3.6.1",
"eslint-plugin-babel": "5.3.1",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-prettier": "^5.1.3",
"eslint-import-resolver-typescript": "^3.6.3",
"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.18.0",
"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",
"sass": "^1.77.2",
"rollup-plugin-progress": "^1.1.2",
"sass": "^1.80.3",
"ts-node": "^10.9.2",
"tslib": "^2.6.2",
"typescript": "^5.4.5"
"tslib": "^2.8.0",
"typescript": "^5.6.3"
}
}
+8
View File
@@ -5,6 +5,11 @@ includes:
- vendor/phpstan/phpstan-symfony/rules.neon
- vendor/larastan/larastan/extension.neon
- vendor/phpstan/phpstan-mockery/extension.neon
- vendor/phpstan/phpstan-phpunit/extension.neon
- vendor/phpstan/phpstan-phpunit/rules.neon
rules:
- Spatie\Ray\PHPStan\RemainingRayCallRule
parameters:
level: 9
@@ -14,3 +19,6 @@ parameters:
- tests/
tmpDir: .cache/phpstan
ignoreErrors:
- '#Call to method .+ with .+ will always evaluate to true.#'
+7 -14
View File
@@ -2,13 +2,7 @@
declare(strict_types=1);
use Rector\Config\RectorConfig;
use Rector\Php55\Rector\String_\StringClassNameToClassConstantRector;
use Rector\PHPUnit\CodeQuality\Rector\Class_\AddSeeTestAnnotationRector;
use Rector\PHPUnit\Set\PHPUnitSetList;
use Rector\Set\ValueObject\SetList;
return RectorConfig::configure()
return Rector\Config\RectorConfig::configure()
->withPaths([
__DIR__.'/src/',
__DIR__.'/tests/',
@@ -16,12 +10,11 @@ return RectorConfig::configure()
])
->withRootFiles()
->withSets([
SetList::PHP_82,
PHPUnitSetList::PHPUNIT_100,
PHPUnitSetList::ANNOTATIONS_TO_ATTRIBUTES,
PHPUnitSetList::PHPUNIT_CODE_QUALITY,
Rector\Set\ValueObject\SetList::PHP_82,
Rector\PHPUnit\Set\PHPUnitSetList::PHPUNIT_110,
Rector\PHPUnit\Set\PHPUnitSetList::ANNOTATIONS_TO_ATTRIBUTES,
Rector\PHPUnit\Set\PHPUnitSetList::PHPUNIT_CODE_QUALITY,
])
->withSkip([
AddSeeTestAnnotationRector::class,
StringClassNameToClassConstantRector::class,
->withRules([
Spatie\Ray\Rector\RemoveRayCallRector::class,
]);
+2
View File
@@ -12,6 +12,7 @@ import postcss from 'rollup-plugin-postcss'
import cssnano from 'cssnano'
import autoprefixer from 'autoprefixer'
import discardComments from 'postcss-discard-comments'
import progress from 'rollup-plugin-progress'
const isProduction = process.env.NODE_ENV === 'production'
@@ -68,6 +69,7 @@ function createPlugins({ name, path, assets }) {
: []
return [
progress(),
...(isProduction ? [clear({ targets: [`${path}/dist`, `${path}/public`] })] : []),
postcss({ extract: filename, plugins: isProduction ? postcssPlugins : [] }),
...commonPlugins(path),
-23
View File
@@ -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! 🙌
+4 -4
View File
@@ -90,12 +90,12 @@ final class InstallCommand extends Command
$this->publishConfig($plugin, $configFile);
}
$status = sprintf('<fg=green;options=bold>%s</>', '\\' === \DIRECTORY_SEPARATOR ? 'OK' : "\xE2\x9C\x94" /* HEAVY CHECK MARK (U+2714) */);
$output->writeln(sprintf(' %s <fg=blue;options=bold>%s</>', $status, $plugin->getAlias()));
$status = \sprintf('<fg=green;options=bold>%s</>', '\\' === \DIRECTORY_SEPARATOR ? 'OK' : "\xE2\x9C\x94" /* HEAVY CHECK MARK (U+2714) */);
$output->writeln(\sprintf(' %s <fg=blue;options=bold>%s</>', $status, $plugin->getAlias()));
} catch (\Exception $e) {
$exitCode = self::FAILURE;
$status = sprintf('<fg=red;options=bold>%s</>', '\\' === \DIRECTORY_SEPARATOR ? 'ERROR' : "\xE2\x9C\x98" /* HEAVY BALLOT X (U+2718) */);
$output->writeln(sprintf(' %s <fg=blue;options=bold>%s</> <error>%s</error>', $status, $plugin->getAlias(), $e->getMessage()));
$status = \sprintf('<fg=red;options=bold>%s</>', '\\' === \DIRECTORY_SEPARATOR ? 'ERROR' : "\xE2\x9C\x98" /* HEAVY BALLOT X (U+2718) */);
$output->writeln(\sprintf(' %s <fg=blue;options=bold>%s</> <error>%s</error>', $status, $plugin->getAlias(), $e->getMessage()));
}
}
+10 -15
View File
@@ -13,37 +13,32 @@ use Illuminate\Support\Facades\Facade;
* @method static NotificationBuilder title(string $message)
* @method static NotificationBuilder message(string $message)
* @method static NotificationBuilder type(string $message)
* @method static NotificationBuilder options(array $options, bool $merge = true)
* @method static NotificationBuilder options(array<string, mixed> $options, bool $merge = true)
* @method static NotificationBuilder option(string $name, $value)
* @method static NotificationBuilder priority(int $priority)
* @method static NotificationBuilder hops(int $amount)
* @method static NotificationBuilder keep()
* @method static NotificationBuilder delay(int $delay)
* @method static NotificationBuilder translate(array $parameters = [], ?string $locale = null)
* @method static NotificationBuilder translate(array<string, mixed> $parameters = [], ?string $locale = null)
* @method static NotificationBuilder handler(string $handler)
* @method static NotificationBuilder context(array $context)
* @method static NotificationBuilder context(array<string, mixed> $context)
* @method static NotificationBuilder when(bool|\Closure $condition)
* @method static NotificationBuilder unless(bool|\Closure $condition)
* @method static NotificationBuilder with(StampInterface[] $stamps = array())
* @method static NotificationBuilder withStamp(StampInterface $stamp)
* @method static Envelope success(string $message, array $options = [], ?string $title = null)
* @method static Envelope error(string $message, array $options = [], ?string $title = null)
* @method static Envelope info(string $message, array $options = [], ?string $title = null)
* @method static Envelope warning(string $message, array $options = [], ?string $title = null)
* @method static Envelope flash(?string $type = null, ?string $message = null, array $options = [], ?string $title = null)
* @method static Envelope preset(string $preset, array $parameters = [])
* @method static Envelope success(string $message, array<string, mixed> $options = [], ?string $title = null)
* @method static Envelope error(string $message, array<string, mixed> $options = [], ?string $title = null)
* @method static Envelope info(string $message, array<string, mixed> $options = [], ?string $title = null)
* @method static Envelope warning(string $message, array<string, mixed> $options = [], ?string $title = null)
* @method static Envelope flash(?string $type = null, ?string $message = null, array<string, mixed> $options = [], ?string $title = null)
* @method static Envelope preset(string $preset, array<string, mixed> $parameters = [])
* @method static Envelope operation(string $operation, string|object|null $resource = null)
* @method static Envelope created(string|object|null $resource = null)
* @method static Envelope updated(string|object|null $resource = null)
* @method static Envelope saved(string|object|null $resource = null)
* @method static Envelope deleted(string|object|null $resource = null)
* @method static Envelope push()
* @method static Envelope addSuccess(string $message, array $options = [], ?string $title = null)
* @method static Envelope addError(string $message, array $options = [], ?string $title = null)
* @method static Envelope addInfo(string $message, array $options = [], ?string $title = null)
* @method static Envelope addWarning(string $message, array $options = [], ?string $title = null)
* @method static Envelope addFlash(?string $type = null, ?string $message = null, array $options = [], ?string $title = null)
* @method static Envelope addPreset(string $preset, array $parameters = [])
* @method static Envelope addPreset(string $preset, array<string, mixed> $parameters = [])
* @method static Envelope addCreated(string|object|null $resource = null)
* @method static Envelope addUpdated(string|object|null $resource = null)
* @method static Envelope addDeleted(string|object|null $resource = null)
+23 -20
View File
@@ -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;
@@ -210,7 +210,7 @@ final class FlasherServiceProvider extends PluginServiceProvider
AboutCommand::add('PHPFlasher', [
'Version' => Flasher::VERSION,
'Factories' => implode(' <fg=gray;options=bold>/</> ', array_map(fn ($factory) => sprintf('<fg=yellow;options=bold>%s</>', $factory), $factories)),
'Factories' => implode(' <fg=gray;options=bold>/</> ', array_map(fn ($factory) => \sprintf('<fg=yellow;options=bold>%s</>', $factory), $factories)),
]);
}
@@ -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 = '') {
+5
View File
@@ -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();
+5 -4
View File
@@ -5,12 +5,13 @@ declare(strict_types=1);
namespace Flasher\Laravel\Http;
use Flasher\Prime\Http\ResponseInterface;
use Illuminate\Http\JsonResponse as LaravelJsonResponse;
use Illuminate\Http\Response as LaravelResponse;
use Symfony\Component\HttpFoundation\JsonResponse as SymfonyJsonResponse;
use Symfony\Component\HttpFoundation\Response as SymfonyResponse;
final readonly class Response implements ResponseInterface
{
public function __construct(private LaravelJsonResponse|LaravelResponse $response)
public function __construct(private SymfonyResponse $response)
{
}
@@ -21,7 +22,7 @@ final readonly class Response implements ResponseInterface
public function isJson(): bool
{
return $this->response instanceof LaravelJsonResponse;
return $this->response instanceof SymfonyJsonResponse;
}
public function isHtml(): bool
@@ -66,7 +67,7 @@ final readonly class Response implements ResponseInterface
$this->response->setContent($content);
// Restore original response (eg. the View or Ajax data)
if ($original) {
if ($original && $this->response instanceof LaravelResponse) {
$this->response->original = $original;
}
}
+2 -3
View File
@@ -7,9 +7,8 @@ namespace Flasher\Laravel\Middleware;
use Flasher\Laravel\Http\Request;
use Flasher\Laravel\Http\Response;
use Flasher\Prime\Http\ResponseExtensionInterface;
use Illuminate\Http\JsonResponse as LaravelJsonResponse;
use Illuminate\Http\Request as LaravelRequest;
use Illuminate\Http\Response as LaravelResponse;
use Symfony\Component\HttpFoundation\Response as SymfonyResponse;
final readonly class FlasherMiddleware
{
@@ -21,7 +20,7 @@ final readonly class FlasherMiddleware
{
$response = $next($request);
if ($response instanceof LaravelJsonResponse || $response instanceof LaravelResponse) {
if ($response instanceof SymfonyResponse) {
$this->responseExtension->render(new Request($request), new Response($response));
}
+2 -3
View File
@@ -7,9 +7,8 @@ namespace Flasher\Laravel\Middleware;
use Flasher\Laravel\Http\Request;
use Flasher\Laravel\Http\Response;
use Flasher\Prime\Http\RequestExtensionInterface;
use Illuminate\Http\JsonResponse as LaravelJsonResponse;
use Illuminate\Http\Request as LaravelRequest;
use Illuminate\Http\Response as LaravelResponse;
use Symfony\Component\HttpFoundation\Response as SymfonyResponse;
final readonly class SessionMiddleware
{
@@ -21,7 +20,7 @@ final readonly class SessionMiddleware
{
$response = $next($request);
if ($response instanceof LaravelJsonResponse || $response instanceof LaravelResponse) {
if ($response instanceof SymfonyResponse) {
$this->requestExtension->flash(new Request($request), new Response($response));
}
+3 -1
View File
@@ -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;
}
+7 -1
View File
@@ -1,3 +1,9 @@
<div align="center">
<a href="https://github.com/php-flasher/php-flasher/blob/2.x/docs/palestine.md">
<img src="https://raw.githubusercontent.com/php-flasher/art/main/palestine-banner-support.svg" width="800px" alt="Help Palestine"/>
</a>
</div>
<p align="center">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/php-flasher/art/main/php-flasher-github-dark.png">
@@ -108,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>
+32 -15
View File
@@ -2,28 +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,
// Configuration for the flash bag (converting Laravel flash messages)
// Map Laravel session keys to PHPFlasher types
// Enable message translation using Laravel's translation service
'translate' => true,
// 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'],
@@ -31,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',
// ],
// ],
]);
+1 -1
View File
@@ -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": {
-23
View File
@@ -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! 🙌
+8 -15
View File
@@ -6,25 +6,18 @@ namespace Flasher\Noty\Laravel\Facade;
use Flasher\Noty\Prime\NotyBuilder;
use Flasher\Prime\Notification\Envelope;
use Flasher\Prime\Notification\NotificationInterface;
use Flasher\Prime\Stamp\StampInterface;
use Illuminate\Support\Facades\Facade;
/**
* @method static NotyBuilder addSuccess(string $message, array $options = array())
* @method static NotyBuilder addError(string $message, array $options = array())
* @method static NotyBuilder addWarning(string $message, array $options = array())
* @method static NotyBuilder addInfo(string $message, array $options = array())
* @method static NotyBuilder addFlash(NotificationInterface|string $type, string $message = null, array $options = array())
* @method static NotyBuilder success(string $message, array<string, mixed> $options = array())
* @method static NotyBuilder error(string $message, array<string, mixed> $options = array())
* @method static NotyBuilder warning(string $message, array<string, mixed> $options = array())
* @method static NotyBuilder info(string $message, array<string, mixed> $options = array())
* @method static NotyBuilder flash(StampInterface[] $stamps = array())
* @method static NotyBuilder type(string $type, string $message = null, array $options = array())
* @method static NotyBuilder message(string $message)
* @method static NotyBuilder options(array $options, bool $merge = true)
* @method static NotyBuilder options(array<string, mixed> $options, bool $merge = true)
* @method static NotyBuilder option(string $name, string $value)
* @method static NotyBuilder success(string $message = null, array $options = array())
* @method static NotyBuilder error(string $message = null, array $options = array())
* @method static NotyBuilder info(string $message = null, array $options = array())
* @method static NotyBuilder warning(string $message = null, array $options = array())
* @method static NotyBuilder priority(int $priority)
* @method static NotyBuilder hops(int $amount)
* @method static NotyBuilder keep()
@@ -35,12 +28,12 @@ use Illuminate\Support\Facades\Facade;
* @method static NotyBuilder handler(string $handler)
* @method static Envelope getEnvelope()
* @method static NotyBuilder text(string $text)
* @method static NotyBuilder alert(string $message = null, array $options = array())
* @method static NotyBuilder alert(string $message = null, array<string, mixed> $options = array())
* @method static NotyBuilder layout(string $layout)
* @method static NotyBuilder theme(string $theme)
* @method static NotyBuilder timeout(bool|int $timeout)
* @method static NotyBuilder progressBar(bool $progressBar = false)
* @method static NotyBuilder closeWith(array|string $closeWith)
* @method static NotyBuilder closeWith(string|string[] $closeWith)
* @method static NotyBuilder animation(string $animation, string $effect)
* @method static NotyBuilder sounds(string $option, mixed $value)
* @method static NotyBuilder docTitle(string $option, mixed $docTitle)
@@ -50,7 +43,7 @@ use Illuminate\Support\Facades\Facade;
* @method static NotyBuilder queue(string $queue)
* @method static NotyBuilder killer(bool|string $killer)
* @method static NotyBuilder container(bool|string $container)
* @method static NotyBuilder buttons(array $buttons)
* @method static NotyBuilder buttons(string[] $buttons)
* @method static NotyBuilder visibilityControl(bool $visibilityControl)
*/
final class Noty extends Facade
+6
View File
@@ -1,3 +1,9 @@
<div align="center">
<a href="https://github.com/php-flasher/php-flasher/blob/2.x/docs/palestine.md">
<img src="https://raw.githubusercontent.com/php-flasher/art/main/palestine-banner-support.svg" width="800px" alt="Help Palestine"/>
</a>
</div>
<p align="center">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/php-flasher/art/main/php-flasher-github-dark.png">
+2 -2
View File
@@ -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": {
-23
View File
@@ -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! 🙌
+130 -13
View File
@@ -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);
+6
View File
@@ -1,3 +1,9 @@
<div align="center">
<a href="https://github.com/php-flasher/php-flasher/blob/2.x/docs/palestine.md">
<img src="https://raw.githubusercontent.com/php-flasher/art/main/palestine-banner-support.svg" width="800px" alt="Help Palestine"/>
</a>
</div>
<p align="center">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/php-flasher/art/main/php-flasher-github-dark.png">
+2 -2
View File
@@ -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"
}
}
+1 -1
View File
@@ -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": {
+30 -4
View File
@@ -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.
+30 -4
View File
@@ -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.
-23
View File
@@ -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! 🙌
+6
View File
@@ -1,3 +1,9 @@
<div align="center">
<a href="https://github.com/php-flasher/php-flasher/blob/2.x/docs/palestine.md">
<img src="https://raw.githubusercontent.com/php-flasher/art/main/palestine-banner-support.svg" width="800px" alt="Help Palestine"/>
</a>
</div>
<p align="center">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/php-flasher/art/main/php-flasher-github-dark.png">
+2 -2
View File
@@ -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": {
-23
View File
@@ -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! 🙌
+5 -12
View File
@@ -6,25 +6,18 @@ namespace Flasher\Notyf\Laravel\Facade;
use Flasher\Notyf\Prime\NotyfBuilder;
use Flasher\Prime\Notification\Envelope;
use Flasher\Prime\Notification\NotificationInterface;
use Flasher\Prime\Stamp\StampInterface;
use Illuminate\Support\Facades\Facade;
/**
* @method static NotyfBuilder addSuccess(string $message, array $options = array())
* @method static NotyfBuilder addError(string $message, array $options = array())
* @method static NotyfBuilder addWarning(string $message, array $options = array())
* @method static NotyfBuilder addInfo(string $message, array $options = array())
* @method static NotyfBuilder addFlash(NotificationInterface|string $type, string $message = null, array $options = array())
* @method static NotyfBuilder success(string $message, array<string, mixed> $options = array())
* @method static NotyfBuilder error(string $message, array<string, mixed> $options = array())
* @method static NotyfBuilder warning(string $message, array<string, mixed> $options = array())
* @method static NotyfBuilder info(string $message, array<string, mixed> $options = array())
* @method static NotyfBuilder flash(StampInterface[] $stamps = array())
* @method static NotyfBuilder type(string $type, string $message = null, array $options = array())
* @method static NotyfBuilder message(string $message)
* @method static NotyfBuilder options(array $options, bool $merge = true)
* @method static NotyfBuilder options(array<string, mixed> $options, bool $merge = true)
* @method static NotyfBuilder option(string $name, string $value)
* @method static NotyfBuilder success(string $message = null, array $options = array())
* @method static NotyfBuilder error(string $message = null, array $options = array())
* @method static NotyfBuilder info(string $message = null, array $options = array())
* @method static NotyfBuilder warning(string $message = null, array $options = array())
* @method static NotyfBuilder priority(int $priority)
* @method static NotyfBuilder hops(int $amount)
* @method static NotyfBuilder keep()
+6
View File
@@ -1,3 +1,9 @@
<div align="center">
<a href="https://github.com/php-flasher/php-flasher/blob/2.x/docs/palestine.md">
<img src="https://raw.githubusercontent.com/php-flasher/art/main/palestine-banner-support.svg" width="800px" alt="Help Palestine"/>
</a>
</div>
<p align="center">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/php-flasher/art/main/php-flasher-github-dark.png">
+2 -2
View File
@@ -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": {
-23
View File
@@ -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! 🙌
+13
View File
@@ -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
{
/**
+6
View File
@@ -1,3 +1,9 @@
<div align="center">
<a href="https://github.com/php-flasher/php-flasher/blob/2.x/docs/palestine.md">
<img src="https://raw.githubusercontent.com/php-flasher/art/main/palestine-banner-support.svg" width="800px" alt="Help Palestine"/>
</a>
</div>
<p align="center">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/php-flasher/art/main/php-flasher-github-dark.png">
File diff suppressed because one or more lines are too long
+2 -2
View File
@@ -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"
}
}

Some files were not shown because too many files have changed in this diff Show More