Compare commits

..

20 Commits

Author SHA1 Message Date
Khoubza Younes 23d828c6f2 feat: update all README.md files 2023-01-21 16:16:28 +01:00
Khoubza Younes 419cca27ca add auto_closer.yaml file 2023-01-15 16:34:34 +01:00
Khoubza Younes b74f36b824 update composer files 2023-01-15 16:15:56 +01:00
Khoubza Younes fc4dbd5a1d update composer files description 2023-01-14 20:30:56 +01:00
Khoubza Younes de1556435a remove packs auto_closer github workflows 2023-01-14 20:16:06 +01:00
Khoubza Younes 6cf3101dec normalize packs composer files 2023-01-14 20:15:50 +01:00
Khoubza Younes aba8f328f0 format Ash Allen book and blog section 2023-01-13 16:40:46 +01:00
Khoubza Younes 5d31249b4c add Ash Allen blog 2023-01-13 16:39:19 +01:00
Khoubza Younes edfc554c21 add Lucas Maciel to the list of contributors 2023-01-13 14:50:51 +01:00
Khoubza Younes 33220ce041 add Mr. Nashwan youtube channel and Ash Allen Battle Ready Laravel book 2023-01-13 14:31:32 +01:00
Khoubza Younes 056dc821c2 update GitHub Community Health Files 2023-01-13 06:06:50 +01:00
Khoubza Younes 27c7b2e79a use a simple README.md on all repositories 2023-01-11 04:53:34 +01:00
Khoubza Younes 14ccfc56c7 update composer.json keywords 2023-01-11 04:44:50 +01:00
Khoubza Younes 91ba09fd39 fix: add more entries to FUNDING.yml 2022-12-25 20:25:25 +01:00
KHOUBZA Younes 5af384ecc2 update README 2022-11-06 12:33:41 +01:00
KHOUBZA Younes 351b9c5ac3 use PHPFlasher instead of PHP Flasher 2022-10-29 18:51:51 +01:00
KHOUBZA Younes 5bc76179ce update laravel and php packs readme 2022-09-25 17:40:54 +01:00
KHOUBZA Younes d3a6280f56 update github sponsor button 2022-07-31 16:13:01 +01:00
KHOUBZA Younes abbf475553 Prepare v1.0 release
rename template adapter to flasher, and add title to base notification class

