You've already forked php-flasher
mirror of
https://github.com/php-flasher/php-flasher.git
synced 2026-04-05 12:32:55 +01:00
Compare commits
61 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f66382e324 | |||
| e2ef4f08a4 | |||
| 1e1b70e59b | |||
| 0ca4b5c197 | |||
| df8eb83abe | |||
| 3f1b22a126 | |||
| b11524c2f9 | |||
| a2333762ea | |||
| 3e2e853022 | |||
| 27904be912 | |||
| c9d3b56346 | |||
| db485d1ff2 | |||
| 707c7a42e1 | |||
| 456016a585 | |||
| a38ddbb53a | |||
| 5a73173dcf | |||
| 7abdccf284 | |||
| a34a943397 | |||
| fe4601bb8b | |||
| 86a56f4cff | |||
| c3493a7335 | |||
| b2a102023b | |||
| 2a85dc37c3 | |||
| 46f2397cdc | |||
| 57d4665b62 | |||
| cf3943bc08 | |||
| 1da1392670 | |||
| 095b0d967d | |||
| 16c1764e73 | |||
| 453a0b9c77 | |||
| fd051dbf74 | |||
| 2eb8500799 | |||
| e1b075520b | |||
| 0477a319b4 | |||
| 7eaa7a1f46 | |||
| cdfe882322 | |||
| 2ff02a15bf | |||
| 09f53b1b63 | |||
| d0022aa0cb | |||
| 632c0662e4 | |||
| e8ee494e13 | |||
| fdaa8f8961 | |||
| aa645778e3 | |||
| aca71922e8 | |||
| 08b96bdd39 | |||
| 89d8c2cb7a | |||
| 004334f642 | |||
| 60d0f2ed30 | |||
| d82a12d8c8 | |||
| 7b190bf882 | |||
| 18763f1df0 | |||
| 486329be24 | |||
| c0c8d7d5da | |||
| 8cbf37b29b | |||
| 43affdc543 | |||
| b6afde2990 | |||
| e28123fb3c | |||
| 79717cae5c | |||
| 6fe3407fae | |||
| 8d0dff2224 | |||
| 8047c6f6fe |
@@ -1,9 +1,18 @@
|
||||
--ignore-dir=.idea
|
||||
--ignore-dir=.cache
|
||||
--ignore-dir=vendor
|
||||
--ignore-dir=yoeunes
|
||||
--ignore-dir=node_modules
|
||||
|
||||
--ignore-dir=demo/laravel/vendor
|
||||
--ignore-dir=demo/laravel/node_modules
|
||||
--ignore-dir=demo/laravel/storage
|
||||
--ignore-dir=demo/laravel/bootstrap/cache
|
||||
|
||||
--ignore-dir=demo/symfony/vendor
|
||||
--ignore-dir=.cache
|
||||
--ignore-dir=demo/symfony/node_modules
|
||||
--ignore-dir=demo/symfony/var
|
||||
|
||||
--ignore-dir=docs/.jekyll-cache
|
||||
--ignore-dir=docs/_site
|
||||
--ignore-dir=docs/node_modules
|
||||
|
||||
@@ -95,6 +95,15 @@
|
||||
"code",
|
||||
"doc"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "BrookeDot",
|
||||
"name": "Brooke.",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/150348?v=4",
|
||||
"profile": "https://github.com/BrookeDot",
|
||||
"contributions": [
|
||||
"doc"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
name: 🚀 Publish assets to NPM
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [ published ]
|
||||
|
||||
jobs:
|
||||
publish-prime:
|
||||
runs-on: ubuntu-latest
|
||||
defaults:
|
||||
run:
|
||||
working-directory: ./src/Prime/Resources
|
||||
permissions:
|
||||
contents: read
|
||||
id-token: write
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '20.x'
|
||||
registry-url: 'https://registry.npmjs.org'
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm install
|
||||
|
||||
- name: Publish to NPM
|
||||
run: npm publish --access public
|
||||
env:
|
||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
|
||||
publish-plugin:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
id-token: write
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
path:
|
||||
- ./src/Noty/Prime/Resources
|
||||
- ./src/Notyf/Prime/Resources
|
||||
- ./src/SweetAlert/Prime/Resources
|
||||
- ./src/Toastr/Prime/Resources
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '20.x'
|
||||
registry-url: 'https://registry.npmjs.org'
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm install
|
||||
working-directory: ${{ matrix.path }}
|
||||
|
||||
- name: Publish to NPM
|
||||
run: npm publish --access public
|
||||
working-directory: ${{ matrix.path }}
|
||||
env:
|
||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
+14
-17
@@ -1,22 +1,19 @@
|
||||
.idea/
|
||||
.DS_Store
|
||||
/.idea/
|
||||
/.DS_Store
|
||||
|
||||
vendor/
|
||||
node_modules/
|
||||
/vendor/
|
||||
/node_modules/
|
||||
|
||||
.cache/php-cs-fixer/
|
||||
.cache/phpunit/
|
||||
.cache/phpstan/
|
||||
.cache/phplint/
|
||||
.cache/nx/
|
||||
.nx/
|
||||
/.cache/php-cs-fixer/
|
||||
/.cache/phplint/
|
||||
/.cache/phpstan/
|
||||
/.cache/phpunit/
|
||||
|
||||
.php-cs-fixer.php
|
||||
phpunit.xml
|
||||
taskfile.yml
|
||||
phpstan.neon
|
||||
/.php-cs-fixer.php
|
||||
/phpunit.xml
|
||||
/taskfile.yml
|
||||
/phpstan.neon
|
||||
|
||||
lerna-debug.log
|
||||
npm-debug.log
|
||||
/npm-debug.log
|
||||
|
||||
tests/Symfony/Fixtures/project/public/vendor/
|
||||
/tests/Symfony/Fixtures/project/public/vendor/
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
*.log
|
||||
npm-debug.log*
|
||||
|
||||
# Coverage directory used by tools like istanbul
|
||||
coverage
|
||||
|
||||
# Dependency directories
|
||||
node_modules
|
||||
@@ -1,6 +1,3 @@
|
||||
pnpm-lock.yaml
|
||||
pnpm-workspace.yaml
|
||||
|
||||
**/node_modules
|
||||
src/**/Resources/public/**
|
||||
src/**/Resources/dist/**
|
||||
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
Please do not submit any Pull Requests here. They will be closed.
|
||||
---
|
||||
|
||||
Please submit your PR here instead:
|
||||
https://github.com/php-flasher/php-flasher
|
||||
|
||||
This repository is what we call a "subtree split": a read-only subset of that main repository.
|
||||
We're looking forward to your PR there!
|
||||
-23
@@ -1,23 +0,0 @@
|
||||
name: Auto Closer PR
|
||||
|
||||
on:
|
||||
pull_request_target:
|
||||
types: [ opened ]
|
||||
|
||||
jobs:
|
||||
run:
|
||||
name: 🤖 PR Auto-Closure
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: superbrothers/close-pull-request@v3
|
||||
with:
|
||||
comment: |
|
||||
Hi there 👋,
|
||||
|
||||
First off, thanks for your effort! 🎉 Unfortunately, this repository is read-only because it's split from our primary monorepo repository.
|
||||
|
||||
🙏 We kindly ask if you could direct your valuable contribution to our main repository at https://github.com/php-flasher/php-flasher.
|
||||
|
||||
Once you've moved your contribution there, we'll review it and provide feedback. 🕵️♂️
|
||||
|
||||
Thanks again for your understanding and cooperation. We really appreciate it! 🙌
|
||||
@@ -0,0 +1,20 @@
|
||||
name: Close Pull Request
|
||||
|
||||
on:
|
||||
pull_request_target:
|
||||
types: [opened]
|
||||
|
||||
jobs:
|
||||
run:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: superbrothers/close-pull-request@v3
|
||||
with:
|
||||
comment: |
|
||||
Thanks for your Pull Request! We love contributions.
|
||||
|
||||
However, you should instead open your PR on the main repository:
|
||||
https://github.com/php-flasher/php-flasher
|
||||
|
||||
This repository is what we call a "subtree split": a read-only subset of that main repository.
|
||||
We're looking forward to your PR there!
|
||||
+24
-1
@@ -1,6 +1,29 @@
|
||||
# CHANGELOG for 2.x
|
||||
|
||||
## [Unreleased](https://github.com/php-flasher/php-flasher/compare/v2.0.2...2.x)
|
||||
## [Unreleased](https://github.com/php-flasher/php-flasher/compare/v2.1.2...2.x)
|
||||
|
||||
## [v2.1.2](https://github.com/php-flasher/php-flasher/compare/v2.1.1...v2.1.2) - 2025-01-18
|
||||
|
||||
* bug [#208](https://github.com/php-flasher/php-flasher/issues/208) [Flasher] Allow `main_script` to be nullable. See [PR #209](https://github.com/php-flasher/php-flasher/pull/209) by [yoeunes](https://github.com/yoeunes)
|
||||
|
||||
## [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
|
||||
|
||||
|
||||
@@ -6,26 +6,227 @@
|
||||
|
||||
<p align="center">
|
||||
<picture>
|
||||
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/php-flasher/art/main/php-flasher-github-dark.png">
|
||||
<img src="https://raw.githubusercontent.com/php-flasher/art/main/php-flasher-github.png" alt="PHPFlasher Logo">
|
||||
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/php-flasher/art/main/php-flasher-logo-dark.png">
|
||||
<img src="https://raw.githubusercontent.com/php-flasher/art/main/php-flasher-logo.png" alt="PHPFlasher Logo">
|
||||
</picture>
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
<a href="https://www.linkedin.com/in/younes--ennaji"><img src="https://img.shields.io/badge/author-@yoeunes-blue.svg" alt="Author Badge"></a>
|
||||
<a href="https://github.com/php-flasher/php-flasher"><img src="https://img.shields.io/badge/source-php--flasher/php--flasher-blue.svg" alt="Source Code Badge"></a>
|
||||
<a href="https://github.com/php-flasher/php-flasher/releases"><img src="https://img.shields.io/github/tag/php-flasher/flasher.svg" alt="GitHub Release Badge"></a>
|
||||
<a href="https://github.com/php-flasher/flasher/blob/master/LICENSE"><img src="https://img.shields.io/badge/license-MIT-brightgreen.svg" alt="License Badge"></a>
|
||||
<a href="https://packagist.org/packages/php-flasher/flasher"><img src="https://img.shields.io/packagist/dt/php-flasher/flasher.svg" alt="Packagist Downloads Badge"></a>
|
||||
<a href="https://github.com/php-flasher/php-flasher"><img src="https://img.shields.io/github/stars/php-flasher/php-flasher.svg" alt="GitHub Stars Badge"></a>
|
||||
<a href="https://packagist.org/packages/php-flasher/flasher"><img src="https://img.shields.io/packagist/php-v/php-flasher/flasher.svg" alt="Supported PHP Version Badge"></a>
|
||||
</p>
|
||||
|
||||
## Table of Contents
|
||||
|
||||
- [About PHPFlasher](#about-phpflasher)
|
||||
- [Features](#features)
|
||||
- [Supported Versions](#supported-versions)
|
||||
- [Installation](#installation)
|
||||
- [Core Package](#core-package)
|
||||
- [Adapters](#adapters)
|
||||
- [Quick Start](#quick-start)
|
||||
- [Usage Examples](#usage-examples)
|
||||
- [Adapters Overview](#adapters-overview)
|
||||
- [Official Documentation](#official-documentation)
|
||||
- [Contributors and Sponsors](#contributors-and-sponsors)
|
||||
- [Contact](#contact)
|
||||
- [License](#license)
|
||||
|
||||
## About PHPFlasher
|
||||
|
||||
PHPFlasher is a powerful and easy-to-use package that allows you to quickly and easily add flash messages to your Laravel or Symfony projects.
|
||||
Whether you need to alert users of a successful form submission, an error, or any other important information, flash messages are a simple and effective solution for providing feedback to your users.
|
||||
PHPFlasher is an open-source tool that helps you add flash messages to your web applications. Flash messages are short notifications that provide feedback to users after they perform actions, such as submitting a form or encountering an error. These messages enhance the user experience by informing users about the outcomes of their actions.
|
||||
|
||||
With PHPFlasher, you can easily record and store messages within the session, making it simple to retrieve and display them on the current or next page.
|
||||
This improves user engagement and enhances the overall user experience on your website or application.
|
||||
PHPFlasher simplifies the process of integrating flash messages into **Laravel** and **Symfony** projects. It uses sessions to store messages, allowing you to set a message on one page and display it on another without complex setup.
|
||||
|
||||
Whether you're a beginner or an experienced developer, PHPFlasher's intuitive and straightforward design makes it easy to integrate into your projects.
|
||||
So, if you're looking for a reliable, flexible and easy to use flash messages solution, PHPFlasher is the perfect choice.
|
||||
## Features
|
||||
|
||||
- **Multiple Adapters**: Supports Laravel, Symfony, Toastr, Noty, SweetAlert, and more.
|
||||
- **Flexible Configuration**: Customize the appearance and behavior of flash messages.
|
||||
- **Extensible**: Easily integrate with various frontend libraries and frameworks.
|
||||
- **Intuitive API**: Simple functions to create and manage flash messages.
|
||||
|
||||
## Supported Versions
|
||||
|
||||
| PHPFlasher Version | PHP Version | Symfony Version | Laravel Version |
|
||||
|--------------------|-------------|-----------------|-----------------|
|
||||
| **v2.x** | ≥ 8.2 | ≥ 7.2 | ≥ 11 |
|
||||
| **v1.x** | ≥ 5.3 | ≥ 2.0 | ≥ 4.0 |
|
||||
|
||||
> **Note:** If your project uses PHP, Symfony, or Laravel versions below the requirements for PHPFlasher v2.x, please use [PHPFlasher v1.x](https://github.com/php-flasher/php-flasher/tree/1.x).
|
||||
|
||||
## Installation
|
||||
|
||||
### Core Package
|
||||
|
||||
Install the core PHPFlasher package via Composer:
|
||||
|
||||
- **For Laravel:**
|
||||
|
||||
```bash
|
||||
composer require php-flasher/flasher-laravel
|
||||
```
|
||||
|
||||
After installation, set up the necessary assets:
|
||||
|
||||
```shell
|
||||
php artisan flasher:install
|
||||
```
|
||||
|
||||
> **Note:** PHPFlasher automatically injects the necessary JavaScript and CSS assets into your Blade templates. No additional steps are required for asset injection.
|
||||
|
||||
- **For Symfony:**
|
||||
|
||||
```bash
|
||||
composer require php-flasher/flasher-symfony
|
||||
```
|
||||
|
||||
After installation, set up the necessary assets:
|
||||
|
||||
```shell
|
||||
php bin/console flasher:install
|
||||
```
|
||||
|
||||
> **Note:** PHPFlasher automatically injects the necessary JavaScript and CSS assets into your Twig templates. No additional steps are required for asset injection.
|
||||
|
||||
### Adapters
|
||||
|
||||
PHPFlasher provides various adapters for different frameworks and notification libraries. Below is an overview of available adapters:
|
||||
|
||||
#### Toastr
|
||||
|
||||
- [flasher-toastr](https://github.com/php-flasher/flasher-toastr) - Core Toastr Adapter
|
||||
- [flasher-toastr-laravel](https://github.com/php-flasher/flasher-toastr-laravel) - Laravel Adapter
|
||||
- [flasher-toastr-symfony](https://github.com/php-flasher/flasher-toastr-symfony) - Symfony Adapter
|
||||
|
||||
#### Noty
|
||||
|
||||
- [flasher-noty](https://github.com/php-flasher/flasher-noty) - Core Noty Adapter
|
||||
- [flasher-noty-laravel](https://github.com/php-flasher/flasher-noty-laravel) - Laravel Adapter
|
||||
- [flasher-noty-symfony](https://github.com/php-flasher/flasher-noty-symfony) - Symfony Adapter
|
||||
|
||||
#### Notyf
|
||||
|
||||
- [flasher-notyf](https://github.com/php-flasher/flasher-notyf) - Core Notyf Adapter
|
||||
- [flasher-notyf-laravel](https://github.com/php-flasher/flasher-notyf-laravel) - Laravel Adapter
|
||||
- [flasher-notyf-symfony](https://github.com/php-flasher/flasher-notyf-symfony) - Symfony Adapter
|
||||
|
||||
#### SweetAlert
|
||||
|
||||
- [flasher-sweetalert](https://github.com/php-flasher/flasher-sweetalert) - Core SweetAlert Adapter
|
||||
- [flasher-sweetalert-laravel](https://github.com/php-flasher/flasher-sweetalert-laravel) - Laravel Adapter
|
||||
- [flasher-sweetalert-symfony](https://github.com/php-flasher/flasher-sweetalert-symfony) - Symfony Adapter
|
||||
|
||||
For detailed installation and usage instructions for each adapter, refer to their respective [README.md](https://github.com/php-flasher/flasher-toastr).
|
||||
|
||||
## Quick Start
|
||||
|
||||
To display a notification message, you can either use the `flash()` helper function or obtain an instance of `flasher` from the service container. Then, before returning a view or redirecting, call the desired method (`success()`, `error()`, etc.) and pass in the message to be displayed.
|
||||
|
||||
### Using the `flash()` Helper
|
||||
|
||||
```php
|
||||
class BookController
|
||||
{
|
||||
public function saveBook()
|
||||
{
|
||||
// Your logic here
|
||||
|
||||
flash('Your changes have been saved!');
|
||||
|
||||
return redirect()->back();
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Using the `flasher` Service
|
||||
|
||||
```php
|
||||
use Flasher\Prime\FlasherInterface;
|
||||
|
||||
class AnotherController
|
||||
{
|
||||
/**
|
||||
* If you prefer to use dependency injection
|
||||
*/
|
||||
public function register(FlasherInterface $flasher)
|
||||
{
|
||||
// Your logic here
|
||||
|
||||
$flasher->success('Your changes have been saved!');
|
||||
|
||||
// ... redirect or render the view
|
||||
}
|
||||
|
||||
public function update()
|
||||
{
|
||||
// Your logic here
|
||||
|
||||
app('flasher')->error('An error occurred while updating.'); // ony for laravel
|
||||
|
||||
return redirect()->back();
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Usage Examples
|
||||
|
||||
### Success Message
|
||||
|
||||
```php
|
||||
flash()->success('Operation completed successfully!');
|
||||
```
|
||||
|
||||
### Error Message
|
||||
|
||||
```php
|
||||
flash()->error('An error occurred.');
|
||||
```
|
||||
|
||||
### Info Message
|
||||
|
||||
```php
|
||||
flash()->info('This is an informational message.');
|
||||
```
|
||||
|
||||
### Warning Message
|
||||
|
||||
```php
|
||||
flash()->warning('This is a warning message.');
|
||||
```
|
||||
|
||||
### Passing Options
|
||||
|
||||
```php
|
||||
flash()->success('Custom message with options.', ['timeout' => 3000, 'position' => 'bottom-left']);
|
||||
```
|
||||
|
||||
## Adapters Overview
|
||||
|
||||
PHPFlasher supports various adapters to integrate seamlessly with different frameworks and frontend libraries. Below is an overview of available adapters:
|
||||
|
||||
| Adapter Repository | Description |
|
||||
|-----------------------------------------------------------------------------------------|--------------------------------|
|
||||
| [flasher-laravel](https://github.com/php-flasher/flasher-laravel) | Laravel framework adapter |
|
||||
| [flasher-symfony](https://github.com/php-flasher/flasher-symfony) | Symfony framework adapter |
|
||||
| [flasher-toastr-laravel](https://github.com/php-flasher/flasher-toastr-laravel) | Toastr adapter for Laravel |
|
||||
| [flasher-toastr-symfony](https://github.com/php-flasher/flasher-toastr-symfony) | Toastr adapter for Symfony |
|
||||
| [flasher-noty-laravel](https://github.com/php-flasher/flasher-noty-laravel) | Noty adapter for Laravel |
|
||||
| [flasher-noty-symfony](https://github.com/php-flasher/flasher-noty-symfony) | Noty adapter for Symfony |
|
||||
| [flasher-notyf-laravel](https://github.com/php-flasher/flasher-notyf-laravel) | Notyf adapter for Laravel |
|
||||
| [flasher-notyf-symfony](https://github.com/php-flasher/flasher-notyf-symfony) | Notyf adapter for Symfony |
|
||||
| [flasher-sweetalert-laravel](https://github.com/php-flasher/flasher-sweetalert-laravel) | SweetAlert adapter for Laravel |
|
||||
| [flasher-sweetalert-symfony](https://github.com/php-flasher/flasher-sweetalert-symfony) | SweetAlert adapter for Symfony |
|
||||
|
||||
> **Note:** Each adapter has its own repository. For detailed installation and usage instructions, please refer to the [Official Documentation](https://php-flasher.io).
|
||||
|
||||
## Official Documentation
|
||||
|
||||
Documentation for PHPFlasher can be found on the [https://php-flasher.io](https://php-flasher.io).
|
||||
Comprehensive documentation for PHPFlasher is available at [https://php-flasher.io](https://php-flasher.io). Here you will find detailed guides, API references, and advanced usage examples to help you get the most out of PHPFlasher.
|
||||
|
||||
## Contributors and sponsors
|
||||
|
||||
@@ -53,6 +254,7 @@ Shining stars of our community:
|
||||
<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://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>
|
||||
<td align="center" valign="top" width="14.28%"><a href="https://github.com/BrookeDot"><img src="https://avatars.githubusercontent.com/u/150348?v=4?s=100" width="100px;" alt="Brooke."/><br /><sub><b>Brooke.</b></sub></a><br /><a href="https://github.com/php-flasher/php-flasher/commits?author=BrookeDot" title="Documentation">📖</a></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
@@ -70,11 +272,11 @@ You can reach out with questions, bug reports, or feature requests on any of the
|
||||
- [Github Issues](https://github.com/php-flasher/php-flasher/issues)
|
||||
- [Github](https://github.com/yoeunes)
|
||||
- [Twitter](https://twitter.com/yoeunes)
|
||||
- [Linkedin](https://www.linkedin.com/in/younes-ennaji/)
|
||||
- [Email me directly](mailto:younes.ennaji@gmail.com)
|
||||
- [Linkedin](https://www.linkedin.com/in/younes--ennaji/)
|
||||
- [Email me directly](mailto:younes.ennaji.pro@gmail.com)
|
||||
|
||||
## License
|
||||
|
||||
PHPFlasher is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).
|
||||
|
||||
<p align="center"> <b>Made with ❤️ by <a href="https://www.linkedin.com/in/younes-ennaji/">Younes ENNAJI</a> </b> </p>
|
||||
<p align="center"> <b>Made with ❤️ by <a href="https://www.linkedin.com/in/younes--ennaji/">Younes ENNAJI</a> </b> </p>
|
||||
|
||||
@@ -1,50 +1,70 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
require __DIR__.'/../vendor/autoload.php';
|
||||
|
||||
use Symfony\Component\Filesystem\Filesystem;
|
||||
use Symfony\Component\Finder\Finder;
|
||||
|
||||
$filesystem = new Filesystem();
|
||||
|
||||
// Define the shared resources
|
||||
$shared = realpath(__DIR__.'/../.shared');
|
||||
|
||||
$resources = array(
|
||||
$resources = [
|
||||
$shared,
|
||||
__DIR__.'/../.github/FUNDING.yml',
|
||||
__DIR__.'/../README.md',
|
||||
__DIR__.'/../LICENSE',
|
||||
);
|
||||
];
|
||||
|
||||
$dirs = array(__DIR__.'/../packs', __DIR__.'/../src');
|
||||
// Directories to search for packages
|
||||
$dirs = [__DIR__.'/../src'];
|
||||
|
||||
$packages = array_reduce($dirs, function ($files, $dir) {
|
||||
return array_merge($files, glob("$dir/*/composer.json"), glob("$dir/*/*/composer.json"));
|
||||
}, array());
|
||||
// Find all composer.json files within the specified directories
|
||||
$finder = new Finder();
|
||||
$finder->files()
|
||||
->in($dirs)
|
||||
->name('composer.json')
|
||||
->depth('< 3'); // Adjust depth as needed
|
||||
|
||||
foreach ($packages as $package) {
|
||||
$package = realpath(dirname($package));
|
||||
$packages = [];
|
||||
|
||||
// Collect package directories
|
||||
foreach ($finder as $file) {
|
||||
$packages[] = dirname($file->getRealPath());
|
||||
}
|
||||
|
||||
foreach ($packages as $packageDir) {
|
||||
foreach ($resources as $resource) {
|
||||
$resource = realpath($resource);
|
||||
$dest = $package.str_replace(realpath(__DIR__.'/../'), '', $resource);
|
||||
|
||||
if (!is_dir($resource) && file_exists($resource)) {
|
||||
copy($resource, $dest);
|
||||
if (!is_string($resource)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$files = new RecursiveIteratorIterator(
|
||||
new RecursiveDirectoryIterator($resource, FilesystemIterator::SKIP_DOTS),
|
||||
RecursiveIteratorIterator::SELF_FIRST
|
||||
);
|
||||
$resourcePath = realpath($resource);
|
||||
|
||||
foreach ($files as $file) {
|
||||
$target = $resource === $shared
|
||||
? $package.str_replace($resource, '', $file->getPathname())
|
||||
: $dest .'/'. $file->getFilename();
|
||||
if (!$resourcePath) {
|
||||
continue; // Skip if the resource doesn't exist
|
||||
}
|
||||
|
||||
if ($file->isDir()) {
|
||||
system('rm -rf -- ' . escapeshellarg($dest));
|
||||
@mkdir(dirname($target), 0777, true);
|
||||
continue;
|
||||
$relativePath = str_replace(realpath(__DIR__.'/../') ?: '', '', $resourcePath);
|
||||
$destination = $packageDir.$relativePath;
|
||||
|
||||
if (is_file($resourcePath)) {
|
||||
// Ensure the destination directory exists
|
||||
$filesystem->mkdir(dirname($destination));
|
||||
// Copy the file
|
||||
$filesystem->copy($resourcePath, $destination, true);
|
||||
} elseif (is_dir($resourcePath)) {
|
||||
if ($resourcePath === $shared) {
|
||||
// Copy contents of the shared directory into the package directory
|
||||
$filesystem->mirror($shared, $packageDir, null, ['override' => true]);
|
||||
} else {
|
||||
// Copy the entire directory to the destination
|
||||
$filesystem->mirror($resourcePath, $destination, null, ['override' => true]);
|
||||
}
|
||||
|
||||
@mkdir(dirname($target), 0777, true);
|
||||
@copy($file->getPathname(), $target);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+21
-19
@@ -21,27 +21,14 @@
|
||||
"prefer-stable": true,
|
||||
"require": {
|
||||
"php": ">=8.2",
|
||||
"ext-intl": "*"
|
||||
},
|
||||
"require-dev": {
|
||||
"ext-intl": "*",
|
||||
"illuminate/contracts": "^11.0",
|
||||
"illuminate/routing": "^11.0",
|
||||
"illuminate/support": "^11.0",
|
||||
"larastan/larastan": "^2.9",
|
||||
"laravel/octane": "^2.3",
|
||||
"livewire/livewire": "^3.5",
|
||||
"mockery/mockery": "^1.6",
|
||||
"orchestra/testbench": "^9.4",
|
||||
"overtrue/phplint": "^9.4",
|
||||
"php-cs-fixer/shim": "^3.64",
|
||||
"phpstan/phpstan": "^1.12",
|
||||
"phpstan/phpstan-mockery": "^1.1",
|
||||
"phpstan/phpstan-phpunit": "^1.4",
|
||||
"phpstan/phpstan-symfony": "^1.4",
|
||||
"phpunit/phpunit": "^10.5",
|
||||
"livewire/livewire": "^3.0",
|
||||
"paragonie/random_compat": "^2.0",
|
||||
"psr/container": "^1.1|^2.0",
|
||||
"rector/rector": "^1.2",
|
||||
"rector/swiss-knife": "^0.2",
|
||||
"spatie/ray": "^1.41",
|
||||
"symfony/config": "^7.0",
|
||||
"symfony/console": "^7.0",
|
||||
"symfony/dependency-injection": "^7.0",
|
||||
@@ -49,8 +36,23 @@
|
||||
"symfony/http-kernel": "^7.0",
|
||||
"symfony/translation": "^7.0",
|
||||
"symfony/twig-bundle": "^7.0",
|
||||
"symfony/ux-twig-component": "^2.19",
|
||||
"symplify/monorepo-builder": "^11.2"
|
||||
"symfony/ux-twig-component": "^2.19"
|
||||
},
|
||||
"require-dev": {
|
||||
"larastan/larastan": "^2.9.9",
|
||||
"mockery/mockery": "^1.6.12",
|
||||
"orchestra/testbench": "^9.5.2",
|
||||
"overtrue/phplint": "^9.5.3",
|
||||
"php-cs-fixer/shim": "^3.64.0",
|
||||
"phpstan/phpstan": "^1.12.7",
|
||||
"phpstan/phpstan-mockery": "^1.1.3",
|
||||
"phpstan/phpstan-phpunit": "^1.4.0",
|
||||
"phpstan/phpstan-symfony": "^1.4.10",
|
||||
"phpunit/phpunit": "^10.5.26",
|
||||
"rector/rector": "^1.2.8",
|
||||
"rector/swiss-knife": "^1.0.0",
|
||||
"spatie/ray": "^1.41.2",
|
||||
"symplify/monorepo-builder": "^11.2.22"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
|
||||
Generated
+5398
-5387
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,64 @@
|
||||
APP_NAME=Laravel
|
||||
APP_ENV=local
|
||||
APP_KEY=base64:mNtM4UEOfGE4dx7IAH4+kx4iPYPdGeu+Gaw/PIcF4II=
|
||||
APP_DEBUG=true
|
||||
APP_TIMEZONE=UTC
|
||||
APP_URL=http://localhost
|
||||
|
||||
APP_LOCALE=en
|
||||
APP_FALLBACK_LOCALE=en
|
||||
APP_FAKER_LOCALE=en_US
|
||||
|
||||
APP_MAINTENANCE_DRIVER=file
|
||||
APP_MAINTENANCE_STORE=database
|
||||
|
||||
BCRYPT_ROUNDS=12
|
||||
|
||||
LOG_CHANNEL=stack
|
||||
LOG_STACK=single
|
||||
LOG_DEPRECATIONS_CHANNEL=null
|
||||
LOG_LEVEL=debug
|
||||
|
||||
DB_CONNECTION=sqlite
|
||||
# DB_HOST=127.0.0.1
|
||||
# DB_PORT=3306
|
||||
# DB_DATABASE=laravel
|
||||
# DB_USERNAME=root
|
||||
# DB_PASSWORD=
|
||||
|
||||
SESSION_DRIVER=database
|
||||
SESSION_LIFETIME=120
|
||||
SESSION_ENCRYPT=false
|
||||
SESSION_PATH=/
|
||||
SESSION_DOMAIN=null
|
||||
|
||||
BROADCAST_CONNECTION=log
|
||||
FILESYSTEM_DISK=local
|
||||
QUEUE_CONNECTION=database
|
||||
|
||||
CACHE_STORE=database
|
||||
CACHE_PREFIX=
|
||||
|
||||
MEMCACHED_HOST=127.0.0.1
|
||||
|
||||
REDIS_CLIENT=phpredis
|
||||
REDIS_HOST=127.0.0.1
|
||||
REDIS_PASSWORD=null
|
||||
REDIS_PORT=6379
|
||||
|
||||
MAIL_MAILER=log
|
||||
MAIL_HOST=127.0.0.1
|
||||
MAIL_PORT=2525
|
||||
MAIL_USERNAME=null
|
||||
MAIL_PASSWORD=null
|
||||
MAIL_ENCRYPTION=null
|
||||
MAIL_FROM_ADDRESS="hello@example.com"
|
||||
MAIL_FROM_NAME="${APP_NAME}"
|
||||
|
||||
AWS_ACCESS_KEY_ID=
|
||||
AWS_SECRET_ACCESS_KEY=
|
||||
AWS_DEFAULT_REGION=us-east-1
|
||||
AWS_BUCKET=
|
||||
AWS_USE_PATH_STYLE_ENDPOINT=false
|
||||
|
||||
VITE_APP_NAME="${APP_NAME}"
|
||||
@@ -2,10 +2,10 @@
|
||||
/node_modules
|
||||
/public/build
|
||||
/public/hot
|
||||
/public/vendor/flasher
|
||||
/public/storage
|
||||
/storage/*.key
|
||||
/vendor
|
||||
.env
|
||||
.env.backup
|
||||
.env.production
|
||||
.phpunit.result.cache
|
||||
|
||||
@@ -3,16 +3,20 @@
|
||||
use Illuminate\Foundation\Application;
|
||||
use Illuminate\Foundation\Configuration\Exceptions;
|
||||
use Illuminate\Foundation\Configuration\Middleware;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
return Application::configure(basePath: dirname(__DIR__))
|
||||
->withRouting(
|
||||
web: __DIR__.'/../routes/web.php',
|
||||
commands: __DIR__.'/../routes/console.php',
|
||||
health: '/up',
|
||||
then: function () {
|
||||
Route::middleware('web')->group(base_path('routes/issues.php'));
|
||||
},
|
||||
)
|
||||
->withMiddleware(function (Middleware $middleware) {
|
||||
$middleware->web(append: [
|
||||
\App\Http\Middleware\HandleInertiaRequests::class,
|
||||
App\Http\Middleware\HandleInertiaRequests::class,
|
||||
]);
|
||||
})
|
||||
->withExceptions(function (Exceptions $exceptions) {
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
"spatie/laravel-ray": "^1.36"
|
||||
},
|
||||
"require-dev": {
|
||||
"barryvdh/laravel-debugbar": "^3.14",
|
||||
"fakerphp/faker": "^1.23",
|
||||
"larastan/larastan": "^2.9",
|
||||
"laravel/pint": "^1.13",
|
||||
@@ -32,7 +33,8 @@
|
||||
"nunomaduro/collision": "^8.0",
|
||||
"pestphp/pest": "^2.34",
|
||||
"pestphp/pest-plugin-laravel": "^2.3",
|
||||
"spatie/laravel-ignition": "^2.4"
|
||||
"spatie/laravel-ignition": "^2.4",
|
||||
"spatie/ray": "^1.41"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
@@ -49,13 +51,16 @@
|
||||
"scripts": {
|
||||
"post-autoload-dump": [
|
||||
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
|
||||
"@php artisan package:discover --ansi"
|
||||
"@php artisan package:discover --ansi",
|
||||
"@php artisan flasher:install --symlink"
|
||||
],
|
||||
"post-update-cmd": [
|
||||
"@php artisan vendor:publish --tag=laravel-assets --ansi --force"
|
||||
"@php artisan vendor:publish --tag=laravel-assets --ansi --force",
|
||||
"@php artisan flasher:install --symlink"
|
||||
],
|
||||
"post-root-package-install": [
|
||||
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
|
||||
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\"",
|
||||
"@php artisan flasher:install --symlink"
|
||||
],
|
||||
"post-create-project-cmd": [
|
||||
"@php artisan key:generate --ansi",
|
||||
|
||||
Generated
+2169
-446
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
Route::get('/issues/190', function () {
|
||||
flash()->success('Your order has been placed successfully.');
|
||||
// Passing another success message with the view
|
||||
return redirect('/issues/190/redirect')->with('success', 'Your order will be delivered in 3-5 business days.');
|
||||
});
|
||||
|
||||
Route::get('/issues/190/redirect', function () {
|
||||
return view('welcome');
|
||||
});
|
||||
+16
-12
@@ -1,23 +1,27 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use App\Entity\Book;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
Route::get('/', function () {
|
||||
// sweetalert()->timerProgressBar()->success('hello from Home Controller');
|
||||
// noty()->layout('topCenter')->success('hello from Home Controller');
|
||||
// notyf()->ripple(false)->warning('hello from Home Controller');
|
||||
// toastr()->positionClass('toast-bottom-left')->error('hello from Home Controller');
|
||||
// flash()->use('flasher')->success('hello from flasher factory');
|
||||
|
||||
// flash()->created(new Book('lord of the rings'));
|
||||
// flash()->saved(new Book('harry potter'));
|
||||
|
||||
session()->flash('success', 'this from laravel session flash');
|
||||
|
||||
return redirect('/redirect');
|
||||
sweetalert()->timerProgressBar()->success('Your account has been successfully created!');
|
||||
noty()->layout('topCenter')->success('Welcome back, John Doe!');
|
||||
notyf()->ripple(false)->warning('Your subscription is about to expire in 3 days.');
|
||||
toastr()->positionClass('toast-bottom-left')->error('Payment failed. Please try again.');
|
||||
flash()->use('flasher')->success('Your profile has been updated successfully.');
|
||||
flash()->created(new Book('The Great Gatsby'));
|
||||
flash()->saved(new Book('1984'));
|
||||
session()->flash('success', 'Your settings have been saved.');
|
||||
return view('welcome');
|
||||
})->name('app_home');
|
||||
|
||||
Route::get('/redirect', function () {
|
||||
session()->flash('success', 'You have been redirected successfully.');
|
||||
return redirect('/destination');
|
||||
});
|
||||
|
||||
Route::get('/destination', function () {
|
||||
return view('welcome');
|
||||
});
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
*
|
||||
!.gitignore
|
||||
@@ -0,0 +1,4 @@
|
||||
--ignore-dir=vendor
|
||||
--ignore-dir=yoeunes
|
||||
--ignore-dir=node_modules
|
||||
--ignore-dir=var
|
||||
@@ -5,6 +5,7 @@
|
||||
/.env.*.local
|
||||
/config/secrets/prod/prod.decrypt.private.php
|
||||
/public/bundles/
|
||||
/public/vendor/flasherg
|
||||
/var/
|
||||
/vendor/
|
||||
###< symfony/framework-bundle ###
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
8.2
|
||||
@@ -0,0 +1 @@
|
||||
php=php@8.2
|
||||
@@ -23,6 +23,8 @@
|
||||
"symfony/dotenv": "7.0.*",
|
||||
"symfony/flex": "^2",
|
||||
"symfony/framework-bundle": "7.0.*",
|
||||
"symfony/monolog-bundle": "^3.10",
|
||||
"symfony/notifier": "7.0.*",
|
||||
"symfony/runtime": "7.0.*",
|
||||
"symfony/translation": "7.0.*",
|
||||
"symfony/twig-bundle": "7.0.*",
|
||||
@@ -61,7 +63,8 @@
|
||||
"scripts": {
|
||||
"auto-scripts": {
|
||||
"cache:clear": "symfony-cmd",
|
||||
"assets:install %PUBLIC_DIR%": "symfony-cmd"
|
||||
"assets:install %PUBLIC_DIR%": "symfony-cmd",
|
||||
"flasher:install": "symfony-cmd"
|
||||
},
|
||||
"post-install-cmd": [
|
||||
"@auto-scripts"
|
||||
@@ -80,6 +83,9 @@
|
||||
}
|
||||
},
|
||||
"require-dev": {
|
||||
"symfony/maker-bundle": "^1.58"
|
||||
"spatie/ray": "^1.41",
|
||||
"symfony/maker-bundle": "^1.58",
|
||||
"symfony/stopwatch": "7.0.*",
|
||||
"symfony/web-profiler-bundle": "7.0.*"
|
||||
}
|
||||
}
|
||||
|
||||
Generated
+940
-16
File diff suppressed because it is too large
Load Diff
@@ -11,4 +11,6 @@ return [
|
||||
Twig\Extra\TwigExtraBundle\TwigExtraBundle::class => ['all' => true],
|
||||
Symfony\Bundle\MakerBundle\MakerBundle::class => ['dev' => true],
|
||||
Nelmio\SecurityBundle\NelmioSecurityBundle::class => ['all' => true],
|
||||
Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class => ['dev' => true, 'test' => true],
|
||||
Symfony\Bundle\MonologBundle\MonologBundle::class => ['all' => true],
|
||||
];
|
||||
|
||||
@@ -32,4 +32,4 @@ flasher:
|
||||
# Criteria to filter displayed notifications (limit, types)
|
||||
filter:
|
||||
# Limit number of displayed notifications
|
||||
limit: 5
|
||||
# limit: 5
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
monolog:
|
||||
channels:
|
||||
- deprecation # Deprecations are logged in the dedicated "deprecation" channel when it exists
|
||||
|
||||
when@dev:
|
||||
monolog:
|
||||
handlers:
|
||||
main:
|
||||
type: stream
|
||||
path: "%kernel.logs_dir%/%kernel.environment%.log"
|
||||
level: debug
|
||||
channels: ["!event"]
|
||||
# uncomment to get logging in your browser
|
||||
# you may have to allow bigger header sizes in your Web server configuration
|
||||
#firephp:
|
||||
# type: firephp
|
||||
# level: info
|
||||
#chromephp:
|
||||
# type: chromephp
|
||||
# level: info
|
||||
console:
|
||||
type: console
|
||||
process_psr_3_messages: false
|
||||
channels: ["!event", "!doctrine", "!console"]
|
||||
|
||||
when@test:
|
||||
monolog:
|
||||
handlers:
|
||||
main:
|
||||
type: fingers_crossed
|
||||
action_level: error
|
||||
handler: nested
|
||||
excluded_http_codes: [404, 405]
|
||||
channels: ["!event"]
|
||||
nested:
|
||||
type: stream
|
||||
path: "%kernel.logs_dir%/%kernel.environment%.log"
|
||||
level: debug
|
||||
|
||||
when@prod:
|
||||
monolog:
|
||||
handlers:
|
||||
main:
|
||||
type: fingers_crossed
|
||||
action_level: error
|
||||
handler: nested
|
||||
excluded_http_codes: [404, 405]
|
||||
buffer_size: 50 # How many messages should be saved? Prevent memory leaks
|
||||
nested:
|
||||
type: stream
|
||||
path: php://stderr
|
||||
level: debug
|
||||
formatter: monolog.formatter.json
|
||||
console:
|
||||
type: console
|
||||
process_psr_3_messages: false
|
||||
channels: ["!event", "!doctrine"]
|
||||
deprecation:
|
||||
type: stream
|
||||
channels: [deprecation]
|
||||
path: php://stderr
|
||||
formatter: monolog.formatter.json
|
||||
@@ -0,0 +1,12 @@
|
||||
framework:
|
||||
notifier:
|
||||
chatter_transports:
|
||||
texter_transports:
|
||||
channel_policy:
|
||||
# use chat/slack, chat/telegram, sms/twilio or sms/nexmo
|
||||
urgent: ['email']
|
||||
high: ['email']
|
||||
medium: ['email']
|
||||
low: ['email']
|
||||
admin_recipients:
|
||||
- { email: admin@example.com }
|
||||
@@ -0,0 +1,17 @@
|
||||
when@dev:
|
||||
web_profiler:
|
||||
toolbar: true
|
||||
intercept_redirects: false
|
||||
|
||||
framework:
|
||||
profiler:
|
||||
only_exceptions: false
|
||||
collect_serializer_data: true
|
||||
|
||||
when@test:
|
||||
web_profiler:
|
||||
toolbar: false
|
||||
intercept_redirects: false
|
||||
|
||||
framework:
|
||||
profiler: { collect: false }
|
||||
@@ -0,0 +1,8 @@
|
||||
when@dev:
|
||||
web_profiler_wdt:
|
||||
resource: '@WebProfilerBundle/Resources/config/routing/wdt.xml'
|
||||
prefix: /_wdt
|
||||
|
||||
web_profiler_profiler:
|
||||
resource: '@WebProfilerBundle/Resources/config/routing/profiler.xml'
|
||||
prefix: /_profiler
|
||||
@@ -0,0 +1 @@
|
||||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("@flasher/flasher"),require("noty")):"function"==typeof define&&define.amd?define(["@flasher/flasher","noty"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).Noty=t(e.flasher,e.Noty)}(this,(function(e,t){"use strict";class s{success(e,t,s){this.flash("success",e,t,s)}error(e,t,s){this.flash("error",e,t,s)}info(e,t,s){this.flash("info",e,t,s)}warning(e,t,s){this.flash("warning",e,t,s)}flash(e,t,s,o){if("object"==typeof e?(e=(o=e).type,t=o.message,s=o.title):"object"==typeof t?(t=(o=t).message,s=o.title):"object"==typeof s&&(s=(o=s).title),void 0===t)throw new Error("message option is required");const n={type:e,message:t,title:s||e,options:o||{},metadata:{plugin:""}};this.renderOptions(o||{}),this.renderEnvelopes([n])}}const o=new class extends s{renderEnvelopes(e){e.forEach((e=>{var s;const o=Object.assign({text:e.message,type:e.type},e.options),n=new t(o);n.show(),null===(s=n.layoutDom)||void 0===s||(s.dataset.turboTemporary="")}))}renderOptions(e){t.overrideDefaults(Object.assign({timeout:e.timeout||5e3},e))}};return e.addPlugin("noty",o),o}));
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1 @@
|
||||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("@flasher/flasher"),require("sweetalert2")):"function"==typeof define&&define.amd?define(["@flasher/flasher","sweetalert2"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).sweetalert=t(e.flasher,e.Swal)}(this,(function(e,t){"use strict";function s(e,t,s,n){return new(s||(s=Promise))((function(i,r){function o(e){try{a(n.next(e))}catch(e){r(e)}}function l(e){try{a(n.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(o,l)}a((n=n.apply(e,t||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;class n{success(e,t,s){this.flash("success",e,t,s)}error(e,t,s){this.flash("error",e,t,s)}info(e,t,s){this.flash("info",e,t,s)}warning(e,t,s){this.flash("warning",e,t,s)}flash(e,t,s,n){if("object"==typeof e?(e=(n=e).type,t=n.message,s=n.title):"object"==typeof t?(t=(n=t).message,s=n.title):"object"==typeof s&&(s=(n=s).title),void 0===t)throw new Error("message option is required");const i={type:e,message:t,title:s||e,options:n||{},metadata:{plugin:""}};this.renderOptions(n||{}),this.renderEnvelopes([i])}}const i=new class extends n{renderEnvelopes(e){return s(this,void 0,void 0,(function*(){for(const t of e)yield this.renderEnvelope(t)}))}renderOptions(e){this.sweetalert=this.sweetalert||t.mixin(Object.assign({timer:e.timer||5e3,timerProgressBar:e.timerProgressBar||!0},e)),document.addEventListener("turbo:before-cache",(()=>{var e;t.isVisible()&&(null===(e=t.getPopup())||void 0===e||e.style.setProperty("animation-duration","0ms"),t.close())}))}renderEnvelope(e){return s(this,void 0,void 0,(function*(){var t;let{options:s}=e;s=Object.assign(Object.assign({},s),{icon:(null==s?void 0:s.icon)||e.type,text:(null==s?void 0:s.text)||e.message}),yield null===(t=this.sweetalert)||void 0===t?void 0:t.fire(s).then((t=>{window.dispatchEvent(new CustomEvent("flasher:sweetalert:promise",{detail:{promise:t,envelope:e}}))}))}))}};return e.addPlugin("sweetalert",i),i}));
|
||||
@@ -0,0 +1 @@
|
||||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("@flasher/flasher"),require("toastr")):"function"==typeof define&&define.amd?define(["@flasher/flasher","toastr"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).toastr=t(e.flasher,e.toastr)}(this,(function(e,t){"use strict";class s{success(e,t,s){this.flash("success",e,t,s)}error(e,t,s){this.flash("error",e,t,s)}info(e,t,s){this.flash("info",e,t,s)}warning(e,t,s){this.flash("warning",e,t,s)}flash(e,t,s,r){if("object"==typeof e?(e=(r=e).type,t=r.message,s=r.title):"object"==typeof t?(t=(r=t).message,s=r.title):"object"==typeof s&&(s=(r=s).title),void 0===t)throw new Error("message option is required");const o={type:e,message:t,title:s||e,options:r||{},metadata:{plugin:""}};this.renderOptions(r||{}),this.renderEnvelopes([o])}}const r=new class extends s{renderEnvelopes(e){e.forEach((e=>{const{message:s,title:r,type:o,options:i}=e,n=t[o](s,r,i);n&&n.parent().attr("data-turbo-temporary","")}))}renderOptions(e){t.options=Object.assign({timeOut:e.timeOut||5e3,progressBar:e.progressBar||!0},e)}};return e.addPlugin("toastr",r),r}));
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"/vendor/flasher/flasher.min.js": "/vendor/flasher/flasher.min.js?id=9a255a6680873c0d5fc3d394a2ba3195",
|
||||
"/vendor/flasher/flasher.min.css": "/vendor/flasher/flasher.min.css?id=7a96e40c68626198d5128ad2fb5d77e0",
|
||||
"/vendor/flasher/mint.css": "/vendor/flasher/mint.css?id=348f135fff639305dde0005c647c1d20",
|
||||
"/vendor/flasher/flasher-noty.min.js": "/vendor/flasher/flasher-noty.min.js?id=d7d160fe2043e65250dfcaa5590d2e28",
|
||||
"/vendor/flasher/noty.css": "/vendor/flasher/noty.css?id=bf51111a785e04cc8c86a7786e855484",
|
||||
"/vendor/flasher/noty.min.js": "/vendor/flasher/noty.min.js?id=840a31ddb720ff391cfc386c009d3422",
|
||||
"/vendor/flasher/flasher-notyf.min.js": "/vendor/flasher/flasher-notyf.min.js?id=d8778adb84f0e2521d413c9ca995309c",
|
||||
"/vendor/flasher/flasher-notyf.min.css": "/vendor/flasher/flasher-notyf.min.css?id=53f57ecf59a7045f8029243bde3ed054",
|
||||
"/vendor/flasher/toastr.min.css": "/vendor/flasher/toastr.min.css?id=f284028c678041d687c6f1be6968f68a",
|
||||
"/vendor/flasher/flasher-toastr.min.js": "/vendor/flasher/flasher-toastr.min.js?id=e0d38991a82d544068555ff7c2a2339b",
|
||||
"/vendor/flasher/toastr.min.js": "/vendor/flasher/toastr.min.js?id=8ee1218b09fb02d43fcf0b84e30637ad",
|
||||
"/vendor/flasher/jquery.min.js": "/vendor/flasher/jquery.min.js?id=2c872dbe60f4ba70fb85356113d8b35e",
|
||||
"/vendor/flasher/sweetalert2.min.js": "/vendor/flasher/sweetalert2.min.js?id=52e4f161dbe2cf71c99dfef9f94fb1ff",
|
||||
"/vendor/flasher/sweetalert2.min.css": "/vendor/flasher/sweetalert2.min.css?id=a45abfe01a51ef4b1a068fb739f4e540",
|
||||
"/vendor/flasher/flasher-sweetalert.min.js": "/vendor/flasher/flasher-sweetalert.min.js?id=4ede7e66493a3432961bb00ce83dd4da"
|
||||
}
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
.noty_theme__mint.noty_bar {
|
||||
margin: 4px 0;
|
||||
overflow: hidden;
|
||||
border-radius: 2px;
|
||||
position: relative; }
|
||||
.noty_theme__mint.noty_bar .noty_body {
|
||||
padding: 10px;
|
||||
font-size: 14px; }
|
||||
.noty_theme__mint.noty_bar .noty_buttons {
|
||||
padding: 10px; }
|
||||
|
||||
.noty_theme__mint.noty_type__alert,
|
||||
.noty_theme__mint.noty_type__notification {
|
||||
background-color: #fff;
|
||||
border-bottom: 1px solid #D1D1D1;
|
||||
color: #2F2F2F; }
|
||||
|
||||
.noty_theme__mint.noty_type__warning {
|
||||
background-color: #FFAE42;
|
||||
border-bottom: 1px solid #E89F3C;
|
||||
color: #fff; }
|
||||
|
||||
.noty_theme__mint.noty_type__error {
|
||||
background-color: #DE636F;
|
||||
border-bottom: 1px solid #CA5A65;
|
||||
color: #fff; }
|
||||
|
||||
.noty_theme__mint.noty_type__info,
|
||||
.noty_theme__mint.noty_type__information {
|
||||
background-color: #7F7EFF;
|
||||
border-bottom: 1px solid #7473E8;
|
||||
color: #fff; }
|
||||
|
||||
.noty_theme__mint.noty_type__success {
|
||||
background-color: #AFC765;
|
||||
border-bottom: 1px solid #A0B55C;
|
||||
color: #fff; }
|
||||
+216
@@ -0,0 +1,216 @@
|
||||
.noty_layout_mixin, #noty_layout__top, #noty_layout__topLeft, #noty_layout__topCenter, #noty_layout__topRight, #noty_layout__bottom, #noty_layout__bottomLeft, #noty_layout__bottomCenter, #noty_layout__bottomRight, #noty_layout__center, #noty_layout__centerLeft, #noty_layout__centerRight {
|
||||
position: fixed;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
z-index: 9999999;
|
||||
-webkit-transform: translateZ(0) scale(1, 1);
|
||||
transform: translateZ(0) scale(1, 1);
|
||||
-webkit-backface-visibility: hidden;
|
||||
backface-visibility: hidden;
|
||||
-webkit-font-smoothing: subpixel-antialiased;
|
||||
filter: blur(0);
|
||||
-webkit-filter: blur(0);
|
||||
max-width: 90%; }
|
||||
|
||||
#noty_layout__top {
|
||||
top: 0;
|
||||
left: 5%;
|
||||
width: 90%; }
|
||||
|
||||
#noty_layout__topLeft {
|
||||
top: 20px;
|
||||
left: 20px;
|
||||
width: 325px; }
|
||||
|
||||
#noty_layout__topCenter {
|
||||
top: 5%;
|
||||
left: 50%;
|
||||
width: 325px;
|
||||
-webkit-transform: translate(-webkit-calc(-50% - .5px)) translateZ(0) scale(1, 1);
|
||||
transform: translate(calc(-50% - .5px)) translateZ(0) scale(1, 1); }
|
||||
|
||||
#noty_layout__topRight {
|
||||
top: 20px;
|
||||
right: 20px;
|
||||
width: 325px; }
|
||||
|
||||
#noty_layout__bottom {
|
||||
bottom: 0;
|
||||
left: 5%;
|
||||
width: 90%; }
|
||||
|
||||
#noty_layout__bottomLeft {
|
||||
bottom: 20px;
|
||||
left: 20px;
|
||||
width: 325px; }
|
||||
|
||||
#noty_layout__bottomCenter {
|
||||
bottom: 5%;
|
||||
left: 50%;
|
||||
width: 325px;
|
||||
-webkit-transform: translate(-webkit-calc(-50% - .5px)) translateZ(0) scale(1, 1);
|
||||
transform: translate(calc(-50% - .5px)) translateZ(0) scale(1, 1); }
|
||||
|
||||
#noty_layout__bottomRight {
|
||||
bottom: 20px;
|
||||
right: 20px;
|
||||
width: 325px; }
|
||||
|
||||
#noty_layout__center {
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
width: 325px;
|
||||
-webkit-transform: translate(-webkit-calc(-50% - .5px), -webkit-calc(-50% - .5px)) translateZ(0) scale(1, 1);
|
||||
transform: translate(calc(-50% - .5px), calc(-50% - .5px)) translateZ(0) scale(1, 1); }
|
||||
|
||||
#noty_layout__centerLeft {
|
||||
top: 50%;
|
||||
left: 20px;
|
||||
width: 325px;
|
||||
-webkit-transform: translate(0, -webkit-calc(-50% - .5px)) translateZ(0) scale(1, 1);
|
||||
transform: translate(0, calc(-50% - .5px)) translateZ(0) scale(1, 1); }
|
||||
|
||||
#noty_layout__centerRight {
|
||||
top: 50%;
|
||||
right: 20px;
|
||||
width: 325px;
|
||||
-webkit-transform: translate(0, -webkit-calc(-50% - .5px)) translateZ(0) scale(1, 1);
|
||||
transform: translate(0, calc(-50% - .5px)) translateZ(0) scale(1, 1); }
|
||||
|
||||
.noty_progressbar {
|
||||
display: none; }
|
||||
|
||||
.noty_has_timeout.noty_has_progressbar .noty_progressbar {
|
||||
display: block;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
height: 3px;
|
||||
width: 100%;
|
||||
background-color: #646464;
|
||||
opacity: 0.2;
|
||||
filter: alpha(opacity=10); }
|
||||
|
||||
.noty_bar {
|
||||
-webkit-backface-visibility: hidden;
|
||||
-webkit-transform: translate(0, 0) translateZ(0) scale(1, 1);
|
||||
-ms-transform: translate(0, 0) scale(1, 1);
|
||||
transform: translate(0, 0) scale(1, 1);
|
||||
-webkit-font-smoothing: subpixel-antialiased;
|
||||
overflow: hidden; }
|
||||
|
||||
.noty_effects_open {
|
||||
opacity: 0;
|
||||
-webkit-transform: translate(50%);
|
||||
-ms-transform: translate(50%);
|
||||
transform: translate(50%);
|
||||
-webkit-animation: noty_anim_in 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
|
||||
animation: noty_anim_in 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
|
||||
-webkit-animation-fill-mode: forwards;
|
||||
animation-fill-mode: forwards; }
|
||||
|
||||
.noty_effects_close {
|
||||
-webkit-animation: noty_anim_out 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
|
||||
animation: noty_anim_out 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
|
||||
-webkit-animation-fill-mode: forwards;
|
||||
animation-fill-mode: forwards; }
|
||||
|
||||
.noty_fix_effects_height {
|
||||
-webkit-animation: noty_anim_height 75ms ease-out;
|
||||
animation: noty_anim_height 75ms ease-out; }
|
||||
|
||||
.noty_close_with_click {
|
||||
cursor: pointer; }
|
||||
|
||||
.noty_close_button {
|
||||
position: absolute;
|
||||
top: 2px;
|
||||
right: 2px;
|
||||
font-weight: bold;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
text-align: center;
|
||||
line-height: 20px;
|
||||
background-color: rgba(0, 0, 0, 0.05);
|
||||
border-radius: 2px;
|
||||
cursor: pointer;
|
||||
-webkit-transition: all .2s ease-out;
|
||||
transition: all .2s ease-out; }
|
||||
|
||||
.noty_close_button:hover {
|
||||
background-color: rgba(0, 0, 0, 0.1); }
|
||||
|
||||
.noty_modal {
|
||||
position: fixed;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-color: #000;
|
||||
z-index: 10000;
|
||||
opacity: .3;
|
||||
left: 0;
|
||||
top: 0; }
|
||||
|
||||
.noty_modal.noty_modal_open {
|
||||
opacity: 0;
|
||||
-webkit-animation: noty_modal_in .3s ease-out;
|
||||
animation: noty_modal_in .3s ease-out; }
|
||||
|
||||
.noty_modal.noty_modal_close {
|
||||
-webkit-animation: noty_modal_out .3s ease-out;
|
||||
animation: noty_modal_out .3s ease-out;
|
||||
-webkit-animation-fill-mode: forwards;
|
||||
animation-fill-mode: forwards; }
|
||||
|
||||
@-webkit-keyframes noty_modal_in {
|
||||
100% {
|
||||
opacity: .3; } }
|
||||
|
||||
@keyframes noty_modal_in {
|
||||
100% {
|
||||
opacity: .3; } }
|
||||
|
||||
@-webkit-keyframes noty_modal_out {
|
||||
100% {
|
||||
opacity: 0; } }
|
||||
|
||||
@keyframes noty_modal_out {
|
||||
100% {
|
||||
opacity: 0; } }
|
||||
|
||||
@keyframes noty_modal_out {
|
||||
100% {
|
||||
opacity: 0; } }
|
||||
|
||||
@-webkit-keyframes noty_anim_in {
|
||||
100% {
|
||||
-webkit-transform: translate(0);
|
||||
transform: translate(0);
|
||||
opacity: 1; } }
|
||||
|
||||
@keyframes noty_anim_in {
|
||||
100% {
|
||||
-webkit-transform: translate(0);
|
||||
transform: translate(0);
|
||||
opacity: 1; } }
|
||||
|
||||
@-webkit-keyframes noty_anim_out {
|
||||
100% {
|
||||
-webkit-transform: translate(50%);
|
||||
transform: translate(50%);
|
||||
opacity: 0; } }
|
||||
|
||||
@keyframes noty_anim_out {
|
||||
100% {
|
||||
-webkit-transform: translate(50%);
|
||||
transform: translate(50%);
|
||||
opacity: 0; } }
|
||||
|
||||
@-webkit-keyframes noty_anim_height {
|
||||
100% {
|
||||
height: 0; } }
|
||||
|
||||
@keyframes noty_anim_height {
|
||||
100% {
|
||||
height: 0; } }
|
||||
|
||||
/*# sourceMappingURL=noty.css.map*/
|
||||
+17
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -21,11 +21,9 @@ class HomeController extends AbstractController
|
||||
flash()->created(new Book('lord of the rings'));
|
||||
flash()->saved(new Book('harry potter'));
|
||||
|
||||
// flash()->updated();
|
||||
// flash()->deleted();
|
||||
flash()->updated();
|
||||
flash()->deleted();
|
||||
|
||||
return $this->render('home/index.html.twig', [
|
||||
'controller_name' => 'HomeController',
|
||||
]);
|
||||
return $this->render('home/index.html.twig');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,6 +75,30 @@
|
||||
"ref": "fadbfe33303a76e25cb63401050439aa9b1a9c7f"
|
||||
}
|
||||
},
|
||||
"symfony/monolog-bundle": {
|
||||
"version": "3.10",
|
||||
"recipe": {
|
||||
"repo": "github.com/symfony/recipes",
|
||||
"branch": "main",
|
||||
"version": "3.7",
|
||||
"ref": "aff23899c4440dd995907613c1dd709b6f59503f"
|
||||
},
|
||||
"files": [
|
||||
"config/packages/monolog.yaml"
|
||||
]
|
||||
},
|
||||
"symfony/notifier": {
|
||||
"version": "7.0",
|
||||
"recipe": {
|
||||
"repo": "github.com/symfony/recipes",
|
||||
"branch": "main",
|
||||
"version": "5.0",
|
||||
"ref": "178877daf79d2dbd62129dd03612cb1a2cb407cc"
|
||||
},
|
||||
"files": [
|
||||
"config/packages/notifier.yaml"
|
||||
]
|
||||
},
|
||||
"symfony/routing": {
|
||||
"version": "7.0",
|
||||
"recipe": {
|
||||
@@ -114,6 +138,19 @@
|
||||
"templates/base.html.twig"
|
||||
]
|
||||
},
|
||||
"symfony/web-profiler-bundle": {
|
||||
"version": "7.0",
|
||||
"recipe": {
|
||||
"repo": "github.com/symfony/recipes",
|
||||
"branch": "main",
|
||||
"version": "6.1",
|
||||
"ref": "e42b3f0177df239add25373083a564e5ead4e13a"
|
||||
},
|
||||
"files": [
|
||||
"config/packages/web_profiler.yaml",
|
||||
"config/routes/web_profiler.yaml"
|
||||
]
|
||||
},
|
||||
"twig/extra-bundle": {
|
||||
"version": "v3.8.0"
|
||||
}
|
||||
|
||||
+100
-24
@@ -1,27 +1,51 @@
|
||||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
addressable (2.8.6)
|
||||
public_suffix (>= 2.0.2, < 6.0)
|
||||
addressable (2.8.7)
|
||||
public_suffix (>= 2.0.2, < 7.0)
|
||||
base64 (0.2.0)
|
||||
bigdecimal (3.1.7)
|
||||
bigdecimal (3.1.9)
|
||||
colorator (1.1.0)
|
||||
concurrent-ruby (1.2.3)
|
||||
csv (3.3.0)
|
||||
concurrent-ruby (1.3.5)
|
||||
csv (3.3.2)
|
||||
em-websocket (0.5.3)
|
||||
eventmachine (>= 0.12.9)
|
||||
http_parser.rb (~> 0)
|
||||
eventmachine (1.2.7)
|
||||
ffi (1.16.3)
|
||||
ffi (1.17.1)
|
||||
ffi (1.17.1-aarch64-linux-gnu)
|
||||
ffi (1.17.1-aarch64-linux-musl)
|
||||
ffi (1.17.1-arm-linux-gnu)
|
||||
ffi (1.17.1-arm-linux-musl)
|
||||
ffi (1.17.1-arm64-darwin)
|
||||
ffi (1.17.1-x86-linux-gnu)
|
||||
ffi (1.17.1-x86-linux-musl)
|
||||
ffi (1.17.1-x86_64-darwin)
|
||||
ffi (1.17.1-x86_64-linux-gnu)
|
||||
ffi (1.17.1-x86_64-linux-musl)
|
||||
forwardable-extended (2.6.0)
|
||||
google-protobuf (4.26.1)
|
||||
google-protobuf (4.29.3)
|
||||
bigdecimal
|
||||
rake (>= 13)
|
||||
google-protobuf (4.26.1-x86_64-linux)
|
||||
google-protobuf (4.29.3-aarch64-linux)
|
||||
bigdecimal
|
||||
rake (>= 13)
|
||||
google-protobuf (4.29.3-arm64-darwin)
|
||||
bigdecimal
|
||||
rake (>= 13)
|
||||
google-protobuf (4.29.3-x86-linux)
|
||||
bigdecimal
|
||||
rake (>= 13)
|
||||
google-protobuf (4.29.3-x86_64-darwin)
|
||||
bigdecimal
|
||||
rake (>= 13)
|
||||
google-protobuf (4.29.3-x86_64-linux)
|
||||
bigdecimal
|
||||
rake (>= 13)
|
||||
http_parser.rb (0.8.0)
|
||||
i18n (1.14.4)
|
||||
i18n (1.14.6)
|
||||
concurrent-ruby (~> 1.0)
|
||||
jekyll (4.3.3)
|
||||
jekyll (4.3.4)
|
||||
addressable (~> 2.4)
|
||||
colorator (~> 1.0)
|
||||
em-websocket (~> 0.5)
|
||||
@@ -47,8 +71,8 @@ GEM
|
||||
jekyll (>= 3.7, < 5.0)
|
||||
jekyll-watch (2.2.1)
|
||||
listen (~> 3.0)
|
||||
kramdown (2.4.0)
|
||||
rexml
|
||||
kramdown (2.5.1)
|
||||
rexml (>= 3.3.9)
|
||||
kramdown-parser-gfm (1.1.0)
|
||||
kramdown (~> 2.0)
|
||||
liquid (4.0.4)
|
||||
@@ -58,27 +82,79 @@ GEM
|
||||
mercenary (0.4.0)
|
||||
pathutil (0.16.2)
|
||||
forwardable-extended (~> 2.6)
|
||||
public_suffix (5.0.5)
|
||||
public_suffix (6.0.1)
|
||||
rake (13.2.1)
|
||||
rb-fsevent (0.11.2)
|
||||
rb-inotify (0.10.1)
|
||||
rb-inotify (0.11.1)
|
||||
ffi (~> 1.0)
|
||||
rexml (3.2.6)
|
||||
rouge (4.2.1)
|
||||
rexml (3.4.0)
|
||||
rouge (4.5.1)
|
||||
safe_yaml (1.0.5)
|
||||
sass-embedded (1.76.0)
|
||||
google-protobuf (>= 3.25, < 5.0)
|
||||
rake (>= 13.0.0)
|
||||
sass-embedded (1.76.0-x86_64-linux-gnu)
|
||||
google-protobuf (>= 3.25, < 5.0)
|
||||
sass-embedded (1.83.4)
|
||||
google-protobuf (~> 4.29)
|
||||
rake (>= 13)
|
||||
sass-embedded (1.83.4-aarch64-linux-android)
|
||||
google-protobuf (~> 4.29)
|
||||
sass-embedded (1.83.4-aarch64-linux-gnu)
|
||||
google-protobuf (~> 4.29)
|
||||
sass-embedded (1.83.4-aarch64-linux-musl)
|
||||
google-protobuf (~> 4.29)
|
||||
sass-embedded (1.83.4-aarch64-mingw-ucrt)
|
||||
google-protobuf (~> 4.29)
|
||||
sass-embedded (1.83.4-arm-linux-androideabi)
|
||||
google-protobuf (~> 4.29)
|
||||
sass-embedded (1.83.4-arm-linux-gnueabihf)
|
||||
google-protobuf (~> 4.29)
|
||||
sass-embedded (1.83.4-arm-linux-musleabihf)
|
||||
google-protobuf (~> 4.29)
|
||||
sass-embedded (1.83.4-arm64-darwin)
|
||||
google-protobuf (~> 4.29)
|
||||
sass-embedded (1.83.4-riscv64-linux-android)
|
||||
google-protobuf (~> 4.29)
|
||||
sass-embedded (1.83.4-riscv64-linux-gnu)
|
||||
google-protobuf (~> 4.29)
|
||||
sass-embedded (1.83.4-riscv64-linux-musl)
|
||||
google-protobuf (~> 4.29)
|
||||
sass-embedded (1.83.4-x86_64-cygwin)
|
||||
google-protobuf (~> 4.29)
|
||||
sass-embedded (1.83.4-x86_64-darwin)
|
||||
google-protobuf (~> 4.29)
|
||||
sass-embedded (1.83.4-x86_64-linux-android)
|
||||
google-protobuf (~> 4.29)
|
||||
sass-embedded (1.83.4-x86_64-linux-gnu)
|
||||
google-protobuf (~> 4.29)
|
||||
sass-embedded (1.83.4-x86_64-linux-musl)
|
||||
google-protobuf (~> 4.29)
|
||||
terminal-table (3.0.2)
|
||||
unicode-display_width (>= 1.1.1, < 3)
|
||||
unicode-display_width (2.5.0)
|
||||
webrick (1.8.1)
|
||||
unicode-display_width (2.6.0)
|
||||
webrick (1.9.1)
|
||||
|
||||
PLATFORMS
|
||||
aarch64-linux
|
||||
aarch64-linux-android
|
||||
aarch64-linux-gnu
|
||||
aarch64-linux-musl
|
||||
aarch64-mingw-ucrt
|
||||
arm-linux-androideabi
|
||||
arm-linux-gnu
|
||||
arm-linux-gnueabihf
|
||||
arm-linux-musl
|
||||
arm-linux-musleabihf
|
||||
arm64-darwin
|
||||
riscv64-linux-android
|
||||
riscv64-linux-gnu
|
||||
riscv64-linux-musl
|
||||
ruby
|
||||
x86-linux
|
||||
x86-linux-gnu
|
||||
x86-linux-musl
|
||||
x86_64-cygwin
|
||||
x86_64-darwin
|
||||
x86_64-linux
|
||||
x86_64-linux-android
|
||||
x86_64-linux-gnu
|
||||
x86_64-linux-musl
|
||||
|
||||
DEPENDENCIES
|
||||
base64
|
||||
@@ -92,4 +168,4 @@ DEPENDENCIES
|
||||
webrick
|
||||
|
||||
BUNDLED WITH
|
||||
2.5.6
|
||||
2.6.3
|
||||
|
||||
+1
-1
@@ -4,4 +4,4 @@
|
||||
npm install --force
|
||||
npm run build
|
||||
bundle exec jekyll serve --livereload
|
||||
```
|
||||
```
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"dist/main.css": "/dist/main.6f6df8ca.css",
|
||||
"dist/main.js": "/dist/main.a8422ec5.js",
|
||||
"dist/main.css": "/dist/main.801e5ea3.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",
|
||||
|
||||
@@ -99,7 +99,7 @@ flash()->{{ type }}('{{ message }}');
|
||||
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 = [])
|
||||
flash()->flash(string $type, string $message, array $options = [], string $title = null)
|
||||
```
|
||||
|
||||
{% assign id = '#/ usage flash' %}
|
||||
|
||||
@@ -58,13 +58,12 @@
|
||||
</div>
|
||||
|
||||
<blockquote>
|
||||
<p>
|
||||
If you find <strong><span class="text-indigo-900">PHP<span class="text-indigo-500">Flasher</span></span></strong> useful,
|
||||
we would greatly appreciate your support in the form of a <strong>star</strong> rating ⭐
|
||||
on <a href="https://github.com/php-flasher/php-flasher"><i class="fab fa-github text-black"></i> GitHub</a>
|
||||
or by sharing the project on Twitter <a href="http://twitter.com/share?text=I%20really%20like%20this%20nice%20PHP%20package%2C%20that%20allows%20you%20to%20implement%20flash%20notifications%20in%20your%20app%20fast%20%F0%9F%9A%80%0A%0A%E2%86%92%20https%3A%2F%2Fphp-flasher.io%20by%20%40yoeunes%0A%0A%23php%20%23laravel%20%23symfony%20%23opensource"><i class="fab fa-twitter"></i> click here</a>.
|
||||
Your feedback helps us keep the package up-to-date and well-maintained. <strong>Thank you</strong> <i class="fa-solid fa-heart text-red-600"></i>
|
||||
</p>
|
||||
<p>
|
||||
If you find <strong><span class="text-indigo-900">PHP<span class="text-indigo-500">Flasher</span></span></strong> useful,
|
||||
please consider giving it a <strong>⭐ star</strong> on <a href="https://github.com/php-flasher/php-flasher"><i class="fab fa-github text-black"></i> GitHub</a> 😊.
|
||||
If you spot any typos or have suggestions, feel free to contribute to the documentation 📝.
|
||||
Your feedback helps keep the project up-to-date and well-maintained. <strong>Thank you</strong> <i class="fa-solid fa-heart text-red-600"></i>
|
||||
</p>
|
||||
</blockquote>
|
||||
|
||||
<hr>
|
||||
|
||||
Vendored
+2
-2
@@ -2,10 +2,10 @@
|
||||
"entrypoints": {
|
||||
"main": {
|
||||
"css": [
|
||||
"/dist/main.6f6df8ca.css"
|
||||
"/dist/main.801e5ea3.css"
|
||||
],
|
||||
"js": [
|
||||
"/dist/main.a8422ec5.js"
|
||||
"/dist/main.36e31cce.js"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
File diff suppressed because one or more lines are too long
Vendored
-1
File diff suppressed because one or more lines are too long
Vendored
+1
File diff suppressed because one or more lines are too long
Generated
+461
-2397
File diff suppressed because it is too large
Load Diff
+4
-4
@@ -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",
|
||||
@@ -16,8 +16,8 @@
|
||||
"@flasher/flasher-sweetalert": "file:../src/SweetAlert/Prime/Resources",
|
||||
"@flasher/flasher-toastr": "file:../src/Toastr/Prime/Resources",
|
||||
"@hotwired/stimulus": "^3.2.2",
|
||||
"@symfony/stimulus-bridge": "^3.2.2",
|
||||
"@symfony/webpack-encore": "^4.7.0",
|
||||
"@symfony/stimulus-bridge": "^3.2.3",
|
||||
"@symfony/webpack-encore": "^5.0.1",
|
||||
"noty": "^3.2.0-beta-deprecated",
|
||||
"notyf": "^3.10.0",
|
||||
"prismjs": "^1.29.0",
|
||||
@@ -30,7 +30,7 @@
|
||||
"node-ray": "^2.1.2",
|
||||
"postcss-import": "^16.1.0",
|
||||
"postcss-loader": "^7.3.4",
|
||||
"tailwindcss": "^3.4.12",
|
||||
"tailwindcss": "^3.4.17",
|
||||
"webpack-notifier": "^1.15.0"
|
||||
},
|
||||
"browserslist": [
|
||||
|
||||
+5
-3
@@ -1,6 +1,6 @@
|
||||
---
|
||||
permalink: /
|
||||
description: PHPFlasher is an open-source tool for easily adding flash messages to Laravel or Symfony projects, improving user interaction with minimal effort.
|
||||
description: PHPFlasher is an open-source tool that makes it easy to add flash messages to your Laravel or Symfony projects. Improve user interaction with minimal effort using simple, customizable notifications.
|
||||
data-controller: flasher
|
||||
---
|
||||
|
||||
@@ -64,8 +64,10 @@ Flash messages are important for interactive applications. **<strong><span class
|
||||
|
||||
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/)
|
||||
- [**Symfony Guide**](/symfony/)
|
||||
- [**Laravel Guide**](/laravel/)
|
||||
- [**Livewire Guide**](/livewire/)
|
||||
- [**Inertia Guide**](/inertia/)
|
||||
- [**Toastr Library**](/library/toastr/)
|
||||
- [**Noty Library**](/library/noty/)
|
||||
- [**Notyf Library**](/library/notyf/)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
permalink: /inertia/
|
||||
title: Inertia
|
||||
description: Easily add flash notification messages to your Inertia application with PHPFlasher. Follow our step-by-step guide to install and use the library in your project, and start engaging and informing your users with powerful flash messages.
|
||||
description: Discover how to integrate flash notifications into your Inertia.js application with PHPFlasher. Follow this guide to set up the library and enhance your user interface with dynamic messages.
|
||||
---
|
||||
|
||||
<strong><span class="text-indigo-900">PHP<span class="text-indigo-500">Flasher</span></span></strong> works well with Inertia.js.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
permalink: /installation/
|
||||
title: Installation
|
||||
description: Install only the specific components you need for your project with PHPFlasher, a modular PHP library for displaying flash notification messages. Simply include the library in your composer.json file and run the composer install command to get started.
|
||||
description: Install PHPFlasher in your project easily. It’s modular, so you can install only the parts you need. Just include the library in your composer.json file and run composer install to get started.
|
||||
---
|
||||
|
||||
**<span class="text-indigo-900">PHP<span class="text-indigo-500">Flasher</span></span>** is modular and consists of multiple libraries,
|
||||
|
||||
+28
-19
@@ -2,7 +2,7 @@
|
||||
permalink: /laravel/
|
||||
title: Laravel
|
||||
handler: flasher
|
||||
description: Easily add flash notification messages to your Laravel application with PHPFlasher. Follow our step-by-step guide to install and use the library in your project, and start engaging and informing your users with powerful flash messages.
|
||||
description: Add flash notifications to your Laravel application with PHPFlasher. Follow our step-by-step guide to install and use the library, and start informing your users with powerful flash messages.
|
||||
framework: laravel
|
||||
---
|
||||
|
||||
@@ -53,32 +53,30 @@ This will create a file at `config/flasher.php` with the following content:
|
||||
<?php // config/flasher.php
|
||||
|
||||
return [
|
||||
// Default notification library (e.g., 'flasher', 'toastr', 'noty', etc.)
|
||||
// Default notification library (e.g., 'flasher', 'toastr', 'noty', 'notyf', 'sweetalert')
|
||||
'default' => 'flasher',
|
||||
|
||||
// Path to the main JavaScript file of PHPFlasher
|
||||
// Path to the main PHPFlasher JavaScript file
|
||||
'main_script' => '/vendor/flasher/flasher.min.js',
|
||||
|
||||
// Path to the stylesheets for PHPFlasher notifications
|
||||
// List of CSS files to style your notifications
|
||||
'styles' => [
|
||||
'/vendor/flasher/flasher.min.css',
|
||||
],
|
||||
|
||||
// Enable translation of PHPFlasher messages using Laravel's translator service
|
||||
'translate' => true,
|
||||
// Set global options for all notifications (optional)
|
||||
// 'options' => [
|
||||
// 'timeout' => 5000, // Time in milliseconds before the notification disappears
|
||||
// 'position' => 'top-right', // Where the notification appears on the screen
|
||||
// ],
|
||||
|
||||
// Automatically inject PHPFlasher assets in HTML response
|
||||
// Automatically inject JavaScript and CSS assets into your HTML pages
|
||||
'inject_assets' => true,
|
||||
|
||||
// Global options
|
||||
'options' => [
|
||||
'timeout' => 5000, // in milliseconds
|
||||
'position' => 'top-right',
|
||||
'escapeHtml' => false,
|
||||
],
|
||||
// Enable message translation using Laravel's translation service
|
||||
'translate' => true,
|
||||
|
||||
// Configuration for the flash bag (converting Laravel flash messages)
|
||||
// Map Laravel session keys to PHPFlasher types
|
||||
// Map Laravel flash message keys to notification types
|
||||
'flash_bag' => [
|
||||
'success' => ['success'],
|
||||
'error' => ['error', 'danger'],
|
||||
@@ -86,11 +84,22 @@ return [
|
||||
'info' => ['info', 'notice', 'alert'],
|
||||
],
|
||||
|
||||
// Filter criteria for notifications (e.g., limit number, types)
|
||||
'filter' => [
|
||||
'limit' => 5, // Limit the number of displayed notifications
|
||||
],
|
||||
// Set criteria to filter which notifications are displayed (optional)
|
||||
// 'filter' => [
|
||||
// 'limit' => 5, // Maximum number of notifications to show at once
|
||||
// ],
|
||||
|
||||
// Define notification presets to simplify notification creation (optional)
|
||||
// 'presets' => [
|
||||
// 'entity_saved' => [
|
||||
// 'type' => 'success',
|
||||
// 'title' => 'Entity saved',
|
||||
// 'message' => 'Entity saved successfully',
|
||||
// ],
|
||||
// ],
|
||||
];
|
||||
|
||||
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
permalink: /library/noty/
|
||||
title: Noty
|
||||
description: Elevate your user experience with Noty, a popular JavaScript library for creating customizable, stylish notification messages. Easy to install and use, Noty is perfect for any project that wants to engage and inform users in a dynamic way.
|
||||
description: Enhance your user experience with Noty, a JavaScript library for creating customizable notification messages. Learn how to use Noty with PHPFlasher to display stylish notifications in your project.
|
||||
handler: noty
|
||||
data-controller: noty
|
||||
---
|
||||
@@ -22,6 +22,8 @@ php artisan flasher:install
|
||||
|
||||
<p id="laravel-configuration"><a href="#laravel-configuration" class="anchor"><i class="fa-duotone fa-link"></i> Configuration</a></p>
|
||||
|
||||
> <strong>Note:</strong> The configuration settings below are the default ones. You only need to change them if you want to customize the default behavior.
|
||||
|
||||
```php
|
||||
<?php // config/flasher.php
|
||||
|
||||
@@ -38,7 +40,7 @@ return [
|
||||
],
|
||||
'options' => [
|
||||
// Optional: Add global options here
|
||||
'layout' => 'topRight'
|
||||
// 'layout' => 'topRight'
|
||||
],
|
||||
],
|
||||
],
|
||||
@@ -62,6 +64,8 @@ php bin/console flasher:install
|
||||
|
||||
<p id="symfony-configuration"><a href="#symfony-configuration" class="anchor"><i class="fa-duotone fa-link"></i> Configuration</a></p>
|
||||
|
||||
> <strong>Note:</strong> The configuration settings below are the default ones. You only need to change them if you want to customize the default behavior.
|
||||
|
||||
```yaml
|
||||
# config/packages/flasher.yaml
|
||||
|
||||
@@ -76,7 +80,7 @@ flasher:
|
||||
- '/vendor/flasher/mint.css'
|
||||
options:
|
||||
# Optional: Add global options here
|
||||
layout: topRight
|
||||
# layout: topRight
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
permalink: /library/notyf/
|
||||
title: Notyf
|
||||
description: Add lightweight, customizable notification messages to your web projects with Notyf, a popular JavaScript library. With a focus on simplicity and accessibility, Notyf is easy to install and use, making it a great choice for any project that wants to engage and inform users.
|
||||
description: Add lightweight, customizable notifications to your web projects with Notyf. This guide shows you how to integrate Notyf with PHPFlasher to engage and inform your users effectively.
|
||||
handler: notyf
|
||||
data-controller: notyf
|
||||
---
|
||||
@@ -23,6 +23,8 @@ php artisan flasher:install
|
||||
|
||||
<p id="laravel-configuration"><a href="#laravel-configuration" class="anchor"><i class="fa-duotone fa-link"></i> Configuration</a></p>
|
||||
|
||||
> <strong>Note:</strong> The configuration settings below are the default ones. You only need to change them if you want to customize the default behavior.
|
||||
|
||||
```php
|
||||
<?php // config/flasher.php
|
||||
|
||||
@@ -37,7 +39,7 @@ return [
|
||||
],
|
||||
'options' => [
|
||||
// Optional: Add global options here
|
||||
'dismissible' => true,
|
||||
// 'dismissible' => true,
|
||||
],
|
||||
],
|
||||
],
|
||||
@@ -60,6 +62,8 @@ php bin/console flasher:install
|
||||
|
||||
<p id="symfony-configuration"><a href="#symfony-configuration" class="anchor"><i class="fa-duotone fa-link"></i> Configuration</a></p>
|
||||
|
||||
> <strong>Note:</strong> The configuration settings below are the default ones. You only need to change them if you want to customize the default behavior.
|
||||
|
||||
```yaml
|
||||
# config/packages/flasher.yaml
|
||||
|
||||
@@ -72,7 +76,7 @@ flasher:
|
||||
- '/vendor/flasher/flasher-notyf.min.css'
|
||||
options:
|
||||
# Optional: Add global options here
|
||||
dismissible: true
|
||||
# dismissible: true
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
permalink: /library/sweetalert/
|
||||
title: Sweetalert
|
||||
description: Add beautiful, customizable alert messages to your web projects with SweetAlert2, a popular JavaScript library. Easy to install and use, SweetAlert2 is perfect for any project that wants to engage and inform users in a visually appealing way.
|
||||
description: Integrate beautiful alert messages into your web projects with SweetAlert2. This guide demonstrates how to use SweetAlert2 with PHPFlasher to inform users in a visually appealing way.
|
||||
handler: sweetalert
|
||||
data-controller: sweetalert
|
||||
---
|
||||
@@ -22,6 +22,8 @@ php artisan flasher:install
|
||||
|
||||
<p id="laravel-configuration"><a href="#laravel-configuration" class="anchor"><i class="fa-duotone fa-link"></i> Configuration</a></p>
|
||||
|
||||
> <strong>Note:</strong> The configuration settings below are the default ones. You only need to change them if you want to customize the default behavior.
|
||||
|
||||
```php
|
||||
<?php // config/flasher.php
|
||||
|
||||
@@ -37,7 +39,7 @@ return [
|
||||
],
|
||||
'options' => [
|
||||
// Optional: Add global options here
|
||||
'position' => 'center'
|
||||
// 'position' => 'center'
|
||||
],
|
||||
],
|
||||
],
|
||||
@@ -61,6 +63,8 @@ php bin/console flasher:install
|
||||
|
||||
<p id="symfony-configuration"><a href="#symfony-configuration" class="anchor"><i class="fa-duotone fa-link"></i> Configuration</a></p>
|
||||
|
||||
> <strong>Note:</strong> The configuration settings below are the default ones. You only need to change them if you want to customize the default behavior.
|
||||
|
||||
```yaml
|
||||
# config/packages/flasher.yaml
|
||||
|
||||
@@ -74,7 +78,7 @@ flasher:
|
||||
- '/vendor/flasher/sweetalert2.min.css'
|
||||
options:
|
||||
# Optional: Add global options here
|
||||
position: center
|
||||
# position: center
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
permalink: /library/toastr/
|
||||
title: Toastr
|
||||
description: Easily add customizable, stylish notification messages to your web projects with Toastr, a popular JavaScript library. With a focus on simplicity and flexibility, Toastr is easy to install and use, making it a great choice for any project that wants to engage and inform users.
|
||||
description: Use Toastr with PHPFlasher to add stylish notifications to your web projects. Improve user engagement with easy-to-use, customizable notification messages.
|
||||
handler: toastr
|
||||
data-controller: toastr
|
||||
---
|
||||
@@ -22,6 +22,8 @@ php artisan flasher:install
|
||||
|
||||
<p id="laravel-configuration"><a href="#laravel-configuration" class="anchor"><i class="fa-duotone fa-link"></i> Configuration</a></p>
|
||||
|
||||
> <strong>Note:</strong> The configuration settings below are the default ones. You only need to change them if you want to customize the default behavior.
|
||||
|
||||
```php
|
||||
<?php // config/flasher.php
|
||||
|
||||
@@ -38,7 +40,7 @@ return [
|
||||
],
|
||||
'options' => [
|
||||
// Optional: Add global options here
|
||||
'closeButton' => true
|
||||
// 'closeButton' => true
|
||||
],
|
||||
],
|
||||
],
|
||||
@@ -63,6 +65,8 @@ php bin/console flasher:install
|
||||
|
||||
<p id="symfony-configuration"><a href="#symfony-configuration" class="anchor"><i class="fa-duotone fa-link"></i> Configuration</a></p>
|
||||
|
||||
> <strong>Note:</strong> The configuration settings below are the default ones. You only need to change them if you want to customize the default behavior.
|
||||
|
||||
```yaml
|
||||
# config/packages/flasher.yaml
|
||||
|
||||
@@ -77,7 +81,7 @@ flasher:
|
||||
- '/vendor/flasher/toastr.min.css'
|
||||
options:
|
||||
# Optional: Add global options here
|
||||
closeButton: true
|
||||
# closeButton: true
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
permalink: /livewire/
|
||||
title: Livewire
|
||||
description: Learn how to easily add flash notification messages to your Livewire application with PHPFlasher. Follow our step-by-step guide to install and use the library in your project, and start engaging and informing your users with powerful flash messages.
|
||||
description: Learn how to add flash notifications to your Livewire application using PHPFlasher. This guide walks you through installation and usage, so you can engage your users with informative messages.
|
||||
adapter: flasher
|
||||
---
|
||||
|
||||
|
||||
+37
-23
@@ -1,7 +1,7 @@
|
||||
---
|
||||
permalink: /symfony/
|
||||
title: Symfony
|
||||
description: Integrate PHPFlasher in your Symfony application to enhance user experience with flash notifications. This open-source package simplifies the addition of engaging messages following user actions.
|
||||
description: Integrate PHPFlasher into your Symfony application to enhance user experience with flash notifications. This guide shows you how to add engaging messages after user actions using PHPFlasher in Symfony.
|
||||
framework: symfony
|
||||
---
|
||||
|
||||
@@ -52,40 +52,54 @@ This will create a file at `config/packages/flasher.yaml` with the following con
|
||||
# config/packages/flasher.yaml
|
||||
|
||||
flasher:
|
||||
# Default notification library (e.g., 'flasher', 'toastr', 'noty', etc.)
|
||||
# Default notification library (e.g., 'flasher', 'toastr', 'noty', 'notyf', 'sweetalert')
|
||||
default: flasher
|
||||
|
||||
# Path to the main JavaScript file of PHPFlasher
|
||||
# Path to the main PHPFlasher JavaScript file
|
||||
main_script: '/vendor/flasher/flasher.min.js'
|
||||
|
||||
# Path to the stylesheets for PHPFlasher notifications
|
||||
# List of CSS files to style your notifications
|
||||
styles:
|
||||
- '/vendor/flasher/flasher.min.css'
|
||||
|
||||
# Enable translation of PHPFlasher messages using Symfony's translator service
|
||||
translate: true
|
||||
|
||||
# Automatically inject PHPFlasher assets in HTML response
|
||||
# Set global options for all notifications (optional)
|
||||
# options:
|
||||
# # Time in milliseconds before the notification disappears
|
||||
# timeout: 5000
|
||||
# # Where the notification appears on the screen
|
||||
# position: 'top-right'
|
||||
|
||||
# Automatically inject JavaScript and CSS assets into your HTML pages
|
||||
inject_assets: true
|
||||
|
||||
# Global options
|
||||
options:
|
||||
# timeout in milliseconds
|
||||
timeout: 5000
|
||||
position: 'top-right'
|
||||
escapeHtml: false
|
||||
# Enable message translation using Symfony's translation service
|
||||
translate: true
|
||||
|
||||
# Map Symfony session keys to PHPFlasher notification types
|
||||
# URL patterns to exclude from asset injection and flash_bag conversion
|
||||
excluded_paths:
|
||||
- '/^\/_profiler/'
|
||||
- '/^\/_fragment/'
|
||||
|
||||
# Map Symfony flash message keys to notification types
|
||||
flash_bag:
|
||||
success: ['success']
|
||||
error: ['error', 'danger']
|
||||
warning: ['warning', 'alarm']
|
||||
info: ['info', 'notice', 'alert']
|
||||
success: ['success']
|
||||
error: ['error', 'danger']
|
||||
warning: ['warning', 'alarm']
|
||||
info: ['info', 'notice', 'alert']
|
||||
|
||||
# Set criteria to filter which notifications are displayed (optional)
|
||||
# filter:
|
||||
# # Maximum number of notifications to show at once
|
||||
# limit: 5
|
||||
|
||||
# Define notification presets to simplify notification creation (optional)
|
||||
# presets:
|
||||
# # Example preset:
|
||||
# entity_saved:
|
||||
# type: 'success'
|
||||
# title: 'Entity saved'
|
||||
# message: 'Entity saved successfully'
|
||||
|
||||
# Criteria to filter displayed notifications (limit, types)
|
||||
filter:
|
||||
# Limit number of displayed notifications
|
||||
limit: 5
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
@@ -8,4 +8,6 @@ return static function (MBConfig $config) {
|
||||
$config->packageDirectories([
|
||||
__DIR__.'/src',
|
||||
]);
|
||||
|
||||
$config->packageAliasFormat('2.x-dev');
|
||||
};
|
||||
|
||||
Generated
+3624
-3378
File diff suppressed because it is too large
Load Diff
+19
-19
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@flasher/php-flasher",
|
||||
"type": "module",
|
||||
"version": "2.0.0",
|
||||
"version": "2.1.1",
|
||||
"license": "MIT",
|
||||
"workspaces": [
|
||||
"src/Prime/Resources",
|
||||
@@ -18,42 +18,42 @@
|
||||
"ncu": "ncu -u && npm run ncu --workspaces"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@antfu/eslint-config": "2.12.2",
|
||||
"@babel/core": "^7.25.2",
|
||||
"@babel/preset-env": "^7.25.4",
|
||||
"@antfu/eslint-config": "^2.27.3",
|
||||
"@babel/core": "^7.26.0",
|
||||
"@babel/preset-env": "^7.26.0",
|
||||
"@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.1",
|
||||
"@rollup/plugin-terser": "^0.4.4",
|
||||
"@rollup/plugin-typescript": "^11.1.6",
|
||||
"@types/node": "^20.16.5",
|
||||
"@typescript-eslint/eslint-plugin": "7.5.0",
|
||||
"@types/node": "^20.17.14",
|
||||
"@typescript-eslint/eslint-plugin": "^7.18.0",
|
||||
"@typescript-eslint/parser": "^7.18.0",
|
||||
"all-contributors-cli": "^6.26.1",
|
||||
"autoprefixer": "^10.4.20",
|
||||
"browserslist": "^4.23.3",
|
||||
"cross-env": "7.0.3",
|
||||
"browserslist": "^4.24.4",
|
||||
"cross-env": "^7.0.3",
|
||||
"cssnano": "^6.1.2",
|
||||
"eslint": "^8.57.1",
|
||||
"eslint-config-airbnb-typescript": "^18.0.0",
|
||||
"eslint-config-prettier": "^9.1.0",
|
||||
"eslint-import-resolver-typescript": "^3.6.3",
|
||||
"eslint-plugin-babel": "5.3.1",
|
||||
"eslint-plugin-import": "^2.30.0",
|
||||
"eslint-plugin-prettier": "^5.2.1",
|
||||
"eslint-import-resolver-typescript": "^3.7.0",
|
||||
"eslint-plugin-babel": "^5.3.1",
|
||||
"eslint-plugin-import": "^2.31.0",
|
||||
"eslint-plugin-prettier": "^5.2.2",
|
||||
"postcss-discard-comments": "^6.0.2",
|
||||
"punycode": "2.3.1",
|
||||
"rollup": "^4.22.4",
|
||||
"punycode": "^2.3.1",
|
||||
"rollup": "^4.30.1",
|
||||
"rollup-plugin-cleanup": "^3.2.1",
|
||||
"rollup-plugin-clear": "^2.0.7",
|
||||
"rollup-plugin-copy": "3.5.0",
|
||||
"rollup-plugin-copy": "^3.5.0",
|
||||
"rollup-plugin-filesize": "^10.0.0",
|
||||
"rollup-plugin-postcss": "^4.0.2",
|
||||
"rollup-plugin-progress": "^1.1.2",
|
||||
"sass": "^1.79.3",
|
||||
"sass": "^1.83.4",
|
||||
"ts-node": "^10.9.2",
|
||||
"tslib": "^2.7.0",
|
||||
"typescript": "^5.6.2"
|
||||
"tslib": "^2.8.1",
|
||||
"typescript": "^5.7.3"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
Please do not submit any Pull Requests here. They will be closed.
|
||||
---
|
||||
|
||||
Please submit your PR here instead:
|
||||
https://github.com/php-flasher/php-flasher
|
||||
|
||||
This repository is what we call a "subtree split": a read-only subset of that main repository.
|
||||
We're looking forward to your PR there!
|
||||
@@ -0,0 +1,20 @@
|
||||
name: Close Pull Request
|
||||
|
||||
on:
|
||||
pull_request_target:
|
||||
types: [opened]
|
||||
|
||||
jobs:
|
||||
run:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: superbrothers/close-pull-request@v3
|
||||
with:
|
||||
comment: |
|
||||
Thanks for your Pull Request! We love contributions.
|
||||
|
||||
However, you should instead open your PR on the main repository:
|
||||
https://github.com/php-flasher/php-flasher
|
||||
|
||||
This repository is what we call a "subtree split": a read-only subset of that main repository.
|
||||
We're looking forward to your PR there!
|
||||
@@ -35,9 +35,9 @@ use Flasher\Prime\Storage\Storage;
|
||||
use Flasher\Prime\Storage\StorageManager;
|
||||
use Illuminate\Container\Container;
|
||||
use Illuminate\Contracts\Events\Dispatcher;
|
||||
use Illuminate\Contracts\Http\Kernel as HttpKernel;
|
||||
use Illuminate\Foundation\Application;
|
||||
use Illuminate\Foundation\Console\AboutCommand;
|
||||
use Illuminate\Foundation\Http\Kernel as HttpKernel;
|
||||
use Illuminate\View\Compilers\BladeCompiler;
|
||||
use Laravel\Octane\Events\RequestReceived;
|
||||
use Livewire\LivewireManager;
|
||||
@@ -227,32 +227,18 @@ final class FlasherServiceProvider extends PluginServiceProvider
|
||||
}
|
||||
|
||||
$this->app->singleton(FlasherMiddleware::class, static function (Application $app) {
|
||||
$config = $app->make('config');
|
||||
|
||||
$flasher = $app->make('flasher');
|
||||
$cspHandler = $app->make('flasher.csp_handler');
|
||||
$excludedPaths = $config->get('flasher.excluded_paths', []) ?: [];
|
||||
|
||||
return new FlasherMiddleware(new ResponseExtension($flasher, $cspHandler));
|
||||
return new FlasherMiddleware(new ResponseExtension($flasher, $cspHandler, $excludedPaths));
|
||||
});
|
||||
|
||||
$this->pushMiddlewareToGroup(FlasherMiddleware::class);
|
||||
}
|
||||
|
||||
private function registerCspHandler(): void
|
||||
{
|
||||
$this->app->singleton('flasher.csp_handler', static function () {
|
||||
return new ContentSecurityPolicyHandler(new NonceGenerator());
|
||||
});
|
||||
}
|
||||
|
||||
private function registerAssetManager(): void
|
||||
{
|
||||
$this->app->singleton('flasher.asset_manager', static function () {
|
||||
$publicDir = public_path('/');
|
||||
$manifestPath = public_path('vendor'.\DIRECTORY_SEPARATOR.'flasher'.\DIRECTORY_SEPARATOR.'manifest.json');
|
||||
|
||||
return new AssetManager($publicDir, $manifestPath);
|
||||
});
|
||||
}
|
||||
|
||||
private function registerSessionMiddleware(): void
|
||||
{
|
||||
if (!$this->getConfig('flash_bag')) {
|
||||
@@ -278,6 +264,23 @@ final class FlasherServiceProvider extends PluginServiceProvider
|
||||
});
|
||||
}
|
||||
|
||||
private function registerCspHandler(): void
|
||||
{
|
||||
$this->app->singleton('flasher.csp_handler', static function () {
|
||||
return new ContentSecurityPolicyHandler(new NonceGenerator());
|
||||
});
|
||||
}
|
||||
|
||||
private function registerAssetManager(): void
|
||||
{
|
||||
$this->app->singleton('flasher.asset_manager', static function () {
|
||||
$publicDir = public_path('/');
|
||||
$manifestPath = public_path('vendor'.\DIRECTORY_SEPARATOR.'flasher'.\DIRECTORY_SEPARATOR.'manifest.json');
|
||||
|
||||
return new AssetManager($publicDir, $manifestPath);
|
||||
});
|
||||
}
|
||||
|
||||
private function registerBladeDirectives(BladeCompiler $blade): void
|
||||
{
|
||||
$blade->directive('flasher_render', function (string $expression = '') {
|
||||
|
||||
@@ -14,6 +14,11 @@ final readonly class Request implements RequestInterface
|
||||
{
|
||||
}
|
||||
|
||||
public function getUri(): string
|
||||
{
|
||||
return $this->request->getUri();
|
||||
}
|
||||
|
||||
public function isXmlHttpRequest(): bool
|
||||
{
|
||||
return $this->request->ajax();
|
||||
|
||||
@@ -13,6 +13,7 @@ namespace Illuminate\Contracts\Config;
|
||||
* scripts: string[],
|
||||
* styles: string[],
|
||||
* options: array<string, mixed>,
|
||||
* excluded_paths?: list<non-empty-string>,
|
||||
* filter: array<string, mixed>,
|
||||
* flash_bag: array<string, string[]>,
|
||||
* presets: array<string, PresetType>,
|
||||
@@ -44,7 +45,8 @@ interface Repository
|
||||
* ($key is 'flasher.presets' ? array<string, PresetType> :
|
||||
* ($key is 'flasher.plugins' ? array<string, PluginType> :
|
||||
* ($key is 'flasher.flash_bag' ? array<string, string[]> :
|
||||
* mixed)))))))
|
||||
* ($key is 'flasher.excluded_paths' ? list<non-empty-string> :
|
||||
* mixed))))))))
|
||||
*/
|
||||
public function get(string|array $key, mixed $default = null): mixed;
|
||||
}
|
||||
|
||||
+317
-52
@@ -6,107 +6,370 @@
|
||||
|
||||
<p align="center">
|
||||
<picture>
|
||||
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/php-flasher/art/main/php-flasher-github-dark.png">
|
||||
<img src="https://raw.githubusercontent.com/php-flasher/art/main/php-flasher-github.png" alt="PHPFlasher Logo">
|
||||
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/php-flasher/art/main/php-flasher-logo-dark.png">
|
||||
<img src="https://raw.githubusercontent.com/php-flasher/art/main/php-flasher-logo.png" alt="PHPFlasher Logo">
|
||||
</picture>
|
||||
</p>
|
||||
|
||||
# PHPFlasher for Laravel
|
||||
<p align="center">
|
||||
<a href="https://www.linkedin.com/in/younes--ennaji"><img src="https://img.shields.io/badge/author-@yoeunes-blue.svg" alt="Author Badge"></a>
|
||||
<a href="https://github.com/php-flasher/php-flasher"><img src="https://img.shields.io/badge/source-php--flasher/php--flasher-blue.svg" alt="Source Code Badge"></a>
|
||||
<a href="https://github.com/php-flasher/php-flasher/releases"><img src="https://img.shields.io/github/tag/php-flasher/flasher.svg" alt="GitHub Release Badge"></a>
|
||||
<a href="https://github.com/php-flasher/flasher/blob/master/LICENSE"><img src="https://img.shields.io/badge/license-MIT-brightgreen.svg" alt="License Badge"></a>
|
||||
<a href="https://packagist.org/packages/php-flasher/flasher"><img src="https://img.shields.io/packagist/dt/php-flasher/flasher.svg" alt="Packagist Downloads Badge"></a>
|
||||
<a href="https://github.com/php-flasher/php-flasher"><img src="https://img.shields.io/github/stars/php-flasher/php-flasher.svg" alt="GitHub Stars Badge"></a>
|
||||
<a href="https://packagist.org/packages/php-flasher/flasher"><img src="https://img.shields.io/packagist/php-v/php-flasher/flasher.svg" alt="Supported PHP Version Badge"></a>
|
||||
</p>
|
||||
|
||||
PHPFlasher provides a powerful and intuitive way to add flash notifications to your Laravel applications. With PHPFlasher, you can enhance user feedback efficiently and elegantly.
|
||||
## Table of Contents
|
||||
|
||||
## Official Documentation
|
||||
- [About PHPFlasher Laravel Adapter](#about-phpflasher-laravel-adapter)
|
||||
- [Features](#features)
|
||||
- [Supported Versions](#supported-versions)
|
||||
- [Installation](#installation)
|
||||
- [Core Package](#core-package)
|
||||
- [Adapters](#adapters)
|
||||
- [Configuration](#configuration)
|
||||
- [Configuration File](#configuration-file)
|
||||
- [Configuration Options](#configuration-options)
|
||||
- [Quick Start](#quick-start)
|
||||
- [Usage Examples](#usage-examples)
|
||||
- [Adapters Overview](#adapters-overview)
|
||||
- [Official Documentation](#official-documentation)
|
||||
- [Contributors and Sponsors](#contributors-and-sponsors)
|
||||
- [Contact](#contact)
|
||||
- [License](#license)
|
||||
|
||||
For more comprehensive documentation, please visit [PHPFlasher's Official Documentation](https://php-flasher.io).
|
||||
## About PHPFlasher Laravel Adapter
|
||||
|
||||
## Requirements
|
||||
**PHPFlasher Laravel Adapter** is an open-source package that seamlessly integrates PHPFlasher's powerful flash messaging capabilities into your **Laravel** applications. It simplifies the process of adding flash messages, providing an intuitive API to enhance user experience with minimal setup.
|
||||
|
||||
- **PHP** v8.2 or higher
|
||||
- **Laravel** v11.0 or higher
|
||||
With PHPFlasher Laravel Adapter, you can effortlessly display success, error, warning, and informational messages to your users, ensuring clear communication of application states and actions.
|
||||
|
||||
## Features
|
||||
|
||||
- **Seamless Laravel Integration**: Designed specifically for Laravel, ensuring compatibility and ease of use.
|
||||
- **Multiple Notification Libraries**: Supports various frontend libraries like Toastr, Noty, SweetAlert, and Notyf.
|
||||
- **Flexible Configuration**: Customize the appearance and behavior of flash messages to fit your application's needs.
|
||||
- **Intuitive API**: Simple methods to create and manage flash messages without boilerplate code.
|
||||
- **Extensible**: Easily add or create new adapters for different frontend libraries.
|
||||
|
||||
## Supported Versions
|
||||
|
||||
| PHPFlasher Laravel Adapter Version | PHP Version | Laravel Version |
|
||||
|------------------------------------|-------------|-----------------|
|
||||
| **v2.x** | ≥ 8.2 | ≥ 11 |
|
||||
| **v1.x** | ≥ 5.3 | ≥ 4.0 |
|
||||
|
||||
> **Note:** Ensure your project meets the PHP and Laravel version requirements for the PHPFlasher Laravel Adapter version you intend to use. For older PHP or Laravel versions, refer to [PHPFlasher v1.x](https://github.com/php-flasher/flasher-laravel/tree/1.x).
|
||||
|
||||
## Installation
|
||||
|
||||
To install PHPFlasher for Laravel, use Composer:
|
||||
### Core Package
|
||||
|
||||
Install the PHPFlasher Laravel Adapter via Composer:
|
||||
|
||||
```bash
|
||||
composer require php-flasher/flasher-laravel
|
||||
```
|
||||
|
||||
After installation, publish the assets using:
|
||||
After installation, set up the necessary assets:
|
||||
|
||||
```bash
|
||||
```shell
|
||||
php artisan flasher:install
|
||||
```
|
||||
|
||||
## Usage
|
||||
> **Note:** PHPFlasher automatically injects the necessary JavaScript and CSS assets into your Blade templates. No additional steps are required for asset injection.
|
||||
|
||||
Quickly integrate flash notifications in your Laravel project using the simple methods provided by PHPFlasher.
|
||||
### Adapters
|
||||
|
||||
- Display a success message.
|
||||
PHPFlasher provides various adapters for different notification libraries. Below is an overview of available adapters for Laravel:
|
||||
|
||||
```php
|
||||
flash()->success('Operation completed successfully.');
|
||||
- [flasher-toastr-laravel](https://github.com/php-flasher/flasher-toastr-laravel) - Laravel Adapter
|
||||
- [flasher-noty-laravel](https://github.com/php-flasher/flasher-noty-laravel) - Laravel Adapter
|
||||
- [flasher-notyf-laravel](https://github.com/php-flasher/flasher-notyf-laravel) - Laravel Adapter
|
||||
- [flasher-sweetalert-laravel](https://github.com/php-flasher/flasher-sweetalert-laravel) - Laravel Adapter
|
||||
|
||||
For detailed installation and usage instructions for each adapter, refer to their respective `README.md`.
|
||||
|
||||
## Configuration
|
||||
|
||||
After installing the PHPFlasher Laravel Adapter, you can configure it by publishing the configuration file or by modifying it directly.
|
||||
|
||||
### Configuration File
|
||||
|
||||
If you need to customize the default settings, publish the configuration file using the following command:
|
||||
|
||||
```bash
|
||||
php artisan flasher:install --config
|
||||
```
|
||||
|
||||
- Display an error message.
|
||||
This will create a file at `config/flasher.php` with the following content:
|
||||
|
||||
```php
|
||||
flash()->error('Oops, something went wrong.');
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Flasher\Prime\Configuration;
|
||||
|
||||
return Configuration::from([
|
||||
// Default notification library (e.g., 'flasher', 'toastr', 'noty', 'notyf', 'sweetalert')
|
||||
'default' => 'flasher',
|
||||
|
||||
// Path to the main PHPFlasher JavaScript file
|
||||
'main_script' => '/vendor/flasher/flasher.min.js',
|
||||
|
||||
// List of CSS files to style your notifications
|
||||
'styles' => [
|
||||
'/vendor/flasher/flasher.min.css',
|
||||
],
|
||||
|
||||
// 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 JavaScript and CSS assets into your HTML pages
|
||||
'inject_assets' => true,
|
||||
|
||||
// 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'],
|
||||
'warning' => ['warning', 'alarm'],
|
||||
'info' => ['info', 'notice', 'alert'],
|
||||
],
|
||||
|
||||
// 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',
|
||||
// ],
|
||||
// ],
|
||||
]);
|
||||
```
|
||||
|
||||
- Display a warning message.
|
||||
### Configuration Options
|
||||
|
||||
| **Option** | **Description** |
|
||||
|------------------|---------------------------------------------------------------------------------------------------------------------------|
|
||||
| `default` | **String**: The default notification library to use (e.g., `'flasher'`, `'toastr'`, `'noty'`, `'notyf'`, `'sweetalert'`). |
|
||||
| `main_script` | **String**: Path to the main PHPFlasher JavaScript file. |
|
||||
| `styles` | **Array**: List of CSS files to style your notifications. |
|
||||
| `options` | **Array** (Optional): Global options for all notifications (e.g., `'timeout'`, `'position'`). |
|
||||
| `inject_assets` | **Boolean**: Whether to automatically inject JavaScript and CSS assets into your HTML pages. |
|
||||
| `translate` | **Boolean**: Enable message translation using Laravel’s translation service. |
|
||||
| `excluded_paths` | **Array**: URL patterns to exclude from asset injection and flash_bag conversion. |
|
||||
| `flash_bag` | **Array**: Map Laravel flash message keys to notification types. |
|
||||
| `filter` | **Array** (Optional): Criteria to filter which notifications are displayed (e.g., `'limit'`). |
|
||||
| `presets` | **Array** (Optional): Define notification presets to simplify notification creation. |
|
||||
|
||||
## Quick Start
|
||||
|
||||
To display a notification message, you can either use the `flash()` helper function or obtain an instance of `flasher` from the service container. Then, before returning a view or redirecting, call the desired method (`success()`, `error()`, etc.) and pass in the message to be displayed.
|
||||
|
||||
### Using the `flash()` Helper
|
||||
|
||||
```php
|
||||
flash()->warning('Your account may have been compromised.');
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class BookController extends Controller
|
||||
{
|
||||
public function saveBook()
|
||||
{
|
||||
// Your logic here
|
||||
|
||||
flash('Your changes have been saved!');
|
||||
|
||||
return redirect()->back();
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
- Display an informational message.
|
||||
### Using the `flasher` Service
|
||||
|
||||
```php
|
||||
flash()->info('This may take some time. Do not refresh the page.');
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Flasher\Prime\FlasherInterface;
|
||||
|
||||
class AnotherController extends Controller
|
||||
{
|
||||
/**
|
||||
* If you prefer to use dependency injection
|
||||
*/
|
||||
public function register(FlasherInterface $flasher)
|
||||
{
|
||||
// Your logic here
|
||||
|
||||
$flasher->success('Your changes have been saved!');
|
||||
|
||||
// ... redirect or render the view
|
||||
}
|
||||
|
||||
public function update()
|
||||
{
|
||||
// Your logic here
|
||||
|
||||
app('flasher')->error('An error occurred while updating.');
|
||||
|
||||
return redirect()->back();
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
- Set multiple options at once.
|
||||
## Usage Examples
|
||||
|
||||
### Success Message
|
||||
|
||||
```php
|
||||
flash()
|
||||
->options(['timeout' => 5000, 'position' => 'top-right'])
|
||||
->success('Your profile has been updated.');
|
||||
flash()->success('Operation completed successfully!');
|
||||
```
|
||||
|
||||
- Set a single option.
|
||||
### Error Message
|
||||
|
||||
```php
|
||||
flash()
|
||||
->option('timer', 5000)
|
||||
->success('Your reservation has been confirmed.');
|
||||
flash()->error('An error occurred.');
|
||||
```
|
||||
|
||||
- Set the priority of the message.
|
||||
### Info Message
|
||||
|
||||
```php
|
||||
flash()
|
||||
->priority(1)
|
||||
->success('Your subscription has been activated.');
|
||||
flash()->info('This is an informational message.');
|
||||
```
|
||||
|
||||
- Set how many requests a message should persist through.
|
||||
### Warning Message
|
||||
|
||||
```php
|
||||
flash()
|
||||
->hops(2)
|
||||
->info('Your account has been created, but requires verification.');
|
||||
flash()->warning('This is a warning message.');
|
||||
```
|
||||
|
||||
- Translate a message into the specified language.
|
||||
### Passing Options
|
||||
|
||||
```php
|
||||
flash()
|
||||
->translate('ar')
|
||||
->success('Your message has been sent.');
|
||||
flash()->success('Custom message with options.', ['timeout' => 3000, 'position' => 'bottom-left']);
|
||||
```
|
||||
|
||||
## Contributors
|
||||
### Using presets
|
||||
|
||||
Define a preset in your `config/flasher.php`:
|
||||
|
||||
```php
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Flasher\Prime\Configuration;
|
||||
|
||||
return Configuration::from([
|
||||
// ... other configurations
|
||||
|
||||
'presets' => [
|
||||
'entity_saved' => [
|
||||
'type' => 'success',
|
||||
'title' => 'Entity Saved',
|
||||
'message' => 'The entity has been saved successfully.',
|
||||
],
|
||||
'entity_deleted' => [
|
||||
'type' => 'warning',
|
||||
'title' => 'Entity Deleted',
|
||||
'message' => 'The entity has been deleted.',
|
||||
],
|
||||
],
|
||||
]);
|
||||
```
|
||||
|
||||
Use the preset in your controller:
|
||||
|
||||
```php
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use App\Http\Controllers\Controller;
|
||||
|
||||
class BookController extends Controller
|
||||
{
|
||||
/**
|
||||
* Save a new book entity.
|
||||
*
|
||||
* @return RedirectResponse
|
||||
*/
|
||||
public function saveBook(): RedirectResponse
|
||||
{
|
||||
// Your saving logic here (e.g., validating and storing the book)
|
||||
|
||||
// Trigger the 'entity_saved' preset
|
||||
flash()->preset('entity_saved');
|
||||
|
||||
return redirect()->route('books.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete an existing book entity.
|
||||
*
|
||||
* @return RedirectResponse
|
||||
*/
|
||||
public function deleteBook(): RedirectResponse
|
||||
{
|
||||
// Your deletion logic here (e.g., finding and deleting the book)
|
||||
|
||||
// Trigger the 'entity_deleted' preset
|
||||
flash()->preset('entity_deleted');
|
||||
|
||||
return redirect()->route('books.index');
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Adapters Overview
|
||||
|
||||
PHPFlasher supports various adapters to integrate seamlessly with different frontend libraries. Below is an overview of available adapters for Laravel:
|
||||
|
||||
| Adapter Repository | Description |
|
||||
|-----------------------------------------------------------------------------------------|--------------------------------|
|
||||
| [flasher-laravel](https://github.com/php-flasher/flasher-laravel) | Laravel framework adapter |
|
||||
| [flasher-toastr-laravel](https://github.com/php-flasher/flasher-toastr-laravel) | Toastr adapter for Laravel |
|
||||
| [flasher-noty-laravel](https://github.com/php-flasher/flasher-noty-laravel) | Noty adapter for Laravel |
|
||||
| [flasher-notyf-laravel](https://github.com/php-flasher/flasher-notyf-laravel) | Notyf adapter for Laravel |
|
||||
| [flasher-sweetalert-laravel](https://github.com/php-flasher/flasher-sweetalert-laravel) | SweetAlert adapter for Laravel |
|
||||
|
||||
> **Note:** Each adapter has its own repository. For detailed installation and usage instructions, please refer to the [Official Documentation](https://php-flasher.io).
|
||||
|
||||
## Official Documentation
|
||||
|
||||
Comprehensive documentation for PHPFlasher is available at [https://php-flasher.io](https://php-flasher.io). Here you will find detailed guides, API references, and advanced usage examples to help you get the most out of PHPFlasher.
|
||||
|
||||
## Contributors and sponsors
|
||||
|
||||
Join our team of contributors and make a lasting impact on our project!
|
||||
|
||||
We are always looking for passionate individuals who want to contribute their skills and ideas.
|
||||
Whether you're a developer, designer, or simply have a great idea, we welcome your participation and collaboration.
|
||||
|
||||
Shining stars of our community:
|
||||
|
||||
<!-- ALL-CONTRIBUTORS-LIST:START -->
|
||||
<!-- prettier-ignore-start -->
|
||||
@@ -114,7 +377,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>
|
||||
@@ -124,7 +387,7 @@ flash()
|
||||
</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>
|
||||
@@ -136,15 +399,17 @@ flash()
|
||||
|
||||
## Contact
|
||||
|
||||
For support, feature requests, or contributions, reach out via:
|
||||
PHPFlasher is being actively developed by <a href="https://github.com/yoeunes">yoeunes</a>.
|
||||
You can reach out with questions, bug reports, or feature requests on any of the following:
|
||||
|
||||
- [GitHub Issues](https://github.com/php-flasher/php-flasher/issues)
|
||||
- [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](mailto:younes.ennaji.pro@gmail.com)
|
||||
- [Linkedin](https://www.linkedin.com/in/younes--ennaji/)
|
||||
- [Email me directly](mailto:younes.ennaji.pro@gmail.com)
|
||||
|
||||
## License
|
||||
|
||||
PHPFlasher is licensed under the [MIT license](https://opensource.org/licenses/MIT).
|
||||
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>
|
||||
|
||||
@@ -2,34 +2,36 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Flasher\Laravel\Resources;
|
||||
use Flasher\Prime\Configuration;
|
||||
|
||||
return [
|
||||
// Default notification library (e.g., 'flasher', 'toastr', 'noty', etc.)
|
||||
return Configuration::from([
|
||||
// Default notification library (e.g., 'flasher', 'toastr', 'noty', 'notyf', 'sweetalert')
|
||||
'default' => 'flasher',
|
||||
|
||||
// Path to the main JavaScript file of PHPFlasher
|
||||
// Path to the main PHPFlasher JavaScript file
|
||||
'main_script' => '/vendor/flasher/flasher.min.js',
|
||||
|
||||
// Path to the stylesheets for PHPFlasher notifications
|
||||
// List of CSS files to style your notifications
|
||||
'styles' => [
|
||||
'/vendor/flasher/flasher.min.css',
|
||||
],
|
||||
|
||||
// Whether to translate PHPFlasher messages using Laravel's translation service
|
||||
'translate' => true,
|
||||
// Set global options for all notifications (optional)
|
||||
// 'options' => [
|
||||
// 'timeout' => 5000, // Time in milliseconds before the notification disappears
|
||||
// 'position' => 'top-right', // Where the notification appears on the screen
|
||||
// ],
|
||||
|
||||
// Automatically inject PHPFlasher assets into HTML response
|
||||
// Automatically inject JavaScript and CSS assets into your HTML pages
|
||||
'inject_assets' => true,
|
||||
|
||||
// Global options
|
||||
'options' => [
|
||||
'timeout' => 5000, // in milliseconds
|
||||
'position' => 'top-right',
|
||||
],
|
||||
// Enable message translation using Laravel's translation service
|
||||
'translate' => true,
|
||||
|
||||
// Configuration for the flash bag (converting Laravel flash messages)
|
||||
// Map Laravel session keys to PHPFlasher types
|
||||
// URL patterns to exclude from asset injection and flash_bag conversion
|
||||
'excluded_paths' => [],
|
||||
|
||||
// Map Laravel flash message keys to notification types
|
||||
'flash_bag' => [
|
||||
'success' => ['success'],
|
||||
'error' => ['error', 'danger'],
|
||||
@@ -37,8 +39,17 @@ return [
|
||||
'info' => ['info', 'notice', 'alert'],
|
||||
],
|
||||
|
||||
// Filter criteria for notifications (e.g., limit number, types)
|
||||
'filter' => [
|
||||
'limit' => 5, // Limit the number of displayed notifications
|
||||
],
|
||||
];
|
||||
// Set criteria to filter which notifications are displayed (optional)
|
||||
// 'filter' => [
|
||||
// 'limit' => 5, // Maximum number of notifications to show at once
|
||||
// ],
|
||||
|
||||
// Define notification presets to simplify notification creation (optional)
|
||||
// 'presets' => [
|
||||
// 'entity_saved' => [
|
||||
// 'type' => 'success',
|
||||
// 'title' => 'Entity saved',
|
||||
// 'message' => 'Entity saved successfully',
|
||||
// ],
|
||||
// ],
|
||||
]);
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
"require": {
|
||||
"php": ">=8.2",
|
||||
"illuminate/support": "^11.0",
|
||||
"php-flasher/flasher": "^2.0.1"
|
||||
"php-flasher/flasher": "^2.1.2"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
Please do not submit any Pull Requests here. They will be closed.
|
||||
---
|
||||
|
||||
Please submit your PR here instead:
|
||||
https://github.com/php-flasher/php-flasher
|
||||
|
||||
This repository is what we call a "subtree split": a read-only subset of that main repository.
|
||||
We're looking forward to your PR there!
|
||||
@@ -0,0 +1,20 @@
|
||||
name: Close Pull Request
|
||||
|
||||
on:
|
||||
pull_request_target:
|
||||
types: [opened]
|
||||
|
||||
jobs:
|
||||
run:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: superbrothers/close-pull-request@v3
|
||||
with:
|
||||
comment: |
|
||||
Thanks for your Pull Request! We love contributions.
|
||||
|
||||
However, you should instead open your PR on the main repository:
|
||||
https://github.com/php-flasher/php-flasher
|
||||
|
||||
This repository is what we call a "subtree split": a read-only subset of that main repository.
|
||||
We're looking forward to your PR there!
|
||||
@@ -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.2",
|
||||
"php-flasher/flasher-noty": "^2.1.2"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
Please do not submit any Pull Requests here. They will be closed.
|
||||
---
|
||||
|
||||
Please submit your PR here instead:
|
||||
https://github.com/php-flasher/php-flasher
|
||||
|
||||
This repository is what we call a "subtree split": a read-only subset of that main repository.
|
||||
We're looking forward to your PR there!
|
||||
@@ -0,0 +1,20 @@
|
||||
name: Close Pull Request
|
||||
|
||||
on:
|
||||
pull_request_target:
|
||||
types: [opened]
|
||||
|
||||
jobs:
|
||||
run:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: superbrothers/close-pull-request@v3
|
||||
with:
|
||||
comment: |
|
||||
Thanks for your Pull Request! We love contributions.
|
||||
|
||||
However, you should instead open your PR on the main repository:
|
||||
https://github.com/php-flasher/php-flasher
|
||||
|
||||
This repository is what we call a "subtree split": a read-only subset of that main repository.
|
||||
We're looking forward to your PR there!
|
||||
+130
-13
@@ -4,10 +4,110 @@ declare(strict_types=1);
|
||||
|
||||
namespace Flasher\Noty\Prime;
|
||||
|
||||
use Flasher\Prime\Notification\Envelope;
|
||||
use Flasher\Prime\Notification\NotificationBuilder;
|
||||
|
||||
/**
|
||||
* @phpstan-type NotificationType "success"|"info"|"warning"|"error"|"alert"|"information"
|
||||
* @phpstan-type OptionsType array{
|
||||
* layout?: "top"|"topLeft"|"topCenter"|"topRight"|"center"|"centerLeft"|"centerRight"|"bottom"|"bottomLeft"|"bottomCenter"|"bottomRight",
|
||||
* theme?: "relax"|"mint"|"metroui",
|
||||
* timeout?: false|int,
|
||||
* progressBar?: bool,
|
||||
* closeWith?: string[],
|
||||
* animation?: array{
|
||||
* open?: string|null,
|
||||
* close?: string|null,
|
||||
* },
|
||||
* sounds?: array{
|
||||
* sources?: string[],
|
||||
* volume?: int,
|
||||
* conditions?: string[],
|
||||
* },
|
||||
* docTitle?: array{
|
||||
* conditions?: string[],
|
||||
* },
|
||||
* modal?: bool,
|
||||
* id?: bool|string,
|
||||
* force?: bool,
|
||||
* queue?: string,
|
||||
* killer?: bool|string,
|
||||
* container?: false|string,
|
||||
* buttons?: string[],
|
||||
* visibilityControl?: bool,
|
||||
* }
|
||||
*/
|
||||
final class NotyBuilder extends NotificationBuilder
|
||||
{
|
||||
/**
|
||||
* @phpstan-param NotificationType $type
|
||||
*/
|
||||
public function type(string $type): static
|
||||
{
|
||||
return parent::type($type);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param OptionsType $options
|
||||
*/
|
||||
public function success(string $message, array $options = [], ?string $title = null): Envelope
|
||||
{
|
||||
return parent::success($message, $options, $title);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param OptionsType $options
|
||||
*/
|
||||
public function error(string $message, array $options = [], ?string $title = null): Envelope
|
||||
{
|
||||
return parent::error($message, $options, $title);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param OptionsType $options
|
||||
*/
|
||||
public function info(string $message, array $options = [], ?string $title = null): Envelope
|
||||
{
|
||||
return parent::info($message, $options, $title);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param OptionsType $options
|
||||
*/
|
||||
public function warning(string $message, array $options = [], ?string $title = null): Envelope
|
||||
{
|
||||
return parent::warning($message, $options, $title);
|
||||
}
|
||||
|
||||
/**
|
||||
* @phpstan-param NotificationType $type
|
||||
* @phpstan-param OptionsType $options
|
||||
*/
|
||||
public function flash(?string $type = null, ?string $message = null, array $options = [], ?string $title = null): Envelope
|
||||
{
|
||||
return parent::flash($type, $message, $options, $title);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param OptionsType $options
|
||||
*/
|
||||
public function options(array $options, bool $append = true): static
|
||||
{
|
||||
return parent::options($options, $append);
|
||||
}
|
||||
|
||||
/**
|
||||
* @template T of OptionsType
|
||||
* @template K of key-of<T>
|
||||
*
|
||||
* @phpstan-param K $name
|
||||
* @phpstan-param T[K] $value
|
||||
*/
|
||||
public function option(string $name, mixed $value): static
|
||||
{
|
||||
return parent::option($name, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* This string can contain HTML too. But be careful and don't pass user inputs to this parameter.
|
||||
*/
|
||||
@@ -17,7 +117,7 @@ final class NotyBuilder extends NotificationBuilder
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<string, mixed> $options
|
||||
* @param OptionsType $options
|
||||
*/
|
||||
public function alert(?string $message = null, ?string $title = null, array $options = []): self
|
||||
{
|
||||
@@ -39,7 +139,7 @@ final class NotyBuilder extends NotificationBuilder
|
||||
}
|
||||
|
||||
/**
|
||||
* @param "top"|"topLeft"|"topCenter"|"topRight"|"center"|"centerLeft"|"centerRight"|"bottom"|"bottomLeft"|"bottomCenter"|"bottomRight" $layout
|
||||
* @phpstan-param OptionsType['layout'] $layout
|
||||
*
|
||||
* - ClassName generator uses this value → noty_layout__${layout}
|
||||
*/
|
||||
@@ -51,7 +151,7 @@ final class NotyBuilder extends NotificationBuilder
|
||||
}
|
||||
|
||||
/**
|
||||
* @param "relax"|"mint"|"metroui" $theme
|
||||
* @phpstan-param OptionsType['theme'] $theme
|
||||
*
|
||||
* ClassName generator uses this value → noty_theme__${theme}
|
||||
*/
|
||||
@@ -65,7 +165,7 @@ final class NotyBuilder extends NotificationBuilder
|
||||
/**
|
||||
* false, 1000, 3000, 3500, etc. Delay for closing event in milliseconds (ms). Set 'false' for sticky notifications.
|
||||
*/
|
||||
public function timeout(bool|int $timeout): self
|
||||
public function timeout(false|int $timeout): self
|
||||
{
|
||||
$this->option('timeout', $timeout);
|
||||
|
||||
@@ -95,35 +195,52 @@ final class NotyBuilder extends NotificationBuilder
|
||||
}
|
||||
|
||||
/**
|
||||
* @param "open"|"close" $animation
|
||||
* @param "open"|"close" $option
|
||||
* @param "noty_effects_open"|"noty_effects_close"|string $effect
|
||||
*
|
||||
* If string, assumed to be CSS class name. If null, no animation at all. If function, runs the function. (v3.0.1+)
|
||||
* You can use animate.css class names or your custom css animations as well.
|
||||
*/
|
||||
public function animation(string $animation, string $effect): self
|
||||
public function animation(string $option, string $effect): self
|
||||
{
|
||||
$this->option('animation.'.$animation, $effect);
|
||||
/** @phpstan-var OptionsType['animation'] $animation */
|
||||
$animation = $this->getEnvelope()->getOption('animation', []);
|
||||
$animation[$option] = $effect;
|
||||
|
||||
$this->option('animation', $animation);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param "sources"|"volume"|"conditions" $option
|
||||
* @phpstan-param "sources"|"volume"|"conditions" $option
|
||||
* @phpstan-param ($option is "sources" ? string[] :
|
||||
* ($option is "volume" ? int :
|
||||
* ($option is "conditions" ? string[] :
|
||||
* mixed))) $value
|
||||
*/
|
||||
public function sounds(string $option, mixed $value): self
|
||||
{
|
||||
$this->option('sounds.'.$option, $value);
|
||||
/** @phpstan-var OptionsType['sounds'] $sounds */
|
||||
$sounds = $this->getEnvelope()->getOption('sounds', []);
|
||||
$sounds[$option] = $value;
|
||||
|
||||
$this->option('sounds', $sounds); // @phpstan-ignore-line
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param "conditions"|string $option
|
||||
* @phpstan-param "conditions"|string $option
|
||||
* @phpstan-param ($option is "conditions" ? string[] : mixed) $value
|
||||
*/
|
||||
public function docTitle(string $option, string $docTitle): self
|
||||
public function docTitle(string $option, mixed $value): self
|
||||
{
|
||||
$this->option('docTitle'.$option, $docTitle);
|
||||
/** @phpstan-var OptionsType['docTitle'] $docTitle */
|
||||
$docTitle = $this->getEnvelope()->getOption('docTitle', []);
|
||||
$docTitle[$option] = $value;
|
||||
|
||||
$this->option('docTitle', $docTitle); // @phpstan-ignore-line
|
||||
|
||||
return $this;
|
||||
}
|
||||
@@ -176,7 +293,7 @@ final class NotyBuilder extends NotificationBuilder
|
||||
/**
|
||||
* Custom container selector string. Like '.my-custom-container'. Layout parameter will be ignored.
|
||||
*/
|
||||
public function container(bool|string $container): self
|
||||
public function container(false|string $container): self
|
||||
{
|
||||
$this->option('container', $container);
|
||||
|
||||
|
||||
+1
-1
@@ -52,7 +52,7 @@ class NotyPlugin extends AbstractPlugin {
|
||||
const options = Object.assign({ text: envelope.message, type: envelope.type }, envelope.options);
|
||||
const noty = new Noty(options);
|
||||
noty.show();
|
||||
(_a = noty.layoutDom) === null || _a === void 0 ? void 0 : _a.dataset.turboTemporary = '';
|
||||
(_a = noty.layoutDom) === null || _a === undefined ? undefined : _a.dataset.turboTemporary = '';
|
||||
});
|
||||
}
|
||||
renderOptions(options) {
|
||||
|
||||
+1
-1
@@ -55,7 +55,7 @@
|
||||
const options = Object.assign({ text: envelope.message, type: envelope.type }, envelope.options);
|
||||
const noty = new Noty(options);
|
||||
noty.show();
|
||||
(_a = noty.layoutDom) === null || _a === void 0 ? void 0 : _a.dataset.turboTemporary = '';
|
||||
(_a = noty.layoutDom) === null || _a === undefined ? undefined : _a.dataset.turboTemporary = '';
|
||||
});
|
||||
}
|
||||
renderOptions(options) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@flasher/flasher-noty",
|
||||
"version": "2.0.0",
|
||||
"version": "2.1.1",
|
||||
"type": "module",
|
||||
"license": "MIT",
|
||||
"main": "dist/flasher-noty.cjs.js",
|
||||
@@ -11,7 +11,7 @@
|
||||
"ncu": "ncu -u"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@flasher/flasher": "^2.0.0",
|
||||
"@flasher/flasher": "^2.1.1",
|
||||
"noty": "^3.2.0-beta-deprecated"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
"prefer-stable": true,
|
||||
"require": {
|
||||
"php": ">=8.2",
|
||||
"php-flasher/flasher": "^2.0.1"
|
||||
"php-flasher/flasher": "^2.1.2"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
|
||||
@@ -16,10 +16,36 @@ if (!\function_exists('Flasher\Noty\Prime\noty')) {
|
||||
* When called with no arguments, it returns an instance of NotyInterface.
|
||||
* When called with arguments, it creates a Noty notification and returns an Envelope.
|
||||
*
|
||||
* @param string|null $message the message content of the notification
|
||||
* @param string $type The type of the notification (e.g., success, error, warning, info).
|
||||
* @param array<string, mixed> $options additional options for the Noty notification
|
||||
* @param string|null $title the title of the notification
|
||||
* @param string|null $message the message content of the notification
|
||||
* @param "success"|"info"|"warning"|"error"|"alert"|"information" $type The type of the notification (e.g., success, error, warning, info).
|
||||
* @param array{
|
||||
* layout?: "top"|"topLeft"|"topCenter"|"topRight"|"center"|"centerLeft"|"centerRight"|"bottom"|"bottomLeft"|"bottomCenter"|"bottomRight",
|
||||
* theme?: "relax"|"mint"|"metroui",
|
||||
* timeout?: false|int,
|
||||
* progressBar?: bool,
|
||||
* closeWith?: string[],
|
||||
* animation?: array{
|
||||
* open?: string|null,
|
||||
* close?: string|null,
|
||||
* },
|
||||
* sounds?: array{
|
||||
* sources?: string[],
|
||||
* volume?: int,
|
||||
* conditions?: string[],
|
||||
* },
|
||||
* docTitle?: array{
|
||||
* conditions?: string[],
|
||||
* },
|
||||
* modal?: bool,
|
||||
* id?: bool|string,
|
||||
* force?: bool,
|
||||
* queue?: string,
|
||||
* killer?: bool|string,
|
||||
* container?: false|string,
|
||||
* buttons?: string[],
|
||||
* visibilityControl?: bool,
|
||||
* } $options additional options for the Noty notification
|
||||
* @param string|null $title the title of the notification
|
||||
*
|
||||
* @return Envelope|NotyInterface Returns an Envelope containing the notification details when arguments are provided.
|
||||
* Returns an instance of NotyInterface when no arguments are provided.
|
||||
|
||||
@@ -15,10 +15,36 @@ if (!function_exists('noty')) {
|
||||
* When called with no arguments, it returns an instance of NotyInterface.
|
||||
* When called with arguments, it creates a Noty notification and returns an Envelope.
|
||||
*
|
||||
* @param string|null $message the message content of the notification
|
||||
* @param string $type The type of the notification (e.g., success, error, warning, info).
|
||||
* @param array<string, mixed> $options additional options for the Noty notification
|
||||
* @param string|null $title the title of the notification
|
||||
* @param string|null $message the message content of the notification
|
||||
* @param "success"|"info"|"warning"|"error"|"alert"|"information" $type The type of the notification (e.g., success, error, warning, info).
|
||||
* @param array{
|
||||
* layout?: "top"|"topLeft"|"topCenter"|"topRight"|"center"|"centerLeft"|"centerRight"|"bottom"|"bottomLeft"|"bottomCenter"|"bottomRight",
|
||||
* theme?: "relax"|"mint"|"metroui",
|
||||
* timeout?: false|int,
|
||||
* progressBar?: bool,
|
||||
* closeWith?: string[],
|
||||
* animation?: array{
|
||||
* open?: string|null,
|
||||
* close?: string|null,
|
||||
* },
|
||||
* sounds?: array{
|
||||
* sources?: string[],
|
||||
* volume?: int,
|
||||
* conditions?: string[],
|
||||
* },
|
||||
* docTitle?: array{
|
||||
* conditions?: string[],
|
||||
* },
|
||||
* modal?: bool,
|
||||
* id?: bool|string,
|
||||
* force?: bool,
|
||||
* queue?: string,
|
||||
* killer?: bool|string,
|
||||
* container?: false|string,
|
||||
* buttons?: string[],
|
||||
* visibilityControl?: bool,
|
||||
* } $options additional options for the Noty notification
|
||||
* @param string|null $title the title of the notification
|
||||
*
|
||||
* @return Envelope|NotyInterface Returns an Envelope containing the notification details when arguments are provided.
|
||||
* Returns an instance of NotyInterface when no arguments are provided.
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
Please do not submit any Pull Requests here. They will be closed.
|
||||
---
|
||||
|
||||
Please submit your PR here instead:
|
||||
https://github.com/php-flasher/php-flasher
|
||||
|
||||
This repository is what we call a "subtree split": a read-only subset of that main repository.
|
||||
We're looking forward to your PR there!
|
||||
@@ -0,0 +1,20 @@
|
||||
name: Close Pull Request
|
||||
|
||||
on:
|
||||
pull_request_target:
|
||||
types: [opened]
|
||||
|
||||
jobs:
|
||||
run:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: superbrothers/close-pull-request@v3
|
||||
with:
|
||||
comment: |
|
||||
Thanks for your Pull Request! We love contributions.
|
||||
|
||||
However, you should instead open your PR on the main repository:
|
||||
https://github.com/php-flasher/php-flasher
|
||||
|
||||
This repository is what we call a "subtree split": a read-only subset of that main repository.
|
||||
We're looking forward to your PR there!
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user