Wip
2022-05-16 08:18:15 +01:00
Khoubza Younes 15f2b9a71e groups packages into packs 2022-03-09 09:21:16 +01:00
449 changed files with 112 additions and 18806 deletions
-13
View File
@@ -1,13 +0,0 @@
# Path-based git attributes
# https://www.kernel.org/pub/software/scm/git/docs/gitattributes.html
# Ignore all test and documentation with "export-ignore".
/.gitattributes export-ignore
/.gitignore export-ignore
/.travis.yml export-ignore
/phpunit.xml.dist export-ignore
/.scrutinizer.yml export-ignore
/.styleci.yml export-ignore
/tests export-ignore
/.editorconfig export-ignore
+2 -3
View File
@@ -1,6 +1,5 @@
# These are supported funding model platforms
github: yoeunes
patreon: yoeunes
ko_fi: yoeunes
open_collective: php-flasher
custom: ['https://www.paypal.com/paypalme/yoeunes']
custom: https://www.paypal.com/paypalme/yoeunes
-38
View File
@@ -1,38 +0,0 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''
---
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
**Expected behavior**
A clear and concise description of what you expected to happen.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]
**Smartphone (please complete the following information):**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]
**Additional context**
Add any other context about the problem here.
-20
View File
@@ -1,20 +0,0 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''
---
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context or screenshots about the feature request here.
-7
View File
@@ -1,7 +0,0 @@
version: 2
updates:
- package-ecosystem: composer
directory: "/"
schedule:
interval: daily
open-pull-requests-limit: 10
+22
View File
@@ -0,0 +1,22 @@
name: Auto Closer PR
on:
pull_request_target:
types: [opened]
jobs:
run:
runs-on: ubuntu-latest
steps:
- uses: superbrothers/close-pull-request@v3
with:
comment: |
Hi, thank you for your contribution.
Unfortunately, this repository is read-only. It's a split from our main monorepo repository.
We'd like to kindly ask you to move the contribution there - https://github.com/php-flasher/php-flasher.
We'll check it, review it and give you feed back right way.
Thank you.
-36
View File
@@ -1,36 +0,0 @@
name: PHP Composer
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Validate composer.json and composer.lock
run: composer validate --strict
- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v2
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-
- name: Install dependencies
run: composer install --prefer-dist --no-progress
# Add a test script to composer.json, for instance: "test": "vendor/bin/phpunit"
# Docs: https://getcomposer.org/doc/articles/scripts.md
# - name: Run test suite
# run: composer run-script test
-5
View File
@@ -1,5 +0,0 @@
.idea
vendor
composer.lock
.phpunit.result.cache
.phpcs-cache
-76
View File
@@ -1,76 +0,0 @@
# Contributor Covenant Code of Conduct
## Our Pledge
In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, sex characteristics, gender identity and expression,
level of experience, education, socio-economic status, nationality, personal
appearance, race, religion, or sexual identity and orientation.
## Our Standards
Examples of behavior that contributes to creating a positive environment
include:
* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
## Our Responsibilities
Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.
Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.
## Scope
This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at younes.khoubza@gmail.com. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.
Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
[homepage]: https://www.contributor-covenant.org
For answers to common questions about this code of conduct, see
https://www.contributor-covenant.org/faq
-14
View File
@@ -1,14 +0,0 @@
# Contributing
Contributions are **welcome** and will be fully **credited**. We accept contributions via Pull Requests on [Github](https://github.com/php-flasher/php-flasher).
## Pull Requests
- **[PSR-2 Coding Standard.](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md)** The easiest way to apply the conventions is to install [PHP CS Fixer](https://github.com/FriendsOfPHP/PHP-CS-Fixer).
- **Add tests!** Your patch won't be accepted if it doesn't have tests.
- **Document any change in behaviour.** Make sure the `README.md` and any other relevant documentation are kept up-to-date.
- **Consider our release cycle.** We try to follow [SemVer v2.0.0](http://semver.org/). Randomly breaking public APIs is not an option.
- **Create feature branches.** Don't ask us to pull from your master branch.
- **One pull request per feature.** If you want to do more than one thing, send multiple pull requests.
- **Send coherent history.** Make sure each individual commit in your pull request is meaningful. If you had to make multiple intermediate commits while developing, please [squash them](http://www.git-scm.com/book/en/v2/Git-Tools-Rewriting-History#Changing-Multiple-Commit-Messages) before submitting.
+1 -1
View File
@@ -1,6 +1,6 @@
MIT License
Copyright (c) 2020 PHP Flasher
Copyright (c) 2020 PHPFlasher
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
+47 -61
View File
@@ -1,80 +1,66 @@
<p align="center"><img width="600" alt="flasher" src="https://user-images.githubusercontent.com/10859693/102468596-03317180-4052-11eb-9df3-44dc6235b238.png"></p>
<h1 align="center">A powerful and flexible flash notifications system for PHP, Laravel, Symfony</h1>
<p align="center">
:eyes: PHP Flasher helps you to add flash notifications to your PHP projects.
This library was developed with the idea that you should be able to add flash notification to your application with ease and with few lines of code.
No application-wide rewrites and no big investments upfront.
<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">
</picture>
</p>
<p align="center">
<a href="https://github.com/php-flasher/flasher">
<img src="https://img.shields.io/badge/source-php--flasher/flasher-blue.svg?style=flat-square">
</a>
<a href="https://github.com/php-flasher/flasher/releases">
<img src="https://img.shields.io/github/tag/php-flasher/flasher.svg">
</a>
<a href="https://github.com/php-flasher/flasher/blob/master/LICENSE">
<img src="https://img.shields.io/badge/license-MIT-brightgreen.svg">
</a>
<a href="https://packagist.org/packages/php-flasher/flasher">
<img src="https://img.shields.io/packagist/dt/php-flasher/flasher.svg">
</a>
<a href="https://packagist.org/packages/php-flasher/flasher">
<img src="https://img.shields.io/packagist/php-v/php-flasher/flasher.svg?style=flat-square">
</a>
<a href="https://opencollective.com/php-flasher">
<img src="https://opencollective.com/php-flasher/tiers/backer/badge.svg?label=backer&color=brightgreen" />
</a>
<a href="https://opencollective.com/php-flasher">
<img src="https://opencollective.com/php-flasher/tiers/sponsor/badge.svg?label=sponsor&color=brightgreen" />
</a>
</p>
## About PHPFlasher
# Why use PHP Flasher ?
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.
The PHP Flasher project supports many notification libraries : __tailwindcss__, __bootstrap__, __toastr.js__, __sweet alert 2__, __pnotify__, __noty__, and __notyf__
and its highly extendable so you can add your custom notifications.
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.
This library is designed, so you can take full control when creating you notifications :
> * Display multiple notifications
> * Sort and filter notifications
> * Render notification from JSON object
> * Limit the number of displayed notifications
> * Show notifications from different libraries at the same time
> * Framework angostic with integration for : Symfony and Laravel
> * Support templates
> * Easy migration from similar libraries.
> * Very flexible so you can add you own adapters
> * ...and more
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.
## Official Documentation
Documentation for PHP Flasher can be found on the [PHP Flasher website](https://php-flasher.github.io/).
Documentation for PHPFlasher can be found on the [https://php-flasher.io](https://php-flasher.io).
## Backers && Sponsors
## Contributors and sponsors
Support this project by becoming a sponsor. Your name will show up in the Contribute page of all PHP Flasher installations as well as here with a link to your website!
Join our team of contributors and make a lasting impact on our project!
Thank you to all our backers and sponsors! 🙏
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.
<a href="https://opencollective.com/php-flasher#backers" target="_blank">
<img src="https://opencollective.com/php-flasher/backers.svg?width=890" title="Backers" alt="Backers">
</a>
Shining stars of our community:
<a href="https://opencollective.com/php-flasher#sponsors" target="_blank">
<img src="https://opencollective.com/php-flasher/sponsors.svg?width=890" title="Sponsors" alt="Sponsors">
</a>
<!-- ALL-CONTRIBUTORS-LIST:START -->
<!-- prettier-ignore-start -->
<!-- markdownlint-disable -->
<table>
<tbody>
<tr>
<td align="center" valign="top" width="14.28%"><a href="https://www.linkedin.com/in/younes-khoubza/"><img src="https://avatars.githubusercontent.com/u/10859693?v=4?s=100" width="100px;" alt="Younes KHOUBZA"/><br /><sub><b>Younes KHOUBZA</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>
<td align="center" valign="top" width="14.28%"><a href="https://ashallendesign.co.uk/"><img src="https://avatars.githubusercontent.com/u/39652331?v=4?s=100" width="100px;" alt="Ash Allen"/><br /><sub><b>Ash Allen</b></sub></a><br /><a href="#design-ash-jc-allen" title="Design">🎨</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://about.me/murrant"><img src="https://avatars.githubusercontent.com/u/39462?v=4?s=100" width="100px;" alt="Tony Murray"/><br /><sub><b>Tony Murray</b></sub></a><br /><a href="https://github.com/php-flasher/php-flasher/commits?author=murrant" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/n3wborn"><img src="https://avatars.githubusercontent.com/u/10246722?v=4?s=100" width="100px;" alt="Stéphane P"/><br /><sub><b>Stéphane P</b></sub></a><br /><a href="https://github.com/php-flasher/php-flasher/commits?author=n3wborn" title="Documentation">📖</a></td>
</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>
</tr>
</tbody>
</table>
### Contact
<!-- markdownlint-restore -->
<!-- prettier-ignore-end -->
PHP Flasher 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:
<!-- ALL-CONTRIBUTORS-LIST:END -->
- [Github Issues](https://github.com/php-flasher/flasher/issues)
## Contact
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](https://github.com/yoeunes)
- [Twitter](https://twitter.com/yoeunes)
- [Linkedin](https://www.linkedin.com/in/younes-khoubza/)
@@ -82,6 +68,6 @@ on any of the following:
## License
PHP Flasher is open-sourced software 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-khoubza/">Younes KHOUBZA</a> <b> </p>
<p align="center"> <b>Made with ❤️ by <a href="https://www.linkedin.com/in/younes-khoubza/">Younes KHOUBZA</a> </b> </p>
-81
View File
@@ -1,81 +0,0 @@
#!/usr/bin/env bash
set -e
# Make sure the release tag is provided.
if (( "$#" != 1 ))
then
echo "Tag has to be provided."
exit 1
fi
RELEASE_BRANCH="main"
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
VERSION=$1
# Make sure current branch and release branch match.
if [[ "$RELEASE_BRANCH" != "$CURRENT_BRANCH" ]]
then
echo "Release branch ($RELEASE_BRANCH) does not match the current active branch ($CURRENT_BRANCH)."
exit 1
fi
# Make sure the working directory is clear.
if [[ ! -z "$(git status --porcelain)" ]]
then
echo "Your working directory is dirty. Did you forget to commit your changes?"
exit 1
fi
# Make sure latest changes are fetched first.
git fetch origin
# Make sure that release branch is in sync with origin.
if [[ $(git rev-parse HEAD) != $(git rev-parse origin/$RELEASE_BRANCH) ]]
then
echo "Your branch is out of date with its upstream. Did you forget to pull or push any changes before releasing?"
exit 1
fi
# Always prepend with "v"
if [[ $VERSION != v* ]]
then
VERSION="v$VERSION"
fi
# Tag PHP Flasher
git tag "$VERSION"
git push origin --tags --force
# Tag Repositories
for REMOTE in flasher flasher-laravel flasher-symfony \
flasher-toastr flasher-toastr-laravel flasher-toastr-symfony \
flasher-notyf flasher-notyf-laravel flasher-notyf-symfony \
flasher-sweet-alert flasher-sweet-alert-laravel flasher-sweet-alert-symfony \
flasher-pnotify flasher-pnotify-laravel flasher-pnotify-symfony \
flasher-noty flasher-noty-laravel flasher-noty-symfony
do
echo ""
echo ""
echo "Releasing $REMOTE";
TMP_DIR="/tmp/php-flasher"
REMOTE_URL="git@github.com:php-flasher/$REMOTE.git"
rm -rf $TMP_DIR;
mkdir $TMP_DIR;
(
cd $TMP_DIR;
git clone $REMOTE_URL .
git checkout "$RELEASE_BRANCH";
git tag "$VERSION"
git push origin --tags
)
done
-68
View File
@@ -1,68 +0,0 @@
#!/usr/bin/env bash
set -e
set -x
CURRENT_BRANCH="main"
function split()
{
# git merge --strategy recursive --strategy-option subtree="$1" "$2/$CURRENT_BRANCH" --allow-unrelated-histories -m "Merge remote-tracking branch '$2/$CURRENT_BRANCH'"
SHA1=$(./bin/splitsh-lite --prefix="$1")
git push $2 "$SHA1:refs/heads/$CURRENT_BRANCH" -f
}
function remote()
{
git remote add "$1" "$2" || true
}
git pull origin $CURRENT_BRANCH
remote flasher git@github.com-yoeunes:php-flasher/flasher.git
remote laravel git@github.com-yoeunes:php-flasher/flasher-laravel.git
remote symfony git@github.com-yoeunes:php-flasher/flasher-symfony.git
remote toastr git@github.com-yoeunes:php-flasher/flasher-toastr.git
remote toastr-laravel git@github.com-yoeunes:php-flasher/flasher-toastr-laravel.git
remote toastr-symfony git@github.com-yoeunes:php-flasher/flasher-toastr-symfony.git
remote notyf git@github.com-yoeunes:php-flasher/flasher-notyf.git
remote notyf-laravel git@github.com-yoeunes:php-flasher/flasher-notyf-laravel.git
remote notyf-symfony git@github.com-yoeunes:php-flasher/flasher-notyf-symfony.git
remote sweet-alert git@github.com-yoeunes:php-flasher/flasher-sweet-alert.git
remote sweet-alert-laravel git@github.com-yoeunes:php-flasher/flasher-sweet-alert-laravel.git
remote sweet-alert-symfony git@github.com-yoeunes:php-flasher/flasher-sweet-alert-symfony.git
remote pnotify git@github.com-yoeunes:php-flasher/flasher-pnotify.git
remote pnotify-laravel git@github.com-yoeunes:php-flasher/flasher-pnotify-laravel.git
remote pnotify-symfony git@github.com-yoeunes:php-flasher/flasher-pnotify-symfony.git
remote noty git@github.com-yoeunes:php-flasher/flasher-noty.git
remote noty-laravel git@github.com-yoeunes:php-flasher/flasher-noty-laravel.git
remote noty-symfony git@github.com-yoeunes:php-flasher/flasher-noty-symfony.git
split 'src/Prime' flasher
split 'src/Laravel' laravel
split 'src/Symfony' symfony
split 'src/Toastr/Prime' toastr
split 'src/Toastr/Laravel' toastr-laravel
split 'src/Toastr/Symfony' toastr-symfony
split 'src/Notyf/Prime' notyf
split 'src/Notyf/Laravel' notyf-laravel
split 'src/Notyf/Symfony' notyf-symfony
split 'src/SweetAlert/Prime' sweet-alert
split 'src/SweetAlert/Laravel' sweet-alert-laravel
split 'src/SweetAlert/Symfony' sweet-alert-symfony
split 'src/Pnotify/Prime' pnotify
split 'src/Pnotify/Laravel' pnotify-laravel
split 'src/Pnotify/Symfony' pnotify-symfony
split 'src/Noty/Prime' noty
split 'src/Noty/Laravel' noty-laravel
split 'src/Noty/Symfony' noty-symfony
BIN
View File
Binary file not shown.
-34
View File
@@ -1,34 +0,0 @@
#!/usr/bin/env bash
set -e
set -x
function remote()
{
git remote set-url "$1" "$2" || true
}
remote flasher git@github.com-yoeunes:php-flasher/flasher.git
remote laravel git@github.com-yoeunes:php-flasher/flasher-laravel.git
remote symfony git@github.com-yoeunes:php-flasher/flasher-symfony.git
remote toastr git@github.com-yoeunes:php-flasher/flasher-toastr.git
remote toastr-laravel git@github.com-yoeunes:php-flasher/flasher-toastr-laravel.git
remote toastr-symfony git@github.com-yoeunes:php-flasher/flasher-toastr-symfony.git
remote notyf git@github.com-yoeunes:php-flasher/flasher-notyf.git
remote notyf-laravel git@github.com-yoeunes:php-flasher/flasher-notyf-laravel.git
remote notyf-symfony git@github.com-yoeunes:php-flasher/flasher-notyf-symfony.git
remote sweet-alert git@github.com-yoeunes:php-flasher/flasher-sweet-alert.git
remote sweet-alert-laravel git@github.com-yoeunes:php-flasher/flasher-sweet-alert-laravel.git
remote sweet-alert-symfony git@github.com-yoeunes:php-flasher/flasher-sweet-alert-symfony.git
remote pnotify git@github.com-yoeunes:php-flasher/flasher-pnotify.git
remote pnotify-laravel git@github.com-yoeunes:php-flasher/flasher-pnotify-laravel.git
remote pnotify-symfony git@github.com-yoeunes:php-flasher/flasher-pnotify-symfony.git
remote noty git@github.com-yoeunes:php-flasher/flasher-noty.git
remote noty-laravel git@github.com-yoeunes:php-flasher/flasher-noty-laravel.git
remote noty-symfony git@github.com-yoeunes:php-flasher/flasher-noty-symfony.git
Executable → Regular
+40 -21
View File
@@ -1,32 +1,51 @@
{
"description": "All flasher components in one place for easy maintenance with splitsh",
"name": "php-flasher/php-flasher",
"type": "project",
"name": "php-flasher/php-pack",
"description": "PHPFlasher - A powerful & easy-to-use package for adding flash messages to Laravel or Symfony projects. Provides feedback to users, improves engagement & enhances user experience. Intuitive design for beginners & experienced developers. A reliable, flexible solution.",
"license": "MIT",
"type": "flasher-pack",
"keywords": [
"php-flasher",
"flash-messages",
"notification-system",
"user-feedback",
"toastr",
"sweetalert",
"pnotify",
"noty",
"notyf",
"desktop-notifications",
"php",
"laravel",
"symfony",
"javascript",
"yoeunes",
"framework-agnostic",
"phpstorm-auto-complete",
"custom-adapter",
"user-experience",
"rtl",
"dark-mode"
],
"authors": [
{
"name": "KHOUBZA Younes",
"name": "Younes KHOUBZA",
"email": "younes.khoubza@gmail.com",
"homepage": "https://github.com/yoeunes",
"homepage": "https://www.linkedin.com/in/younes-khoubza",
"role": "Developer"
}
],
"require": {
"php": ">=5.3",
"ext-json": "*"
"php-flasher/flasher-cli": "*",
"php-flasher/flasher-noty": "*",
"php-flasher/flasher-notyf": "*",
"php-flasher/flasher-pnotify": "*",
"php-flasher/flasher-sweetalert": "*",
"php-flasher/flasher-toastr": "*"
},
"autoload": {
"psr-4": {
"Flasher\\": "src/"
},
"files": [
"src/Prime/helpers.php",
"src/Toastr/Laravel/Resources/functions/toastr.php",
"src/Noty/Laravel/Resources/functions/noty.php",
"src/Notyf/Laravel/Resources/functions/notyf.php",
"src/Pnotify/Laravel/Resources/functions/pnotify.php",
"src/SweetAlert/Laravel/Resources/functions/sweetAlert.php"
]
},
"minimum-stability": "dev"
"minimum-stability": "stable",
"prefer-stable": true,
"config": {
"preferred-install": "dist",
"sort-packages": true
}
}
-39
View File
@@ -1,39 +0,0 @@
<?php
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use Symplify\EasyCodingStandard\ValueObject\Set\SetList;
use Symplify\EasyCodingStandard\ValueObject\Option;
return static function (ContainerConfigurator $containerConfigurator): void {
$parameters = $containerConfigurator->parameters();
$parameters->set(Option::PATHS, [
__DIR__ . '/src'
]);
$parameters->set(Option::SKIP, [
PhpCsFixer\Fixer\ClassNotation\VisibilityRequiredFixer::class,
PhpCsFixer\Fixer\ControlStructure\YodaStyleFixer::class,
PhpCsFixer\Fixer\Whitespace\MethodChainingIndentationFixer::class,
PhpCsFixer\Fixer\Operator\NotOperatorWithSuccessorSpaceFixer::class,
Symplify\CodingStandard\Fixer\Spacing\MethodChainingNewlineFixer::class,
]);
$containerConfigurator->import(SetList::ARRAY);
$containerConfigurator->import(SetList::CLEAN_CODE);
$containerConfigurator->import(SetList::COMMENTS);
$containerConfigurator->import(SetList::COMMON);
$containerConfigurator->import(SetList::CONTROL_STRUCTURES);
$containerConfigurator->import(SetList::DOCBLOCK);
$containerConfigurator->import(SetList::NAMESPACES);
$containerConfigurator->import(SetList::PSR_12);
$containerConfigurator->import(SetList::SPACES);
$containerConfigurator->import(SetList::STRICT);
$containerConfigurator->import(SetList::SYMPLIFY);
$services = $containerConfigurator->services();
$services->set(PhpCsFixer\Fixer\ArrayNotation\ArraySyntaxFixer::class)
->call('configure', [[
'syntax' => 'long',
]]);
};
-78
View File
@@ -1,78 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit bootstrap="vendor/autoload.php"
backupGlobals="false"
backupStaticAttributes="false"
colors="true"
verbose="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="true">
<testsuites>
<testsuite name="flasher">
<directory>src/Prime</directory>
</testsuite>
<testsuite name="flasher laravel">
<directory>src/Laravel</directory>
</testsuite>
<testsuite name="flasher symfony">
<directory>src/Symfony</directory>
</testsuite>
<testsuite name="flasher toastr">
<directory>src/Toastr/Prime</directory>
</testsuite>
<testsuite name="flasher toastr laravel">
<directory>src/Toastr/Laravel</directory>
</testsuite>
<testsuite name="flasher toastr symfony">
<directory>src/Toastr/Symfony</directory>
</testsuite>
<testsuite name="flasher notyf">
<directory>src/Notyf/Prime</directory>
</testsuite>
<testsuite name="flasher notyf laravel">
<directory>src/Notyf/Laravel</directory>
</testsuite>
<testsuite name="flasher notyf symfony">
<directory>src/Notyf/Symfony</directory>
</testsuite>
<testsuite name="flasher sweet alert">
<directory>src/SweetAlert/Prime</directory>
</testsuite>
<testsuite name="flasher sweet alert laravel">
<directory>src/SweetAlert/Laravel</directory>
</testsuite>
<testsuite name="flasher sweet alert symfony">
<directory>src/SweetAlert/Symfony</directory>
</testsuite>
<testsuite name="flasher pnotify">
<directory>src/Pnotify/Prime</directory>
</testsuite>
<testsuite name="flasher pnotify laravel">
<directory>src/Pnotify/Laravel</directory>
</testsuite>
<testsuite name="flasher pnotify symfony">
<directory>src/Pnotify/Symfony</directory>
</testsuite>
<testsuite name="flasher noty">
<directory>src/Noty/Prime</directory>
</testsuite>
<testsuite name="flasher noty laravel">
<directory>src/Noty/Laravel</directory>
</testsuite>
<testsuite name="flasher noty symfony">
<directory>src/Noty/Symfony</directory>
</testsuite>
</testsuites>
<filter>
<whitelist>
<directory suffix=".php">src/</directory>
</whitelist>
</filter>
</phpunit>
-13
View File
@@ -1,13 +0,0 @@
# Path-based git attributes
# https://www.kernel.org/pub/software/scm/git/docs/gitattributes.html
# Ignore all test and documentation with "export-ignore".
/.gitattributes export-ignore
/.gitignore export-ignore
/.travis.yml export-ignore
/phpunit.xml.dist export-ignore
/.scrutinizer.yml export-ignore
/.styleci.yml export-ignore
/tests export-ignore
/.editorconfig export-ignore
-6
View File
@@ -1,6 +0,0 @@
# These are supported funding model platforms
patreon: yoeunes
ko_fi: yoeunes
open_collective: php-flasher
custom: ['https://www.paypal.com/paypalme/yoeunes']
-7
View File
@@ -1,7 +0,0 @@
version: 2
updates:
- package-ecosystem: composer
directory: "/"
schedule:
interval: daily
open-pull-requests-limit: 10
-122
View File
@@ -1,122 +0,0 @@
name: Running tests
on:
push:
pull_request:
schedule:
- cron: '* * * * *'
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
laravel: [8.*, 7.*, 6.*, 5.8.*, 5.7.*, 5.6.*, 5.5.*, 5.4.*, 5.3.*, 5.2.*, 5.1.*, 5.0.*, 4.2.*, 4.1.*, 4.0.*]
os:
- ubuntu-latest
# - macos-latest
# - windows-latest
include:
- laravel: 8.*
testbench: 6.*
php: 7.3
phpunit: 9.3.*
- laravel: 7.*
testbench: 5.*
php: 7.3
phpunit: 8.4.*
- laravel: 6.*
testbench: 4.*
php: 7.2
phpunit: 8.3.*
- laravel: 5.8.*
testbench: 3.8.*
php: 7.1
phpunit: 7.5.*
- laravel: 5.7.*
testbench: 3.7.*
php: 7.1
phpunit: 7.0.*
- laravel: 5.6.*
testbench: 3.6.*
php: 7.1
phpunit: 7.0.*
- laravel: 5.5.*
testbench: 3.5.*
php: 7.0
phpunit: 6.0.*
- laravel: 5.4.*
testbench: 3.4.*
php: 5.6
phpunit: 5.7.*
- laravel: 5.3.*
testbench: 3.3.*
php: 5.6
phpunit: 4.8.*
- laravel: 5.2.*
testbench: 3.2.*
php: 5.5
phpunit: 4.8.*
- laravel: 5.1.*
testbench: 3.1.*
php: 5.5
phpunit: 4.8.*
- laravel: 5.0.*
testbench: 3.0.*
php: 5.4
phpunit: 4.8.*
- laravel: 4.2.*
testbench: 2.2.*
php: 5.4
phpunit: 4.8.*
- laravel: 4.1.*
testbench: 2.1.*
php: 5.4
phpunit: 4.8.*
- laravel: 4.0.*
testbench: 2.0.*
php: 5.4
phpunit: 4.8.*
name: ${{ matrix.os }} - L${{ matrix.laravel }} - P${{ matrix.php }}
steps:
- name: Checkout code
uses: actions/checkout@v1
- name: Cache dependencies
uses: actions/cache@v1
with:
path: ~/.composer/cache/files
key: dependencies-laravel-${{ matrix.laravel }}-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick
ini-values: memory_limit=-1
coverage: none
- name: Install dependencies
run: |
composer require "laravel/framework:${{ matrix.laravel }}" "phpunit/phpunit:${{ matrix.phpunit }}" "orchestra/testbench:${{ matrix.testbench }}" monolog/monolog --no-interaction --no-update
composer update --prefer-dist --no-interaction --no-suggest
- name: Execute tests
run: vendor/bin/phpunit
-5
View File
@@ -1,5 +0,0 @@
.idea
vendor
composer.lock
.phpunit.result.cache
.phpcs-cache
-45
View File
@@ -1,45 +0,0 @@
<?php
namespace PHPSTORM_META;
$mapping = [
'' => '@',
'Flasher\Prime\Config\ConfigInterface' => \Flasher\Laravel\Config\Config::class,
'Flasher\Prime\EventDispatcher\EventDispatcherInterface' => \Flasher\Prime\EventDispatcher\EventDispatcher::class,
'Flasher\Prime\Factory\NotificationFactoryInterface' => \Flasher\Prime\Factory\NotificationFactory::class,
'Flasher\Prime\Filter\FilterInterface' => \Flasher\Prime\Filter\Filter::class,
'Flasher\Prime\FlasherInterface' => \Flasher\Prime\Flasher::class,
'Flasher\Prime\Response\ResponseManagerInterface' => \Flasher\Prime\Response\ResponseManager::class,
'Flasher\Prime\Storage\StorageInterface' => \Flasher\Laravel\Storage\Storage::class,
'Flasher\Prime\Storage\StorageManagerInterface' => \Flasher\Prime\Storage\StorageManager::class,
'Flasher\Prime\Template\EngineInterface' => \Flasher\Laravel\Template\BladeEngine::class,
'flasher' => \Flasher\Prime\Flasher::class,
'flasher.config' => \Flasher\Laravel\Config\Config::class,
'flasher.event_dispatcher' => \Flasher\Prime\EventDispatcher\EventDispatcher::class,
'flasher.filter' => \Flasher\Prime\Filter\Filter::class,
'flasher.notification_factory' => \Flasher\Prime\Factory\NotificationFactory::class,
'flasher.noty' => \Flasher\Noty\Prime\NotyFactory::class,
'flasher.notyf' => \Flasher\Notyf\Prime\NotyfFactory::class,
'flasher.pnotify' => \Flasher\Pnotify\Prime\PnotifyFactory::class,
'flasher.resource_manager' => \Flasher\Prime\Response\Resource\ResourceManager::class,
'flasher.response_manager' => \Flasher\Prime\Response\ResponseManager::class,
'flasher.storage' => \Flasher\Laravel\Storage\Storage::class,
'flasher.storage_manager' => \Flasher\Prime\Storage\StorageManager::class,
'flasher.sweet_alert' => \Flasher\SweetAlert\Prime\SweetAlertFactory::class,
'flasher.template_engine' => \Flasher\Laravel\Template\BladeEngine::class,
'flasher.toastr' => \Flasher\Toastr\Prime\ToastrFactory::class,
];
override(new \Illuminate\Contracts\Container\Container, map($mapping));
override(\Illuminate\Container\Container::makeWith(0), map($mapping));
override(\Illuminate\Contracts\Container\Container::get(0), map($mapping));
override(\Illuminate\Contracts\Container\Container::make(0), map($mapping));
override(\Illuminate\Contracts\Container\Container::makeWith(0), map($mapping));
override(\App::get(0), map($mapping));
override(\App::make(0), map($mapping));
override(\App::makeWith(0), map($mapping));
override(\app(0), map($mapping));
override(\resolve(0), map($mapping));
override(\Psr\Container\ContainerInterface::get(0), map($mapping));
View File
-24
View File
@@ -1,24 +0,0 @@
<?php
namespace Flasher\Laravel\Config;
use Flasher\Prime\Config\ConfigInterface;
use Illuminate\Config\Repository;
final class Config implements ConfigInterface
{
private $config;
private $separator;
public function __construct(Repository $config, $separator = '.')
{
$this->config = $config;
$this->separator = $separator;
}
public function get($key, $default = null)
{
return $this->config->get('flasher' . $this->separator . $key, $default);
}
}
-42
View File
@@ -1,42 +0,0 @@
<?php
namespace Flasher\Laravel\Facade;
use Flasher\Prime\Envelope;
use Flasher\Prime\Notification\NotificationBuilder;
use Flasher\Prime\Notification\NotificationInterface;
use Flasher\Prime\Stamp\StampInterface;
use Illuminate\Support\Facades\Facade;
/**
* @method static NotificationBuilder addSuccess(string $message, array $options = array())
* @method static NotificationBuilder addError(string $message, array $options = array())
* @method static NotificationBuilder addWarning(string $message, array $options = array())
* @method static NotificationBuilder addInfo(string $message, array $options = array())
* @method static NotificationBuilder addFlash(string|NotificationInterface $type, string $message = null, array $options = array())
* @method static NotificationBuilder flash(StampInterface[] $stamps = array())
* @method static NotificationBuilder type(string $type, string $message = null, array $options = array())
* @method static NotificationBuilder message(string $message)
* @method static NotificationBuilder options(array $options, bool $merge = true)
* @method static NotificationBuilder option(string $name, $value)
* @method static NotificationBuilder success(string $message = null, array $options = array())
* @method static NotificationBuilder error(string $message = null, array $options = array())
* @method static NotificationBuilder info(string $message = null, array $options = array())
* @method static NotificationBuilder warning(string $message = null, array $options = array())
* @method static NotificationBuilder priority(int $priority)
* @method static NotificationBuilder hops(int $amount)
* @method static NotificationBuilder keep()
* @method static NotificationBuilder delay(int $delay)
* @method static NotificationBuilder now()
* @method static NotificationBuilder with(StampInterface[] $stamps = array())
* @method static NotificationBuilder withStamp(StampInterface $stamp)
* @method static NotificationBuilder handler(string $handler)
* @method static Envelope getEnvelope()
*/
class Flasher extends Facade
{
protected static function getFacadeAccessor()
{
return 'flasher';
}
}
-67
View File
@@ -1,67 +0,0 @@
<?php
namespace Flasher\Laravel;
use Flasher\Laravel\ServiceProvider\ServiceProviderManager;
use Illuminate\Support\ServiceProvider;
final class FlasherServiceProvider extends ServiceProvider
{
/**
* Bootstrap the application events.
*/
public function boot()
{
$manager = new ServiceProviderManager($this);
$manager->boot();
}
/**
* Register the service provider.
*/
public function register()
{
$manager = new ServiceProviderManager($this);
$manager->register();
}
/**
* Get the services provided by the provider.
*
* @return string[]
*/
public function provides()
{
return array(
'flasher',
);
}
/**
* @return \Illuminate\Container\Container
*/
public function getApplication()
{
return $this->app;
}
public function mergeConfigFrom($path, $key)
{
parent::mergeConfigFrom($path, $key);
}
public function publishes(array $paths, $groups = null)
{
parent::publishes($paths, $groups);
}
public function loadTranslationsFrom($path, $namespace)
{
parent::loadTranslationsFrom($path, $namespace);
}
public function loadViewsFrom($path, $namespace)
{
parent::loadViewsFrom($path, $namespace);
}
}
@@ -1,103 +0,0 @@
<?php
namespace Flasher\Laravel\Middleware;
use Closure;
use Flasher\Prime\Config\ConfigInterface;
use Flasher\Prime\FlasherInterface;
use Flasher\Prime\Response\ResponseManagerInterface;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
final class SessionMiddleware
{
/**
* @var ConfigInterface
*/
private $config;
/**
* @var FlasherInterface
*/
private $flasher;
/**
* @var ResponseManagerInterface
*/
private $renderer;
public function __construct(ConfigInterface $config, FlasherInterface $flasher, ResponseManagerInterface $renderer)
{
$this->config = $config;
$this->flasher = $flasher;
$this->renderer = $renderer;
}
/**
* Run the request filter.
*
* @return mixed
*/
public function handle(Request $request, Closure $next)
{
/** @var Response $response */
$response = $next($request);
if ($request->isXmlHttpRequest() || true !== $this->config->get('auto_create_from_session')) {
return $response;
}
$readyToRender = false;
foreach ($this->typesMapping() as $alias => $type) {
if (false === $request->session()->has($alias)) {
continue;
}
$this->flasher->addFlash($type, $request->session()->get($alias));
$readyToRender = true;
}
if (false === $readyToRender) {
return $response;
}
$content = $response->getContent();
$htmlResponse = $this->renderer->render(array(), array(
'format' => 'html',
'content' => $content,
));
if (empty($htmlResponse)) {
return $response;
}
$pos = strripos($content, '</body>');
$content = substr($content, 0, $pos) . $htmlResponse . substr($content, $pos);
$response->setContent($content);
return $response;
}
/**
* @return array
*/
private function typesMapping()
{
$mapping = array();
foreach ($this->config->get('types_mapping', array()) as $type => $aliases) {
if (is_int($type) && is_string($aliases)) {
$type = $aliases;
}
foreach ((array) $aliases as $alias) {
$mapping[$alias] = $type;
}
}
return $mapping;
}
}
@@ -1,97 +0,0 @@
<?php
namespace Flasher\Laravel\Observer;
use Flasher\Prime\Config\ConfigInterface;
use Flasher\Prime\FlasherInterface;
use Illuminate\Contracts\Translation\Translator;
use Illuminate\Database\Eloquent\Model;
final class FlasherModelObserver
{
/**
* @var ConfigInterface
*/
private $config;
/**
* @var FlasherInterface
*/
private $flasher;
/**
* @var Translator
*/
private $translator;
public function __construct(ConfigInterface $config, FlasherInterface $flasher, Translator $translator)
{
$this->config = $config;
$this->flasher = $flasher;
$this->translator = $translator;
}
/**
* Handle the Model "created" event.
*/
public function created(Model $model)
{
$this->addFlash(__FUNCTION__, $model);
}
/**
* Handle the Model "updated" event.
*/
public function updated(Model $model)
{
$this->addFlash(__FUNCTION__, $model);
}
/**
* Handle the Model "deleted" event.
*/
public function deleted(Model $model)
{
$this->addFlash(__FUNCTION__, $model);
}
/**
* Handle the Model "restored" event.
*/
public function restored(Model $model)
{
$this->addFlash(__FUNCTION__, $model);
}
/**
* Handle the Model "force deleted" event.
*/
public function forceDeleted(Model $model)
{
$this->addFlash(__FUNCTION__, $model);
}
/**
* @param string $method
*/
private function addFlash($method, Model $model)
{
$exludes = $this->config->get('observer_events.exclude', array());
if (in_array($method, $exludes, true)) {
return;
}
if (isset($exludes[$method]) && in_array(get_class($model), $exludes[$method], true)) {
return;
}
if ($this->translator->has(sprintf('flasher::messages.flashable.%s.%s', get_class($model), $method))) {
$message = $this->translator->get(sprintf('flasher::messages.flashable.%s.%s', get_class($model), $method));
} else {
$message = $this->translator->get(sprintf('flasher::messages.flashable.default.%s', $method));
$message = str_replace('{{ model }}', substr(strrchr(get_class($model), '\\'), 1), $message);
}
$this->flasher->addSuccess($message);
}
}
-87
View File
@@ -1,87 +0,0 @@
<p align="center"><img width="600" alt="flasher" src="https://user-images.githubusercontent.com/10859693/102468596-03317180-4052-11eb-9df3-44dc6235b238.png"></p>
<h1 align="center">A powerful and flexible flash notifications system for PHP, Laravel, Symfony</h1>
<p align="center">
:eyes: PHP Flasher helps you to add flash notifications to your PHP projects.
This library was developed with the idea that you should be able to add flash notification to your application with ease and with few lines of code.
No application-wide rewrites and no big investments upfront.
</p>
<p align="center">
<a href="https://github.com/php-flasher/flasher">
<img src="https://img.shields.io/badge/source-php--flasher/flasher-blue.svg?style=flat-square">
</a>
<a href="https://github.com/php-flasher/flasher/releases">
<img src="https://img.shields.io/github/tag/php-flasher/flasher.svg">
</a>
<a href="https://github.com/php-flasher/flasher/blob/master/LICENSE">
<img src="https://img.shields.io/badge/license-MIT-brightgreen.svg">
</a>
<a href="https://packagist.org/packages/php-flasher/flasher">
<img src="https://img.shields.io/packagist/dt/php-flasher/flasher.svg">
</a>
<a href="https://packagist.org/packages/php-flasher/flasher">
<img src="https://img.shields.io/packagist/php-v/php-flasher/flasher.svg?style=flat-square">
</a>
<a href="https://opencollective.com/php-flasher">
<img src="https://opencollective.com/php-flasher/tiers/backer/badge.svg?label=backer&color=brightgreen" />
</a>
<a href="https://opencollective.com/php-flasher">
<img src="https://opencollective.com/php-flasher/tiers/sponsor/badge.svg?label=sponsor&color=brightgreen" />
</a>
</p>
# Why use PHP Flasher ?
The PHP Flasher project supports many notification libraries : __tailwindcss__, __bootstrap__, __toastr.js__, __sweet alert 2__, __pnotify__, __noty__, and __notyf__
and its highly extendable so you can add your custom notifications.
This library is designed, so you can take full control when creating you notifications :
> * Display multiple notifications
> * Sort and filter notifications
> * Render notification from JSON object
> * Limit the number of displayed notifications
> * Show notifications from different libraries at the same time
> * Framework angostic with integration for : Symfony and Laravel
> * Support templates
> * Easy migration from similar libraries.
> * Very flexible so you can add you own adapters
> * ...and more
## Official Documentation
Documentation for PHP Flasher can be found on the [PHP Flasher website](https://php-flasher.github.io/).
## Backers && Sponsors
Support this project by becoming a sponsor. Your name will show up in the Contribute page of all PHP Flasher installations as well as here with a link to your website!
Thank you to all our backers and sponsors! 🙏
<a href="https://opencollective.com/php-flasher#backers" target="_blank">
<img src="https://opencollective.com/php-flasher/backers.svg?width=890" title="Backers" alt="Backers">
</a>
<a href="https://opencollective.com/php-flasher#sponsors" target="_blank">
<img src="https://opencollective.com/php-flasher/sponsors.svg?width=890" title="Sponsors" alt="Sponsors">
</a>
### Contact
PHP Flasher 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/flasher/issues)
- [Github](https://github.com/yoeunes)
- [Twitter](https://twitter.com/yoeunes)
- [Linkedin](https://www.linkedin.com/in/younes-khoubza/)
- [Email me directly](mailto:younes.khoubza@gmail.com)
## License
PHP Flasher 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-khoubza/">Younes KHOUBZA</a> <b> </p>
-51
View File
@@ -1,51 +0,0 @@
<?php
return array(
'default' => 'template',
'root_scripts' => array(
'https://cdn.jsdelivr.net/npm/@flasher/flasher@0.1.6/dist/flasher.min.js',
),
'template_factory' => array(
'default' => 'tailwindcss',
'templates' => array(
'tailwindcss' => array(
'view' => 'flasher::tailwindcss',
'styles' => array(
'https://cdnjs.cloudflare.com/ajax/libs/tailwindcss/2.2.7/base.min.css',
'https://cdnjs.cloudflare.com/ajax/libs/tailwindcss/2.2.7/utilities.css',
),
),
'tailwindcss_bg' => array(
'view' => 'flasher::tailwindcss_bg',
'styles' => array(
'https://cdnjs.cloudflare.com/ajax/libs/tailwindcss/2.2.7/base.min.css',
'https://cdnjs.cloudflare.com/ajax/libs/tailwindcss/2.2.7/utilities.css',
),
),
'bootstrap' => array(
'view' => 'flasher::bootstrap',
'styles' => array(
'https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.5.3/css/bootstrap.min.css',
),
),
),
),
'auto_create_from_session' => true,
'types_mapping' => array(
'success' => array('success'),
'error' => array('error', 'danger'),
'warning' => array('warning', 'alarm'),
'info' => array('info', 'notice', 'alert'),
),
'observer_events' => array(
'exclude' => array(
'forceDeleted',
'restored',
),
),
);
@@ -1,13 +0,0 @@
<?php
return array(
'flashable' => array(
'default' => array(
'created' => '{{ model }} has been created.',
'updated' => '{{ model }} has been updated.',
'deleted' => '{{ model }} has been deleted.',
'restored' => '{{ model }} has been restored.',
'forceDeleted' => '{{ model }} has been deleted.',
),
),
);
@@ -1,38 +0,0 @@
<?php
switch ($envelope->getType()) {
case 'success':
$title = 'Success';
$alertClass = 'alert-success';
$progressBackgroundColor = '#155724';
break;
case 'error':
$title = 'Error';
$alertClass = 'alert-danger';
$progressBackgroundColor = '#721c24';
break;
case 'warning':
$title = 'Warning';
$alertClass = 'alert-warning';
$progressBackgroundColor = '#856404';
break;
case 'info':
default:
$title = 'Info';
$alertClass = 'alert-info';
$progressBackgroundColor = '#0c5460';
break;
}
?>
<div style="margin-top: 0.5rem;cursor: pointer;">
<div class="alert {{ $alertClass }} alert-dismissible fade in show" role="alert" style="border-top-left-radius: 0;border-bottom-left-radius: 0;border: unset;border-left: 6px solid {{ $progressBackgroundColor }}">
<strong>{{ $title }} !</strong>
{{ $envelope->getMessage() }}
<button type="button" class="close" data-dismiss="alert" aria-label="Close" onclick="this.parentElement.remove()">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="d-flex" style="height: .125rem;margin-top: -1rem;">
<span class="flasher-progress" style="background-color: {{ $progressBackgroundColor }}"></span>
</div>
</div>
@@ -1,55 +0,0 @@
<?php
switch ($envelope->getType()) {
case 'success':
$title = 'Success';
$textColor = 'text-green-600';
$backgroundColor = 'bg-green-600';
$progressBackgroundColor = 'bg-green-100';
$borderColor = 'border-green-600';
$icon = '<svg fill="none" viewBox="0 0 24 24" stroke="currentColor" class="check w-5 h-5"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"/></svg>';
break;
case 'error':
$title = 'Error';
$textColor = 'text-red-600';
$backgroundColor = 'bg-red-600';
$progressBackgroundColor = 'bg-red-100';
$borderColor = 'border-red-600';
$icon = '<svg fill="none" viewBox="0 0 24 24" stroke="currentColor" class="x w-5 h-5"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"/></svg>';
break;
case 'warning':
$title = 'Warning';
$textColor = 'text-yellow-600';
$backgroundColor = 'bg-yellow-600';
$progressBackgroundColor = 'bg-yellow-100';
$borderColor = 'border-yellow-600';
$icon = '<svg fill="none" viewBox="0 0 24 24" stroke="currentColor" class="exclamation w-5 h-5"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"/></svg>';
break;
case 'info':
default:
$title = 'Info';
$textColor = 'text-blue-600';
$backgroundColor = 'bg-blue-600';
$progressBackgroundColor = 'bg-blue-100';
$borderColor = 'border-blue-600';
$icon = '<svg fill="none" viewBox="0 0 24 24" stroke="currentColor" class="exclamation-circle w-5 h-5"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"/></svg>';
break;
}
?>
<div class="bg-white shadow-lg border-l-4 mt-2 cursor-pointer {{ $borderColor }}">
<div class="flex items-center px-2 py-3 rounded-lg shadow-lg overflow-hidden">
<div class="inline-flex items-center {{ $backgroundColor }} p-2 text-white text-sm rounded-full flex-shrink-0">
{!! $icon !!}
</div>
<div class="ml-4 w-0 flex-1">
<p class="text-base leading-5 font-medium capitalize {{ $textColor }}">
{{ $title }}
</p>
<p class="mt-1 text-sm leading-5 text-gray-500">
{{ $envelope->getMessage() }}
</p>
</div>
</div>
<div class="h-0.5 flex {{ $progressBackgroundColor }}">
<span class="flasher-progress {{ $backgroundColor }}"></span>
</div>
</div>
@@ -1,56 +0,0 @@
<?php
switch ($envelope->getType()) {
case 'success':
$title = 'Success';
$textColor = 'text-green-700';
$backgroundColor = 'bg-green-50';
$progressBackgroundColor = 'bg-green-200';
$borderColor = 'border-green-600';
$icon = '<svg fill="none" viewBox="0 0 24 24" stroke="currentColor" class="check w-5 h-5"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"/></svg>';
break;
case 'error':
$title = 'Error';
$textColor = 'text-red-700';
$backgroundColor = 'bg-red-50';
$progressBackgroundColor = 'bg-red-200';
$borderColor = 'border-red-600';
$icon = '<svg fill="none" viewBox="0 0 24 24" stroke="currentColor" class="x w-5 h-5"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"/></svg>';
break;
case 'warning':
$title = 'Warning';
$textColor = 'text-yellow-700';
$backgroundColor = 'bg-yellow-50';
$progressBackgroundColor = 'bg-yellow-200';
$borderColor = 'border-yellow-600';
$icon = '<svg fill="none" viewBox="0 0 24 24" stroke="currentColor" class="exclamation w-5 h-5"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"/></svg>';
break;
case 'info':
default:
$title = 'Info';
$textColor = 'text-blue-700';
$backgroundColor = 'bg-blue-50';
$progressBackgroundColor = 'bg-blue-100';
$borderColor = 'border-blue-600';
$icon = '<svg fill="none" viewBox="0 0 24 24" stroke="currentColor" class="exclamation-circle w-5 h-5"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"/></svg>';
break;
}
?>
<div class="bg-white shadow-lg border-l-4 mt-2 cursor-pointer {{ $backgroundColor }} {{ $borderColor }}">
<div class="flex items-center px-2 py-3 rounded-lg shadow-lg overflow-hidden">
<div class="inline-flex items-center p-2 text-white text-sm rounded-full flex-shrink-0 border-2 {{ $borderColor }} {{ $textColor }}">
{!! $icon !!}
</div>
<div class="ml-4 w-0 flex-1">
<p class="text-base leading-5 font-medium capitalize {{ $textColor }}">
{{ $title }}
</p>
<p class="mt-1 text-sm leading-5 text-gray-500">
{{ $envelope->getMessage() }}
</p>
</div>
</div>
<div class="h-0.5 flex {{ $backgroundColor }}">
<span class="flasher-progress {{ $progressBackgroundColor }}"></span>
</div>
</div>
@@ -1,182 +0,0 @@
<?php
namespace Flasher\Laravel\ServiceProvider\Providers;
use Flasher\Laravel\Config\Config;
use Flasher\Laravel\FlasherServiceProvider;
use Flasher\Laravel\Storage\Storage;
use Flasher\Laravel\Template\BladeEngine;
use Flasher\Prime\EventDispatcher\EventDispatcher;
use Flasher\Prime\EventDispatcher\EventListener\FilterListener;
use Flasher\Prime\EventDispatcher\EventListener\RemoveListener;
use Flasher\Prime\EventDispatcher\EventListener\StampsListener;
use Flasher\Prime\Factory\NotificationFactory;
use Flasher\Prime\Filter\Filter;
use Flasher\Prime\Flasher;
use Flasher\Prime\Response\Presenter\ArrayPresenter;
use Flasher\Prime\Response\Presenter\HtmlPresenter;
use Flasher\Prime\Response\Resource\ResourceManager;
use Flasher\Prime\Response\ResponseManager;
use Flasher\Prime\Storage\StorageManager;
use Illuminate\Container\Container;
use Illuminate\Foundation\Application;
use Illuminate\Support\Facades\Blade;
class Laravel implements ServiceProviderInterface
{
/**
* @var Container
*/
protected $app;
public function __construct(Container $app)
{
$this->app = $app;
}
public function shouldBeUsed()
{
return $this->app instanceof Application;
}
public function boot(FlasherServiceProvider $provider)
{
$provider->loadTranslationsFrom(flasher_path(__DIR__ . '/../../Resources/lang'), 'flasher');
$provider->loadViewsFrom(flasher_path(__DIR__ . '/../../Resources/views'), 'flasher');
$provider->publishes(array(
flasher_path(__DIR__ . '/../../Resources/config/config.php') => config_path('flasher.php'),
), 'flasher-config');
$provider->publishes(array(
flasher_path(__DIR__ . '/../../Resources/lang') => resource_path(flasher_path('lang/vendor/flasher')),
), 'flasher-lang');
$provider->publishes(array(
flasher_path(__DIR__ . '/../../Resources/views') => resource_path(flasher_path('views/vendor/flasher')),
), 'flasher-views');
$this->registerBladeDirectives();
}
public function register(FlasherServiceProvider $provider)
{
$provider->mergeConfigFrom(flasher_path(__DIR__ . '/../../Resources/config/config.php'), 'flasher');
$this->app->singleton('flasher.config', function (Application $app) {
return new Config($app['config'], '.');
});
$this->registerCommonServices();
}
protected function registerCommonServices()
{
$this->app->singleton('flasher', function (Application $app) {
$flasher = new Flasher($app['flasher.config']);
$flasher->addFactory('template', $app['flasher.template']);
return $flasher;
});
$this->app->singleton('flasher.resource_manager', function (Application $app) {
$resourceManager = new ResourceManager($app['flasher.config'], $app['flasher.template_engine']);
$templates = $app['flasher.config']->get('template_factory.templates', array());
foreach ($templates as $template => $factory) {
if (isset($factory['scripts'])) {
$resourceManager->addScripts('template_' . $template, $factory['scripts']);
}
if (isset($factory['styles'])) {
$resourceManager->addStyles('template_' . $template, $factory['styles']);
}
if (isset($factory['options'])) {
$resourceManager->addOptions('template_' . $template, $factory['options']);
}
}
return $resourceManager;
});
$this->app->singleton('flasher.response_manager', function (Application $app) {
$responseManager = new ResponseManager(
$app['flasher.storage_manager'],
$app['flasher.event_dispatcher'],
$app['flasher.resource_manager']
);
$responseManager->addPresenter('html', new HtmlPresenter());
$responseManager->addPresenter('array', new ArrayPresenter());
return $responseManager;
});
$this->app->singleton('flasher.storage', function (Application $app) {
return new Storage($app['session']);
});
$this->app->singleton('flasher.storage_manager', function (Application $app) {
return new StorageManager($app['flasher.storage'], $app['flasher.event_dispatcher']);
});
$this->app->singleton('flasher.filter', function (Application $app) {
return new Filter();
});
$this->app->singleton('flasher.template_engine', function (Application $app) {
return new BladeEngine($app['view']);
});
$this->app->singleton('flasher.event_dispatcher', function (Application $app) {
$eventDispatcher = new EventDispatcher();
$eventDispatcher->addSubscriber(new FilterListener($app['flasher.filter']));
$eventDispatcher->addSubscriber(new RemoveListener());
$eventDispatcher->addSubscriber(new StampsListener());
return $eventDispatcher;
});
$this->app->singleton('flasher.notification_factory', function (Application $app) {
return new NotificationFactory($app['flasher.storage_manager']);
});
$this->app->alias('flasher.config', 'Flasher\Laravel\Config\Config');
$this->app->alias('flasher', 'Flasher\Prime\Flasher');
$this->app->alias('flasher.response_manager', 'Flasher\Prime\Response\ResponseManager');
$this->app->alias('flasher.event_dispatcher', 'Flasher\Prime\EventDispatcher\EventDispatcher');
$this->app->alias('flasher.storage', 'Flasher\Laravel\Storage\Storage');
$this->app->alias('flasher.storage_manager', 'Flasher\Laravel\Storage\StorageManager');
$this->app->alias('flasher.filter', 'Flasher\Prime\Filter\Filter');
$this->app->alias('flasher.template_engine', 'Flasher\Laravel\Template\BladeEngine');
$this->app->alias('flasher.notification_factory', 'Flasher\Prime\Factory\NotificationFactory');
$this->app->alias('Flasher\Prime\Factory\NotificationFactory', 'flasher.template');
$this->app->bind('Flasher\Prime\Config\ConfigInterface', 'flasher.config');
$this->app->bind('Flasher\Prime\FlasherInterface', 'flasher');
$this->app->bind('Flasher\Prime\Storage\StorageManagerInterface', 'flasher.storage_manager');
$this->app->bind('Flasher\Prime\Response\ResponseManagerInterface', 'flasher.response_manager');
$this->app->bind('Flasher\Prime\Filter\FilterInterface', 'flasher.filter');
$this->app->bind('Flasher\Prime\EventDispatcher\EventDispatcherInterface', 'flasher.event_dispatcher');
$this->app->bind('Flasher\Prime\Storage\StorageInterface', 'flasher.storage');
$this->app->bind('Flasher\Prime\Template\EngineInterface', 'flasher.template_engine');
$this->app->bind('Flasher\Prime\Factory\NotificationFactoryInterface', 'flasher.notification_factory');
}
protected function registerBladeDirectives()
{
$startsWith = function ($haystack, $needle) {
return substr_compare($haystack, $needle, 0, strlen($needle)) === 0;
};
$endsWith = function ($haystack, $needle) {
return substr_compare($haystack, $needle, -strlen($needle)) === 0;
};
Blade::directive('flasher_render', function ($criteria = array()) use ($startsWith, $endsWith) {
if (!empty($criteria) && $startsWith($criteria, '(') && $endsWith($criteria, ')')) {
$criteria = substr($criteria, 1, -1);
}
return "<?php echo app('flasher.response_manager')->render(${criteria}); ?>";
});
}
}
@@ -1,42 +0,0 @@
<?php
namespace Flasher\Laravel\ServiceProvider\Providers;
use Flasher\Laravel\Config\Config;
use Flasher\Laravel\FlasherServiceProvider;
use Illuminate\Foundation\Application;
use Illuminate\Support\Facades\Blade;
use Illuminate\View\Compilers\BladeCompiler;
final class Laravel4 extends Laravel
{
public function shouldBeUsed()
{
return $this->app instanceof Application && 0 === strpos(Application::VERSION, '4.');
}
public function boot(FlasherServiceProvider $provider)
{
$provider->package('php-flasher/flasher-laravel', 'flasher', flasher_path(__DIR__ . '/../../Resources'));
$this->registerBladeDirectives();
}
public function register(FlasherServiceProvider $provider)
{
$this->app->singleton('flasher.config', function (Application $app) {
return new Config($app['config'], '::');
});
$this->registerCommonServices();
}
protected function registerBladeDirectives()
{
Blade::extend(function ($view, BladeCompiler $compiler) {
$pattern = $compiler->createMatcher('flasher_render');
return preg_replace($pattern, '$1<?php echo app(\'flasher.response_manager\')->render$2; ?>', $view);
});
}
}
@@ -1,55 +0,0 @@
<?php
namespace Flasher\Laravel\ServiceProvider\Providers;
use Flasher\Laravel\FlasherServiceProvider;
use Illuminate\Foundation\Application;
use Illuminate\Support\Facades\Blade;
use Illuminate\View\Compilers\BladeCompiler;
final class Laravel50 extends Laravel
{
public function shouldBeUsed()
{
return $this->app instanceof Application && 0 === strpos(Application::VERSION, '5.0');
}
public function boot(FlasherServiceProvider $provider)
{
$provider->publishes(array(
flasher_path(__DIR__ . '/../../Resources/lang') => base_path(flasher_path('resources/lang/vendor/flasher')),
));
$this->registerBladeDirectives();
}
protected function registerBladeDirectives()
{
$startsWith = function ($haystack, $needle) {
return substr_compare($haystack, $needle, 0, strlen($needle)) === 0;
};
$endsWith = function ($haystack, $needle) {
return substr_compare($haystack, $needle, -strlen($needle)) === 0;
};
Blade::extend(function ($view, BladeCompiler $compiler) use ($startsWith, $endsWith) {
$pattern = $compiler->createPlainMatcher('flasher_render(.*)');
$matches = array();
preg_match($pattern, $view, $matches);
$value = $matches[2];
if (!empty($value) && $startsWith($value, '(') && $endsWith($value, ')')) {
$value = substr($value, 1, -1);
}
return str_replace(
'%criteria%',
$value,
$matches[1] . "<?php echo app('flasher.response_manager')->render(%criteria%); ?>"
);
});
}
}
@@ -1,23 +0,0 @@
<?php
namespace Flasher\Laravel\ServiceProvider\Providers;
use Flasher\Laravel\FlasherServiceProvider;
use Illuminate\Foundation\Application;
final class Laravel51 extends Laravel
{
public function shouldBeUsed()
{
return $this->app instanceof Application && 0 === strpos(Application::VERSION, '5.1');
}
public function boot(FlasherServiceProvider $provider)
{
$provider->publishes(array(
flasher_path(__DIR__ . '/../../Resources/lang') => base_path(flasher_path('resources/lang/vendor/flasher')),
));
$this->registerBladeDirectives();
}
}
@@ -1,17 +0,0 @@
<?php
namespace Flasher\Laravel\ServiceProvider\Providers;
use Flasher\Laravel\FlasherServiceProvider;
interface ServiceProviderInterface
{
/**
* @return bool
*/
public function shouldBeUsed();
public function boot(FlasherServiceProvider $provider);
public function register(FlasherServiceProvider $provider);
}
@@ -1,53 +0,0 @@
<?php
namespace Flasher\Laravel\ServiceProvider;
use Flasher\Prime\Response\Resource\ResourceManager;
final class ResourceManagerHelper
{
/**
* @param string $alias
* @param array $config
*/
public static function process(ResourceManager $responseManager, $alias, $config = null)
{
if (null === $config) {
$config = $responseManager->getConfig()->get('adapters.' . $alias);
}
$responseManager->addScripts($alias, self::getScripts($config));
$responseManager->addStyles($alias, self::getStyles($config));
$responseManager->addOptions($alias, self::getOptions($config));
}
/**
* @param array $config
*
* @return array
*/
private static function getScripts($config)
{
return isset($config['scripts']) ? $config['scripts'] : array();
}
/**
* @param array $config
*
* @return array
*/
private static function getStyles($config)
{
return isset($config['styles']) ? $config['styles'] : array();
}
/**
* @param array $config
*
* @return array
*/
private static function getOptions($config)
{
return isset($config['options']) ? $config['options'] : array();
}
}
@@ -1,60 +0,0 @@
<?php
namespace Flasher\Laravel\ServiceProvider;
use Flasher\Laravel\FlasherServiceProvider;
use Flasher\Laravel\ServiceProvider\Providers\ServiceProviderInterface;
final class ServiceProviderManager
{
private $provider;
/**
* @var ServiceProviderInterface[]
*/
private $providers = array(
'Flasher\Laravel\ServiceProvider\Providers\Laravel4',
'Flasher\Laravel\ServiceProvider\Providers\Laravel50',
'Flasher\Laravel\ServiceProvider\Providers\Laravel51',
'Flasher\Laravel\ServiceProvider\Providers\Laravel',
);
private $notifyServiceProvider;
public function __construct(FlasherServiceProvider $notifyServiceProvider)
{
$this->notifyServiceProvider = $notifyServiceProvider;
}
public function boot()
{
$provider = $this->resolveServiceProvider();
$provider->boot($this->notifyServiceProvider);
}
public function register()
{
$provider = $this->resolveServiceProvider();
$provider->register($this->notifyServiceProvider);
}
/**
* @return ServiceProviderInterface
*/
private function resolveServiceProvider()
{
if ($this->provider instanceof ServiceProviderInterface) {
return $this->provider;
}
foreach ($this->providers as $providerClass) {
$provider = new $providerClass($this->notifyServiceProvider->getApplication());
if ($provider->shouldBeUsed()) {
return $this->provider = $provider;
}
}
throw new \InvalidArgumentException('Service Provider not found.');
}
}
-78
View File
@@ -1,78 +0,0 @@
<?php
namespace Flasher\Laravel\Storage;
use Flasher\Prime\Envelope;
use Flasher\Prime\Stamp\UuidStamp;
use Flasher\Prime\Storage\StorageInterface;
use Illuminate\Session\SessionManager;
use Illuminate\Session\Store;
final class Storage implements StorageInterface
{
const ENVELOPES_NAMESPACE = 'flasher::envelopes';
/**
* @var SessionManager|Store
*/
private $session;
/**
* @param SessionManager|Store $session
*/
public function __construct($session)
{
$this->session = $session;
}
public function all()
{
return $this->session->get(self::ENVELOPES_NAMESPACE, array());
}
public function add($envelopes)
{
$envelopes = is_array($envelopes) ? $envelopes : func_get_args();
$this->session->put(self::ENVELOPES_NAMESPACE, array_merge($this->all(), $envelopes));
}
public function update($envelopes)
{
$envelopes = is_array($envelopes) ? $envelopes : func_get_args();
$map = UuidStamp::indexByUuid($envelopes);
$store = $this->all();
foreach ($store as $index => $envelope) {
$uuid = $envelope->get('Flasher\Prime\Stamp\UuidStamp')->getUuid();
if (!isset($map[$uuid])) {
continue;
}
$store[$index] = $map[$uuid];
}
$this->session->put(self::ENVELOPES_NAMESPACE, $store);
}
public function remove($envelopes)
{
$envelopes = is_array($envelopes) ? $envelopes : func_get_args();
$map = UuidStamp::indexByUuid($envelopes);
$store = array_filter($this->all(), function (Envelope $envelope) use ($map) {
$uuid = $envelope->get('Flasher\Prime\Stamp\UuidStamp')->getUuid();
return !isset($map[$uuid]);
});
$this->session->put(self::ENVELOPES_NAMESPACE, $store);
}
public function clear()
{
$this->session->put(self::ENVELOPES_NAMESPACE, array());
}
}
-26
View File
@@ -1,26 +0,0 @@
<?php
namespace Flasher\Laravel\Template;
use Flasher\Prime\Template\EngineInterface;
final class BladeEngine implements EngineInterface
{
/**
* @var
*/
private $engine;
/**
* @param $engine
*/
public function __construct($engine)
{
$this->engine = $engine;
}
public function render($name, array $context = array())
{
return (string) $this->engine->make($name, $context);
}
}
-23
View File
@@ -1,23 +0,0 @@
<?php
namespace Flasher\Laravel\Tests\Config;
use Flasher\Laravel\Config\Config;
use Flasher\Laravel\Tests\TestCase;
use Illuminate\Foundation\Application;
final class ConfigTest extends TestCase
{
public function testSimpleConfig()
{
$separator = $this->isLaravel4() ? '::' : '.';
$config = new Config($this->app->make('config'), $separator);
$this->assertEquals('template', $config->get('default'));
}
private function isLaravel4()
{
return 0 === strpos(Application::VERSION, '4.');
}
}
@@ -1,45 +0,0 @@
<?php
namespace Flasher\Laravel\Tests;
use Illuminate\View\Compilers\BladeCompiler;
final class FlasherServiceProviderTest extends TestCase
{
public function testNotifyServiceExists()
{
$this->assertInstanceOf('Flasher\Laravel\Config\Config', $this->app->make('flasher.config'));
$this->assertInstanceOf('Flasher\Prime\Flasher', $this->app->make('flasher'));
$this->assertInstanceOf('Flasher\Prime\Response\ResponseManager', $this->app->make('flasher.response_manager'));
$this->assertInstanceOf(
'Flasher\Prime\Response\Resource\ResourceManager',
$this->app->make('flasher.resource_manager')
);
$this->assertInstanceOf('Flasher\Laravel\Storage\Storage', $this->app->make('flasher.storage'));
$this->assertInstanceOf('Flasher\Prime\Storage\StorageManager', $this->app->make('flasher.storage_manager'));
$this->assertInstanceOf(
'Flasher\Prime\EventDispatcher\EventDispatcher',
$this->app->make('flasher.event_dispatcher')
);
$this->assertInstanceOf('Flasher\Prime\Filter\Filter', $this->app->make('flasher.filter'));
}
public function testBladeDirective()
{
/** @var BladeCompiler $blade */
$blade = $this->app->make('view')->getEngineResolver()->resolve('blade')->getCompiler();
$this->assertEquals(
"<?php echo app('flasher.response_manager')->render(); ?>",
$blade->compileString('@flasher_render()')
);
$this->assertEquals(
"<?php echo app('flasher.response_manager')->render(array()); ?>",
$blade->compileString('@flasher_render(array())')
);
$this->assertEquals(
"<?php echo app('flasher.response_manager')->render(array(\"priority\" => array(\"min\" => 4, \"max\" => 5))); ?>",
$blade->compileString('@flasher_render(array("priority" => array("min" => 4, "max" => 5)))')
);
}
}
-122
View File
@@ -1,122 +0,0 @@
<?php
namespace Flasher\Laravel\Tests\Storage;
use Flasher\Laravel\Storage\Storage;
use Flasher\Laravel\Tests\TestCase;
use Flasher\Prime\Envelope;
use Flasher\Prime\Notification\Notification;
use Flasher\Prime\Stamp\PriorityStamp;
use Flasher\Prime\Stamp\UuidStamp;
final class StorageTest extends TestCase
{
public function testInitialState()
{
$storage = new Storage($this->app->make('session'));
$this->assertEquals(array(), $storage->all());
}
public function testAddEnvelope()
{
$storage = new Storage($this->app->make('session'));
$envelope = new Envelope(new Notification());
$storage->add($envelope);
$this->assertEquals(array($envelope), $storage->all());
}
public function testAddMultipleEnvelopes()
{
$storage = new Storage($this->app->make('session'));
$envelopes = array(
new Envelope(new Notification()),
new Envelope(new Notification()),
);
$storage->add($envelopes);
$this->assertEquals($envelopes, $storage->all());
}
public function testUpdateEnvelopes()
{
$storage = new Storage($this->app->make('session'));
$envelopes = array(
new Envelope(new Notification(), array(
new UuidStamp(),
)),
new Envelope(new Notification(), array(
new UuidStamp(),
)),
);
$storage->add($envelopes);
$this->assertEquals($envelopes, $storage->all());
$envelopes[1]->withStamp(new PriorityStamp(1));
$storage->update($envelopes[1]);
$this->assertEquals($envelopes, $storage->all());
$this->assertInstanceOf(
'Flasher\Prime\Stamp\PriorityStamp',
$envelopes[1]->get('Flasher\Prime\Stamp\PriorityStamp')
);
}
public function testRemoveEnvelopes()
{
$storage = new Storage($this->app->make('session'));
$envelopes = array(
new Envelope(new Notification(), array(
new UuidStamp(),
)),
new Envelope(new Notification(), array(
new UuidStamp(),
)),
);
$storage->add($envelopes);
$this->assertEquals($envelopes, $storage->all());
$storage->remove($envelopes[1]);
$this->assertEquals(array($envelopes[0]), $storage->all());
}
public function testRemoveMultipleEnvelopes()
{
$storage = new Storage($this->app->make('session'));
$envelopes = array(
new Envelope(new Notification(), array(
new UuidStamp(),
)),
new Envelope(new Notification(), array(
new UuidStamp(),
)),
);
$storage->add($envelopes);
$this->assertEquals($envelopes, $storage->all());
$storage->remove($envelopes);
$this->assertEquals(array(), $storage->all());
}
public function testClearAllEnvelopes()
{
$storage = new Storage($this->app->make('session'));
$envelopes = array(
new Envelope(new Notification(), array(
new UuidStamp(),
)),
new Envelope(new Notification(), array(
new UuidStamp(),
)),
);
$storage->add($envelopes);
$this->assertEquals($envelopes, $storage->all());
$storage->clear();
$this->assertEquals(array(), $storage->all());
}
}
-29
View File
@@ -1,29 +0,0 @@
<?php
namespace Flasher\Laravel\Tests;
use Illuminate\Foundation\Application;
use Orchestra\Testbench\TestCase as Orchestra;
class TestCase extends Orchestra
{
/**
* @param $app
*
* @return array
*/
protected function getPackageProviders($app = null)
{
return array(
'Flasher\Laravel\FlasherServiceProvider',
);
}
/**
* @param Application $app
*/
protected function getEnvironmentSetUp($app)
{
$app['config']->set('session.driver', 'array');
}
}
View File
-70
View File
@@ -1,70 +0,0 @@
{
"name": "php-flasher/flasher-laravel",
"description": "Laravel package integrating PHP Flasher into Laravel applications",
"keywords": [
"yoeunes",
"notify",
"flasher",
"php",
"laravel",
"symfony",
"Lumen",
"notifications",
"messages",
"alerts",
"pnotify",
"toastr ",
"bundle",
"flex"
],
"homepage": "https://php-flasher.github.io/",
"authors": [
{
"name": "Younes Khoubza",
"email": "younes.khoubza@gmail.com",
"homepage": "https://github.com/yoeunes",
"role": "Developer"
}
],
"license": "MIT",
"require": {
"php": ">=5.3",
"illuminate/support": "^4.0|^5.0|^6.0|^7.0|^8.0",
"php-flasher/flasher": "^0.4"
},
"require-dev": {
"phpunit/phpunit": "^4.8|^5.0|^6.0|^7.0|^8.0|^9.0",
"orchestra/testbench": "^2.0|^3.0|^4.0|^5.0|^6.0"
},
"autoload": {
"psr-4": {
"Flasher\\Laravel\\": ""
},
"exclude-from-classmap": [
"/Tests/"
],
"files": [
"helpers.php"
]
},
"autoload-dev": {
"psr-4": {
"Flasher\\Laravel\\Tests\\": "Tests/"
}
},
"extra": {
"laravel": {
"providers": [
"Flasher\\Laravel\\FlasherServiceProvider"
],
"aliases": {
"Noty": "Flasher\\Noty\\Laravel\\Facade\\Noty"
}
}
},
"config": {
"sort-packages": true
},
"minimum-stability": "dev",
"prefer-stable": true
}
-19
View File
@@ -1,19 +0,0 @@
<?php
if (!function_exists('flasher')) {
/**
* @param string $message
* @param string $type
* @param string $title
*
* @return \Flasher\Prime\Flasher
*/
function flasher($message = null, $type = 'success', $title = '', array $options = array(), array $stamps = array())
{
if (null === $message && 0 === func_num_args()) {
return app('flasher.factory');
}
return app('flasher.factory')->render($type, $message, $title, $options, $stamps);
}
}
-22
View File
@@ -1,22 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit bootstrap="vendor/autoload.php"
backupGlobals="false"
backupStaticAttributes="false"
colors="true"
verbose="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="true">
<testsuites>
<testsuite name="Flasher Test Suite">
<directory>Tests</directory>
</testsuite>
</testsuites>
<filter>
<whitelist>
<directory suffix=".php">./</directory>
</whitelist>
</filter>
</phpunit>
-13
View File
@@ -1,13 +0,0 @@
# Path-based git attributes
# https://www.kernel.org/pub/software/scm/git/docs/gitattributes.html
# Ignore all test and documentation with "export-ignore".
/.gitattributes export-ignore
/.gitignore export-ignore
/.travis.yml export-ignore
/phpunit.xml.dist export-ignore
/.scrutinizer.yml export-ignore
/.styleci.yml export-ignore
/tests export-ignore
/.editorconfig export-ignore
-6
View File
@@ -1,6 +0,0 @@
# These are supported funding model platforms
patreon: yoeunes
ko_fi: yoeunes
open_collective: php-flasher
custom: ['https://www.paypal.com/paypalme/yoeunes']
-7
View File
@@ -1,7 +0,0 @@
version: 2
updates:
- package-ecosystem: composer
directory: "/"
schedule:
interval: daily
open-pull-requests-limit: 10
-118
View File
@@ -1,118 +0,0 @@
name: Running tests
on:
push:
pull_request:
schedule:
- cron: '* * * * *'
jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
laravel: [8.*, 7.*, 6.*, 5.8.*, 5.7.*, 5.6.*, 5.5.*, 5.4.*, 5.3.*, 5.2.*, 5.1.*, 5.0.*, 4.2.*, 4.1.*, 4.0.*]
include:
- laravel: 8.*
testbench: 6.*
php: 7.3
phpunit: 9.3.*
- laravel: 7.*
testbench: 5.*
php: 7.3
phpunit: 8.4.*
- laravel: 6.*
testbench: 4.*
php: 7.2
phpunit: 8.3.*
- laravel: 5.8.*
testbench: 3.8.*
php: 7.1
phpunit: 7.5.*
- laravel: 5.7.*
testbench: 3.7.*
php: 7.1
phpunit: 7.0.*
- laravel: 5.6.*
testbench: 3.6.*
php: 7.1
phpunit: 7.0.*
- laravel: 5.5.*
testbench: 3.5.*
php: 7.0
phpunit: 6.0.*
- laravel: 5.4.*
testbench: 3.4.*
php: 5.6
phpunit: 5.7.*
- laravel: 5.3.*
testbench: 3.3.*
php: 5.6
phpunit: 4.8.*
- laravel: 5.2.*
testbench: 3.2.*
php: 5.5
phpunit: 4.8.*
- laravel: 5.1.*
testbench: 3.1.*
php: 5.5
phpunit: 4.8.*
- laravel: 5.0.*
testbench: 3.0.*
php: 5.4
phpunit: 4.8.*
- laravel: 4.2.*
testbench: 2.2.*
php: 5.4
phpunit: 4.8.*
- laravel: 4.1.*
testbench: 2.1.*
php: 5.4
phpunit: 4.8.*
- laravel: 4.0.*
testbench: 2.0.*
php: 5.4
phpunit: 4.8.*
name: L${{ matrix.laravel }} - P${{ matrix.php }}
steps:
- name: Checkout code
uses: actions/checkout@v1
- name: Cache dependencies
uses: actions/cache@v1
with:
path: ~/.composer/cache/files
key: dependencies-laravel-${{ matrix.laravel }}-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick
# ini-values: memory_limit=-1
coverage: none
- name: Install dependencies
run: |
composer require "laravel/framework:${{ matrix.laravel }}" "phpunit/phpunit:${{ matrix.phpunit }}" "orchestra/testbench:${{ matrix.testbench }}" monolog/monolog --no-interaction --no-update
composer update --prefer-dist --no-interaction --no-suggest
- name: Execute tests
run: vendor/bin/phpunit
-5
View File
@@ -1,5 +0,0 @@
.idea
vendor
composer.lock
.phpunit.result.cache
.phpcs-cache
-7
View File
@@ -1,7 +0,0 @@
<?php
namespace PHPSTORM_META;
use Flasher\Prime\Notification\NotificationInterface;
expectedArguments(\noty(), 1, 'success', 'error', 'info', 'warning');
View File
-61
View File
@@ -1,61 +0,0 @@
<?php
namespace Flasher\Noty\Laravel\Facade;
use Flasher\Noty\Prime\NotyBuilder;
use Flasher\Prime\Envelope;
use Flasher\Prime\Notification\NotificationInterface;
use Flasher\Prime\Stamp\StampInterface;
use Illuminate\Support\Facades\Facade;
/**
* @method static NotyBuilder addSuccess(string $message, array $options = array())
* @method static NotyBuilder addError(string $message, array $options = array())
* @method static NotyBuilder addWarning(string $message, array $options = array())
* @method static NotyBuilder addInfo(string $message, array $options = array())
* @method static NotyBuilder addFlash(string|NotificationInterface $type, string $message = null, array $options = array())
* @method static NotyBuilder flash(StampInterface[] $stamps = array())
* @method static NotyBuilder type(string $type, string $message = null, array $options = array())
* @method static NotyBuilder message(string $message)
* @method static NotyBuilder options(array $options, bool $merge = true)
* @method static NotyBuilder option(string $name, string $value)
* @method static NotyBuilder success(string $message = null, array $options = array())
* @method static NotyBuilder error(string $message = null, array $options = array())
* @method static NotyBuilder info(string $message = null, array $options = array())
* @method static NotyBuilder warning(string $message = null, array $options = array())
* @method static NotyBuilder priority(int $priority)
* @method static NotyBuilder hops(int $amount)
* @method static NotyBuilder keep()
* @method static NotyBuilder delay(int $delay)
* @method static NotyBuilder now()
* @method static NotyBuilder with(StampInterface[] $stamps = array())
* @method static NotyBuilder withStamp(StampInterface $stamp)
* @method static NotyBuilder handler(string $handler)
* @method static Envelope getEnvelope()
*
* @method static NotyBuilder text(string $text)
* @method static NotyBuilder alert(string $message = null, array $options = array())
* @method static NotyBuilder layout(string $layout)
* @method static NotyBuilder theme(string $theme)
* @method static NotyBuilder timeout(int|bool $timeout)
* @method static NotyBuilder progressBar(bool $progressBar = false)
* @method static NotyBuilder closeWith(string|array $closeWith)
* @method static NotyBuilder animation(string $animation, string $effect)
* @method static NotyBuilder sounds(string $option, mixed $value)
* @method static NotyBuilder docTitle(string $option, mixed $docTitle)
* @method static NotyBuilder modal(bool $modal = true)
* @method static NotyBuilder id(bool|string $id)
* @method static NotyBuilder force(bool $force = true)
* @method static NotyBuilder queue(string $queue)
* @method static NotyBuilder killer(bool|string $killer)
* @method static NotyBuilder container(bool|string $container)
* @method static NotyBuilder buttons(array $buttons)
* @method static NotyBuilder visibilityControl(bool $visibilityControl)
*/
class Noty extends Facade
{
protected static function getFacadeAccessor()
{
return 'flasher.noty';
}
}
@@ -1,55 +0,0 @@
<?php
namespace Flasher\Noty\Laravel;
use Flasher\Noty\Laravel\ServiceProvider\ServiceProviderManager;
use Illuminate\Container\Container;
use Illuminate\Support\ServiceProvider;
final class FlasherNotyServiceProvider extends ServiceProvider
{
public function boot()
{
$manager = new ServiceProviderManager($this);
$manager->boot();
}
/**
* Register the service provider.
*/
public function register()
{
$manager = new ServiceProviderManager($this);
$manager->register();
}
/**
* Get the services provided by the provider.
*
* @return string[]
*/
public function provides()
{
return array(
'flasher.noty',
);
}
/**
* @return Container
*/
public function getApplication()
{
return $this->app;
}
public function mergeConfigFrom($path, $key)
{
parent::mergeConfigFrom($path, $key);
}
public function publishes(array $paths, $groups = null)
{
parent::publishes($paths, $groups);
}
}
-87
View File
@@ -1,87 +0,0 @@
<p align="center"><img width="600" alt="flasher" src="https://user-images.githubusercontent.com/10859693/102468596-03317180-4052-11eb-9df3-44dc6235b238.png"></p>
<h1 align="center">A powerful and flexible flash notifications system for PHP, Laravel, Symfony</h1>
<p align="center">
:eyes: PHP Flasher helps you to add flash notifications to your PHP projects.
This library was developed with the idea that you should be able to add flash notification to your application with ease and with few lines of code.
No application-wide rewrites and no big investments upfront.
</p>
<p align="center">
<a href="https://github.com/php-flasher/flasher">
<img src="https://img.shields.io/badge/source-php--flasher/flasher-blue.svg?style=flat-square">
</a>
<a href="https://github.com/php-flasher/flasher/releases">
<img src="https://img.shields.io/github/tag/php-flasher/flasher.svg">
</a>
<a href="https://github.com/php-flasher/flasher/blob/master/LICENSE">
<img src="https://img.shields.io/badge/license-MIT-brightgreen.svg">
</a>
<a href="https://packagist.org/packages/php-flasher/flasher">
<img src="https://img.shields.io/packagist/dt/php-flasher/flasher.svg">
</a>
<a href="https://packagist.org/packages/php-flasher/flasher">
<img src="https://img.shields.io/packagist/php-v/php-flasher/flasher.svg?style=flat-square">
</a>
<a href="https://opencollective.com/php-flasher">
<img src="https://opencollective.com/php-flasher/tiers/backer/badge.svg?label=backer&color=brightgreen" />
</a>
<a href="https://opencollective.com/php-flasher">
<img src="https://opencollective.com/php-flasher/tiers/sponsor/badge.svg?label=sponsor&color=brightgreen" />
</a>
</p>
# Why use PHP Flasher ?
The PHP Flasher project supports many notification libraries : __tailwindcss__, __bootstrap__, __toastr.js__, __sweet alert 2__, __pnotify__, __noty__, and __notyf__
and its highly extendable so you can add your custom notifications.
This library is designed, so you can take full control when creating you notifications :
> * Display multiple notifications
> * Sort and filter notifications
> * Render notification from JSON object
> * Limit the number of displayed notifications
> * Show notifications from different libraries at the same time
> * Framework angostic with integration for : Symfony and Laravel
> * Support templates
> * Easy migration from similar libraries.
> * Very flexible so you can add you own adapters
> * ...and more
## Official Documentation
Documentation for PHP Flasher can be found on the [PHP Flasher website](https://php-flasher.github.io/).
## Backers && Sponsors
Support this project by becoming a sponsor. Your name will show up in the Contribute page of all PHP Flasher installations as well as here with a link to your website!
Thank you to all our backers and sponsors! 🙏
<a href="https://opencollective.com/php-flasher#backers" target="_blank">
<img src="https://opencollective.com/php-flasher/backers.svg?width=890" title="Backers" alt="Backers">
</a>
<a href="https://opencollective.com/php-flasher#sponsors" target="_blank">
<img src="https://opencollective.com/php-flasher/sponsors.svg?width=890" title="Sponsors" alt="Sponsors">
</a>
### Contact
PHP Flasher 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/flasher/issues)
- [Github](https://github.com/yoeunes)
- [Twitter](https://twitter.com/yoeunes)
- [Linkedin](https://www.linkedin.com/in/younes-khoubza/)
- [Email me directly](mailto:younes.khoubza@gmail.com)
## License
PHP Flasher 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-khoubza/">Younes KHOUBZA</a> <b> </p>
@@ -1,11 +0,0 @@
<?php
return array(
'scripts' => array(
'https://cdn.jsdelivr.net/npm/@flasher/flasher-noty@0.1.3/dist/flasher-noty.min.js',
),
'styles' => array(),
'options' => array(
'timeout' => 5000,
),
);
@@ -1,21 +0,0 @@
<?php
use Flasher\Prime\Notification\NotificationInterface;
use Illuminate\Support\Facades\App;
if (!function_exists('noty')) {
/**
* @param string $message
* @param string $type
*
* @return \Flasher\Noty\Prime\NotyFactory
*/
function noty($message = null, $type = NotificationInterface::TYPE_SUCCESS, array $options = array())
{
if (null === $message) {
return App::make('flasher.noty');
}
return App::make('flasher.noty')->addFlash($type, $message, $options);
}
}
@@ -1,74 +0,0 @@
<?php
namespace Flasher\Noty\Laravel\ServiceProvider\Providers;
use Flasher\Laravel\ServiceProvider\ResourceManagerHelper;
use Flasher\Noty\Laravel\FlasherNotyServiceProvider;
use Flasher\Noty\Prime\NotyFactory;
use Flasher\Prime\Flasher;
use Flasher\Prime\Response\Resource\ResourceManager;
use Illuminate\Container\Container;
use Illuminate\Foundation\Application;
class Laravel implements ServiceProviderInterface
{
/**
* @var Container
*/
protected $app;
public function __construct(Container $app)
{
$this->app = $app;
}
public function shouldBeUsed()
{
return $this->app instanceof Application;
}
public function boot(FlasherNotyServiceProvider $provider)
{
$provider->publishes(array(
flasher_path(__DIR__ . '/../../Resources/config/config.php') => config_path('flasher_noty.php'),
), 'flasher-config');
}
public function register(FlasherNotyServiceProvider $provider)
{
$provider->mergeConfigFrom(flasher_path(__DIR__ . '/../../Resources/config/config.php'), 'flasher_noty');
$this->appendToFlasherConfig();
$this->registerServices();
}
protected function registerServices()
{
$this->app->singleton('flasher.noty', function (Container $app) {
return new NotyFactory($app['flasher.storage_manager']);
});
$this->app->alias('flasher.noty', 'Flasher\Noty\Prime\NotyFactory');
$this->app->extend('flasher', function (Flasher $flasher, Container $app) {
$flasher->addFactory('noty', $app['flasher.noty']);
return $flasher;
});
$this->app->extend('flasher.resource_manager', function (ResourceManager $resourceManager) {
ResourceManagerHelper::process($resourceManager, 'noty');
return $resourceManager;
});
}
protected function appendToFlasherConfig()
{
$flasherConfig = $this->app['config']->get('flasher.adapters.noty', array());
$notyConfig = $this->app['config']->get('flasher_noty', array());
$this->app['config']->set('flasher.adapters.noty', array_merge($notyConfig, $flasherConfig));
}
}
@@ -1,38 +0,0 @@
<?php
namespace Flasher\Noty\Laravel\ServiceProvider\Providers;
use Flasher\Noty\Laravel\FlasherNotyServiceProvider;
use Illuminate\Foundation\Application;
final class Laravel4 extends Laravel
{
public function shouldBeUsed()
{
return $this->app instanceof Application && 0 === strpos(Application::VERSION, '4.');
}
public function boot(FlasherNotyServiceProvider $provider)
{
$provider->package(
'php-flasher/flasher-noty-laravel',
'flasher_noty',
flasher_path(__DIR__ . '/../../Resources')
);
$this->appendToFlasherConfig();
}
public function register(FlasherNotyServiceProvider $provider)
{
$this->registerServices();
}
protected function appendToFlasherConfig()
{
$flasherConfig = $this->app['config']->get('flasher::config.adapters.noty', array());
$notyConfig = $this->app['config']->get('flasher_noty::config', array());
$this->app['config']->set('flasher::config.adapters.noty', array_merge($notyConfig, $flasherConfig));
}
}
@@ -1,17 +0,0 @@
<?php
namespace Flasher\Noty\Laravel\ServiceProvider\Providers;
use Flasher\Noty\Laravel\FlasherNotyServiceProvider;
interface ServiceProviderInterface
{
/**
* @return bool
*/
public function shouldBeUsed();
public function boot(FlasherNotyServiceProvider $provider);
public function register(FlasherNotyServiceProvider $provider);
}
@@ -1,58 +0,0 @@
<?php
namespace Flasher\Noty\Laravel\ServiceProvider;
use Flasher\Noty\Laravel\FlasherNotyServiceProvider;
use Flasher\Noty\Laravel\ServiceProvider\Providers\ServiceProviderInterface;
final class ServiceProviderManager
{
private $provider;
/**
* @var ServiceProviderInterface[]
*/
private $providers = array(
'Flasher\Noty\Laravel\ServiceProvider\Providers\Laravel4',
'Flasher\Noty\Laravel\ServiceProvider\Providers\Laravel',
);
private $notifyServiceProvider;
public function __construct(FlasherNotyServiceProvider $notifyServiceProvider)
{
$this->notifyServiceProvider = $notifyServiceProvider;
}
public function boot()
{
$provider = $this->resolveServiceProvider();
$provider->boot($this->notifyServiceProvider);
}
public function register()
{
$provider = $this->resolveServiceProvider();
$provider->register($this->notifyServiceProvider);
}
/**
* @return ServiceProviderInterface
*/
private function resolveServiceProvider()
{
if ($this->provider instanceof ServiceProviderInterface) {
return $this->provider;
}
foreach ($this->providers as $providerClass) {
$provider = new $providerClass($this->notifyServiceProvider->getApplication());
if ($provider->shouldBeUsed()) {
return $this->provider = $provider;
}
}
throw new \InvalidArgumentException('Service Provider not found.');
}
}
@@ -1,20 +0,0 @@
<?php
namespace Flasher\Noty\Laravel\Tests;
class FlasherNotyServiceProviderTest extends TestCase
{
public function testContainerContainNotifyServices()
{
$this->assertTrue($this->app->bound('flasher.noty'));
$this->assertInstanceOf('Flasher\Noty\Prime\NotyFactory', $this->app->make('flasher.noty'));
}
public function testNotifyFactoryIsAddedToExtensionsArray()
{
$flasher = $this->app->make('flasher');
$adapter = $flasher->create('noty');
$this->assertInstanceOf('Flasher\Noty\Prime\NotyFactory', $adapter);
}
}
-87
View File
@@ -1,87 +0,0 @@
<?php
namespace Flasher\Noty\Laravel\Tests;
use Illuminate\Config\Repository as Config;
use Illuminate\Foundation\AliasLoader;
use Illuminate\Foundation\Application;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Facade;
use Orchestra\Testbench\TestCase as Orchestra;
class TestCase extends Orchestra
{
public function createApplication()
{
if (0 !== strpos(Application::VERSION, '4.0')) {
return parent::createApplication();
}
$app = new Application();
$app->detectEnvironment(array(
'local' => array('your-machine-name'),
));
$app->bindInstallPaths($this->getApplicationPaths());
$app['env'] = 'testing';
$app->instance('app', $app);
Facade::clearResolvedInstances();
Facade::setFacadeApplication($app);
$config = new Config($app->getConfigLoader(), $app['env']);
$app->instance('config', $config);
$app->startExceptionHandling();
if ($app->runningInConsole()) {
$app->setRequestForConsoleEnvironment();
}
date_default_timezone_set($this->getApplicationTimezone());
$aliases = array_merge($this->getApplicationAliases(), $this->getPackageAliases());
AliasLoader::getInstance($aliases)->register();
Request::enableHttpMethodParameterOverride();
$providers = array_merge($this->getApplicationProviders(), $this->getPackageProviders());
$app->getProviderRepository()->load($app, $providers);
$this->getEnvironmentSetUp($app);
$app->boot();
return $app;
}
/**
* @param Application $app
*
* @return array
*/
protected function getPackageProviders($app = null)
{
return array(
'Flasher\Laravel\FlasherServiceProvider',
'Flasher\Noty\Laravel\FlasherNotyServiceProvider',
);
}
/**
* @param Application $app
*/
protected function getEnvironmentSetUp($app)
{
$separator = $this->isLaravel4() ? '::config' : '';
$app['config']->set('session' . $separator . '.driver', 'array');
}
private function isLaravel4()
{
return 0 === strpos(Application::VERSION, '4.');
}
}
View File
-69
View File
@@ -1,69 +0,0 @@
{
"name": "php-flasher/flasher-noty-laravel",
"description": "PHP Flasher Laravel adapter for Noty",
"keywords": [
"yoeunes",
"notify",
"php",
"laravel",
"symfony",
"Lumen",
"notifications",
"messages",
"alerts",
"pnotify",
"noty ",
"bundle",
"flex"
],
"homepage": "https://php-flasher.github.io/",
"authors": [
{
"name": "Younes Khoubza",
"email": "younes.khoubza@gmail.com",
"homepage": "https://github.com/yoeunes",
"role": "Developer"
}
],
"license": "MIT",
"require": {
"php": ">=5.3",
"php-flasher/flasher-laravel": "^0.4",
"php-flasher/flasher-noty": "^0.4"
},
"require-dev": {
"phpunit/phpunit": "^4.8|^5.0|^6.0|^7.0|^8.0|^9.0",
"orchestra/testbench": "^2.0|^3.0|^4.0|^5.0|^6.0"
},
"autoload": {
"psr-4": {
"Flasher\\Noty\\Laravel\\": ""
},
"files": [
"Resources/functions/noty.php"
],
"exclude-from-classmap": [
"/Tests/"
]
},
"autoload-dev": {
"psr-4": {
"Flasher\\Noty\\Laravel\\Tests\\": "Tests/"
}
},
"extra": {
"laravel": {
"providers": [
"Flasher\\Noty\\Laravel\\FlasherNotyServiceProvider"
],
"aliases": {
"Noty": "Flasher\\Laravel\\Facade\\Flasher"
}
}
},
"config": {
"sort-packages": true
},
"minimum-stability": "dev",
"prefer-stable": true
}
-22
View File
@@ -1,22 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit bootstrap="vendor/autoload.php"
backupGlobals="false"
backupStaticAttributes="false"
colors="true"
verbose="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="true">
<testsuites>
<testsuite name="Flasher Test Suite">
<directory>Tests</directory>
</testsuite>
</testsuites>
<filter>
<whitelist>
<directory suffix=".php">./</directory>
</whitelist>
</filter>
</phpunit>
-15
View File
@@ -1,15 +0,0 @@
; This file is for unifying the coding style for different editors and IDEs.
; More information at http://editorconfig.org
root = true
[*]
charset = utf-8
indent_size = 4
indent_style = space
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
[*.md]
trim_trailing_whitespace = false
-13
View File
@@ -1,13 +0,0 @@
# Path-based git attributes
# https://www.kernel.org/pub/software/scm/git/docs/gitattributes.html
# Ignore all test and documentation with "export-ignore".
/.gitattributes export-ignore
/.gitignore export-ignore
/.travis.yml export-ignore
/phpunit.xml.dist export-ignore
/.scrutinizer.yml export-ignore
/.styleci.yml export-ignore
/tests export-ignore
/.editorconfig export-ignore
-6
View File
@@ -1,6 +0,0 @@
# These are supported funding model platforms
patreon: yoeunes
ko_fi: yoeunes
open_collective: php-flasher
custom: ['https://www.paypal.com/paypalme/yoeunes']
-7
View File
@@ -1,7 +0,0 @@
version: 2
updates:
- package-ecosystem: composer
directory: "/"
schedule:
interval: daily
open-pull-requests-limit: 10
-51
View File
@@ -1,51 +0,0 @@
name: Running tests
on:
push:
pull_request:
schedule:
- cron: '* * * * *'
jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
php: [ 8.0, 7.4, 7.3, 7.2, 7.1, 7.0, 5.6, 5.5, 5.4 ]
name: php ${{ matrix.php }} - ${{ matrix.dependency-version }}
steps:
- name: Checkout code
uses: actions/checkout@v1
- name: Cache dependencies
uses: actions/cache@v1
with:
path: ~/.composer/cache/files
key: php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: none
- name: Require phpunit 4.8 for php <= 5.6
if: matrix.php <= 5.6
run: composer require "phpunit/phpunit:4.8.36" --no-interaction --no-update
- name: Require phpunit 6 for php >= 7.0
if: matrix.php >= 7.0
run: composer require "phpunit/phpunit:6.*" --no-interaction --no-update
- name: Require phpunit 9 for php >= 7.3
if: matrix.php >= 7.3
run: composer require "phpunit/phpunit:9.*" --no-interaction --no-update
- name: Install dependencies
run: composer update --prefer-dist --no-interaction --no-suggest
- name: Execute tests
run: vendor/bin/phpunit
-5
View File
@@ -1,5 +0,0 @@
.idea
vendor
composer.lock
.phpunit.result.cache
.phpcs-cache
-12
View File
@@ -1,12 +0,0 @@
<?php
namespace PHPSTORM_META;
expectedArguments(\Flasher\Noty\Prime\NotyBuilder::layout(), 0, 'top', 'topLeft', 'topCenter', 'topRight', 'center', 'centerLeft', 'centerRight', 'bottom', 'bottomLeft', 'bottomCenter', 'bottomRight');
expectedArguments(\Flasher\Noty\Prime\NotyBuilder::theme(), 0, 'relax', 'mint', 'metroui');
expectedArguments(\Flasher\Noty\Prime\NotyBuilder::timeout(), 0, false, 1000, 3000, 3500, 5000);
expectedArguments(\Flasher\Noty\Prime\NotyBuilder::closeWith(), 0, 'click', 'button', array('click', 'button'));
expectedArguments(\Flasher\Noty\Prime\NotyBuilder::animation(), 0, 'open', 'close');
expectedArguments(\Flasher\Noty\Prime\NotyBuilder::sounds(), 0, 'sources', 'volume', 'conditions');
expectedArguments(\Flasher\Noty\Prime\NotyBuilder::docTitle(), 0, 'conditions');
expectedArguments(\Flasher\Noty\Prime\NotyBuilder::queue(), 0, 'global');
View File
-9
View File
@@ -1,9 +0,0 @@
<?php
namespace Flasher\Noty\Prime;
use Flasher\Prime\Notification\Notification;
final class Noty extends Notification
{
}
-252
View File
@@ -1,252 +0,0 @@
<?php
namespace Flasher\Noty\Prime;
use Flasher\Prime\Notification\NotificationBuilder;
final class NotyBuilder extends NotificationBuilder
{
/**
* This string can contain HTML too. But be careful and don't pass user inputs to this parameter.
*
* @param string $text
*
* @return NotyBuilder
*/
public function text($text)
{
return $this->message($text);
}
/**
* @param string $message
*
* @return NotyBuilder
*/
public function alert($message = null, array $options = array())
{
return $this->type('alert', $message, $options);
}
/**
* top, topLeft, topCenter, topRight, center, centerLeft, centerRight, bottom, bottomLeft, bottomCenter, bottomRight
* - ClassName generator uses this value → noty_layout__${layout}
*
* @param string $layout
*
* @return $this
*/
public function layout($layout)
{
$this->option('layout', $layout);
return $this;
}
/**
* relax, mint, metroui - ClassName generator uses this value → noty_theme__${theme}
*
* @param string $theme
*
* @return $this
*/
public function theme($theme)
{
$this->option('theme', $theme);
return $this;
}
/**
* false, 1000, 3000, 3500, etc. Delay for closing event in milliseconds (ms). Set 'false' for sticky notifications.
*
* @param int|bool $timeout
*
* @return $this
*/
public function timeout($timeout)
{
$this->option('timeout', $timeout);
return $this;
}
/**
* true, false - Displays a progress bar if timeout is not false.
*
* @param bool $progressBar
*
* @return $this
*/
public function progressBar($progressBar = false)
{
$this->option('progressBar', $progressBar);
return $this;
}
/**
* click, button
*
* @param string|array $closeWith
*
* @return $this
*/
public function closeWith($closeWith)
{
$this->option('closeWith', (array) $closeWith);
return $this;
}
/**
* 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.
*
* @param string $animation
* @param string $effect
*
* @return $this
*/
public function animation($animation, $effect)
{
$this->option('animation.' . $animation, $effect);
return $this;
}
/**
* @param string $option
* @param mixed $value
*
* @return $this
*/
public function sounds($option, $value)
{
$this->option('sounds.' . $option, $value);
return $this;
}
/**
* @param string $option
* @param mixed $docTitle
*
* @return $this
*/
public function docTitle($option, $docTitle)
{
$this->option('docTitle' . $option, $docTitle);
return $this;
}
/**
* @param bool $modal
*
* @return $this
*/
public function modal($modal = true)
{
$this->option('modal', $modal);
return $this;
}
/**
* You can use this id with querySelectors. Generated automatically if false.
*
* @param bool|string $id
*
* @return $this
*/
public function id($id)
{
$this->option('id', $id);
return $this;
}
/**
* DOM insert method depends on this parameter. If false uses append, if true uses prepend.
*
* @param bool $force
*
* @return $this
*/
public function force($force = true)
{
$this->option('force', $force);
return $this;
}
/**
* @param string $queue
*
* @return $this
*/
public function queue($queue)
{
$this->option('queue', $queue);
return $this;
}
/**
* If true closes all visible notifications and shows itself. If string(queueName) closes all visible notification
* on this queue and shows itself.
*
* @param string|bool $killer
*
* @return $this
*/
public function killer($killer)
{
$this->option('killer', $killer);
return $this;
}
/**
* Custom container selector string. Like '.my-custom-container'. Layout parameter will be ignored.
*
* @param string|bool $container
*
* @return $this
*/
public function container($container)
{
$this->option('container', $container);
return $this;
}
/**
* An array of Noty.button, for creating confirmation dialogs.
*
* @param array $buttons
*
* @return $this
*/
public function buttons($buttons)
{
$this->option('buttons', $buttons);
return $this;
}
/**
* If true Noty uses PageVisibility API to handle timeout. To ensure that users do not miss their notifications.
*
* @param bool $visibilityControl
*
* @return $this
*/
public function visibilityControl($visibilityControl)
{
$this->option('visibilityControl', $visibilityControl);
return $this;
}
}
-16
View File
@@ -1,16 +0,0 @@
<?php
namespace Flasher\Noty\Prime;
use Flasher\Prime\Factory\NotificationFactory;
/**
* @mixin NotyBuilder
*/
final class NotyFactory extends NotificationFactory
{
public function createNotificationBuilder()
{
return new NotyBuilder($this->getStorageManager(), new Noty(), 'noty');
}
}
-87
View File
@@ -1,87 +0,0 @@
<p align="center"><img width="600" alt="flasher" src="https://user-images.githubusercontent.com/10859693/102468596-03317180-4052-11eb-9df3-44dc6235b238.png"></p>
<h1 align="center">A powerful and flexible flash notifications system for PHP, Laravel, Symfony</h1>
<p align="center">
:eyes: PHP Flasher helps you to add flash notifications to your PHP projects.
This library was developed with the idea that you should be able to add flash notification to your application with ease and with few lines of code.
No application-wide rewrites and no big investments upfront.
</p>
<p align="center">
<a href="https://github.com/php-flasher/flasher">
<img src="https://img.shields.io/badge/source-php--flasher/flasher-blue.svg?style=flat-square">
</a>
<a href="https://github.com/php-flasher/flasher/releases">
<img src="https://img.shields.io/github/tag/php-flasher/flasher.svg">
</a>
<a href="https://github.com/php-flasher/flasher/blob/master/LICENSE">
<img src="https://img.shields.io/badge/license-MIT-brightgreen.svg">
</a>
<a href="https://packagist.org/packages/php-flasher/flasher">
<img src="https://img.shields.io/packagist/dt/php-flasher/flasher.svg">
</a>
<a href="https://packagist.org/packages/php-flasher/flasher">
<img src="https://img.shields.io/packagist/php-v/php-flasher/flasher.svg?style=flat-square">
</a>
<a href="https://opencollective.com/php-flasher">
<img src="https://opencollective.com/php-flasher/tiers/backer/badge.svg?label=backer&color=brightgreen" />
</a>
<a href="https://opencollective.com/php-flasher">
<img src="https://opencollective.com/php-flasher/tiers/sponsor/badge.svg?label=sponsor&color=brightgreen" />
</a>
</p>
# Why use PHP Flasher ?
The PHP Flasher project supports many notification libraries : __tailwindcss__, __bootstrap__, __toastr.js__, __sweet alert 2__, __pnotify__, __noty__, and __notyf__
and its highly extendable so you can add your custom notifications.
This library is designed, so you can take full control when creating you notifications :
> * Display multiple notifications
> * Sort and filter notifications
> * Render notification from JSON object
> * Limit the number of displayed notifications
> * Show notifications from different libraries at the same time
> * Framework angostic with integration for : Symfony and Laravel
> * Support templates
> * Easy migration from similar libraries.
> * Very flexible so you can add you own adapters
> * ...and more
## Official Documentation
Documentation for PHP Flasher can be found on the [PHP Flasher website](https://php-flasher.github.io/).
## Backers && Sponsors
Support this project by becoming a sponsor. Your name will show up in the Contribute page of all PHP Flasher installations as well as here with a link to your website!
Thank you to all our backers and sponsors! 🙏
<a href="https://opencollective.com/php-flasher#backers" target="_blank">
<img src="https://opencollective.com/php-flasher/backers.svg?width=890" title="Backers" alt="Backers">
</a>
<a href="https://opencollective.com/php-flasher#sponsors" target="_blank">
<img src="https://opencollective.com/php-flasher/sponsors.svg?width=890" title="Sponsors" alt="Sponsors">
</a>
### Contact
PHP Flasher 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/flasher/issues)
- [Github](https://github.com/yoeunes)
- [Twitter](https://twitter.com/yoeunes)
- [Linkedin](https://www.linkedin.com/in/younes-khoubza/)
- [Email me directly](mailto:younes.khoubza@gmail.com)
## License
PHP Flasher 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-khoubza/">Younes KHOUBZA</a> <b> </p>
View File
View File
-51
View File
@@ -1,51 +0,0 @@
{
"name": "php-flasher/flasher-noty",
"description": "PHP Flasher adapter for Noty",
"keywords": [
"notify",
"php",
"laravel",
"symfony",
"Lumen",
"notifications",
"messages",
"alerts",
"pnotify",
"noty "
],
"homepage": "https://php-flasher.github.io/",
"authors": [
{
"name": "Younes Khoubza",
"email": "younes.khoubza@gmail.com",
"homepage": "https://github.com/yoeunes",
"role": "Developer"
}
],
"license": "MIT",
"require": {
"php": ">=5.3",
"php-flasher/flasher": "^0.4"
},
"require-dev": {
"phpunit/phpunit": "^4.8|^5.0|^6.0|^7.0|^8.0|^9.0"
},
"autoload": {
"psr-4": {
"Flasher\\Noty\\Prime\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"autoload-dev": {
"psr-4": {
"Flasher\\Noty\\Prime\\Tests\\": "Tests/"
}
},
"config": {
"sort-packages": true
},
"minimum-stability": "dev",
"prefer-stable": true
}
-22
View File
@@ -1,22 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit bootstrap="vendor/autoload.php"
backupGlobals="false"
backupStaticAttributes="false"
colors="true"
verbose="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="true">
<testsuites>
<testsuite name="Flasher Test Suite">
<directory>Tests</directory>
</testsuite>
</testsuites>
<filter>
<whitelist>
<directory suffix=".php">./</directory>
</whitelist>
</filter>
</phpunit>
-13
View File
@@ -1,13 +0,0 @@
# Path-based git attributes
# https://www.kernel.org/pub/software/scm/git/docs/gitattributes.html
# Ignore all test and documentation with "export-ignore".
/.gitattributes export-ignore
/.gitignore export-ignore
/.travis.yml export-ignore
/phpunit.xml.dist export-ignore
/.scrutinizer.yml export-ignore
/.styleci.yml export-ignore
/tests export-ignore
/.editorconfig export-ignore
-6
View File
@@ -1,6 +0,0 @@
# These are supported funding model platforms
patreon: yoeunes
ko_fi: yoeunes
open_collective: php-flasher
custom: ['https://www.paypal.com/paypalme/yoeunes']
-7
View File
@@ -1,7 +0,0 @@
version: 2
updates:
- package-ecosystem: composer
directory: "/"
schedule:
interval: daily
open-pull-requests-limit: 10
-103
View File
@@ -1,103 +0,0 @@
name: Running tests
on:
push:
pull_request:
schedule:
- cron: '* * * * *'
jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
symfony: [5.2.*, 5.1.*, 5.0.*, 4.4.*, 4.3.*, 4.2.*, 4.1.*, 4.0.*, 3.4.*, 3.3.*, 3.2.*, 3.1.*, 3.0.*, 2.8.*, 2.7.*]
include:
- symfony: 5.2.*
php: 7.2
phpunit: 8.3.*
- symfony: 5.1.*
php: 7.2
phpunit: 8.3.*
- symfony: 5.0.*
php: 7.2
phpunit: 8.3.*
- symfony: 4.4.*
php: 7.1
phpunit: 7.0.*
- symfony: 4.3.*
php: 7.1
phpunit: 7.0.*
- symfony: 4.2.*
php: 7.1
phpunit: 7.0.*
- symfony: 4.1.*
php: 7.1
phpunit: 7.0.*
- symfony: 4.0.*
php: 7.1
phpunit: 7.0.*
- symfony: 3.4.*
php: 5.5
phpunit: 4.8.36
- symfony: 3.3.*
php: 5.5
phpunit: 4.8.36
- symfony: 3.2.*
php: 5.5
phpunit: 4.8.36
- symfony: 3.1.*
php: 5.5
phpunit: 4.8.36
- symfony: 3.0.*
php: 5.5
phpunit: 4.8.36
- symfony: 2.8.*
php: 5.3
phpunit: 4.8.36
- symfony: 2.7.*
php: 5.3
phpunit: 4.8.36
name: S${{ matrix.symfony }} - P${{ matrix.php }}
steps:
- name: Checkout code
uses: actions/checkout@v1
- name: Cache dependencies
uses: actions/cache@v1
with:
path: ~/.composer/cache/files
key: dependencies-symfony-${{ matrix.symfony }}-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick
coverage: none
- name: Install dependencies
run: |
composer require "symfony/symfony:${{ matrix.symfony }}" "phpunit/phpunit:${{ matrix.phpunit }}" --no-interaction --no-update
composer config extra.symfony.require "${{ matrix.symfony }}"
composer update --prefer-dist --no-interaction --no-suggest
- name: Execute tests
run: vendor/bin/phpunit
-5
View File
@@ -1,5 +0,0 @@
.idea
vendor
composer.lock
.phpunit.result.cache
.phpcs-cache
-3
View File
@@ -1,3 +0,0 @@
<?php
namespace PHPSTORM_META;
View File
@@ -1,45 +0,0 @@
<?php
namespace Flasher\Noty\Symfony\DependencyInjection;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;
final class Configuration implements ConfigurationInterface
{
public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder('flasher_noty');
if (\method_exists($treeBuilder, 'getRootNode')) {
$rootNode = $treeBuilder->getRootNode();
} else {
// BC layer for symfony/config 4.1 and older
$rootNode = $treeBuilder->root('flasher_noty');
}
$rootNode
->children()
->arrayNode('scripts')
->prototype('scalar')->end()
->defaultValue(array(
'https://cdn.jsdelivr.net/npm/@flasher/flasher-noty@0.1.3/dist/flasher-noty.min.js',
))
->end()
->arrayNode('styles')
->prototype('scalar')->end()
->defaultValue(array())
->end()
->arrayNode('options')
->prototype('variable')->end()
->ignoreExtraKeys(false)
->defaultValue(array(
'timeout' => 5000,
))
->end()
->end()
;
return $treeBuilder;
}
}
@@ -1,19 +0,0 @@
<?php
namespace Flasher\Noty\Symfony\DependencyInjection;
use Flasher\Symfony\DependencyInjection\Extension;
use Symfony\Component\Config\FileLocator;
final class FlasherNotyExtension extends Extension
{
protected function getConfigFileLocator()
{
return new FileLocator(__DIR__ . '/../Resources/config');
}
protected function getConfigClass()
{
return new Configuration();
}
}

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