You've already forked php-flasher
mirror of
https://github.com/php-flasher/php-flasher.git
synced 2026-04-05 12:32:55 +01:00
Compare commits
22 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| ff48db2429 | |||
| 669e389677 | |||
| a19f4c4da1 | |||
| 7e5116eaed | |||
| fd6f43026b | |||
| 8e852700c4 | |||
| ed1d4154e9 | |||
| 13012ce31e | |||
| 3bd0365245 | |||
| 68fee8dcf0 | |||
| 018e83b8da | |||
| aeaf31b5bb | |||
| be50c09c04 | |||
| 6e4620ef77 | |||
| c675167ec5 | |||
| d7783cae2a | |||
| 412e386eb6 | |||
| 3588ac8d16 | |||
| cdf0f7949a | |||
| c5029a5d44 | |||
| e845b33608 | |||
| 30fb4672f1 |
@@ -0,0 +1,13 @@
|
||||
|
||||
# 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
|
||||
+3
-3
@@ -1,5 +1,5 @@
|
||||
github: yoeunes
|
||||
# These are supported funding model platforms
|
||||
|
||||
patreon: yoeunes
|
||||
ko_fi: yoeunes
|
||||
open_collective: php-flasher
|
||||
custom: https://www.paypal.com/paypalme/yoeunes
|
||||
custom: ['https://www.paypal.com/paypalme/yoeunes']
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
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.
|
||||
@@ -0,0 +1,103 @@
|
||||
name: Running tests
|
||||
|
||||
on:
|
||||
push:
|
||||
pull_request:
|
||||
schedule:
|
||||
- cron: '0 * * * *'
|
||||
|
||||
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
|
||||
@@ -0,0 +1,5 @@
|
||||
.idea/
|
||||
vendor/
|
||||
composer.lock
|
||||
.phpunit.result.cache
|
||||
.phpcs-cache
|
||||
+625
@@ -0,0 +1,625 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/squizlabs/PHP_CodeSniffer/master/phpcs.xsd"
|
||||
>
|
||||
<arg name="basepath" value="."/>
|
||||
<arg name="extensions" value="php"/>
|
||||
<arg name="parallel" value="80"/>
|
||||
<arg name="cache" value=".phpcs-cache"/>
|
||||
<arg name="colors"/>
|
||||
|
||||
<!-- Ignore warnings, show progress of the run and show sniff names -->
|
||||
<arg value="nps"/>
|
||||
|
||||
<!-- Directories to be checked -->
|
||||
<file>src</file>
|
||||
<file>tests</file>
|
||||
|
||||
<!-- Import PSR-12 coding standard (base) -->
|
||||
<rule ref="PSR12"/>
|
||||
|
||||
<!-- Force array element indentation with 4 spaces -->
|
||||
<rule ref="Generic.Arrays.ArrayIndent"/>
|
||||
|
||||
<!-- Forbid `[...]` -->
|
||||
<rule ref="Generic.Arrays.DisallowShortArraySyntax"/>
|
||||
|
||||
<!-- Forbid duplicate classes -->
|
||||
<rule ref="Generic.Classes.DuplicateClassName"/>
|
||||
|
||||
<!-- Forbid empty statements -->
|
||||
<rule ref="Generic.CodeAnalysis.EmptyStatement">
|
||||
<!-- But allow empty catch -->
|
||||
<exclude name="Generic.CodeAnalysis.EmptyStatement.DetectedCatch"/>
|
||||
</rule>
|
||||
|
||||
<!-- Forbid final methods in final classes -->
|
||||
<rule ref="Generic.CodeAnalysis.UnnecessaryFinalModifier"/>
|
||||
|
||||
<!-- Forbid useless empty method overrides -->
|
||||
<rule ref="Generic.CodeAnalysis.UselessOverridingMethod"/>
|
||||
|
||||
<!-- Align corresponding assignment statement tokens -->
|
||||
<rule ref="Generic.Formatting.MultipleStatementAlignment">
|
||||
<properties>
|
||||
<property name="error" value="true"/>
|
||||
</properties>
|
||||
</rule>
|
||||
|
||||
<!-- Force whitespace after a type cast -->
|
||||
<rule ref="Generic.Formatting.SpaceAfterCast">
|
||||
<properties>
|
||||
<property name="spacing" value="0"/>
|
||||
</properties>
|
||||
</rule>
|
||||
|
||||
<!-- Force whitespace after `!` -->
|
||||
<!-- <rule ref="Generic.Formatting.SpaceAfterNot"/> -->
|
||||
|
||||
<!-- Forbid PHP 4 constructors -->
|
||||
<rule ref="Generic.NamingConventions.ConstructorName"/>
|
||||
|
||||
<!-- Forbid any content before opening tag -->
|
||||
<rule ref="Generic.PHP.CharacterBeforePHPOpeningTag"/>
|
||||
|
||||
<!-- Forbid deprecated functions -->
|
||||
<rule ref="Generic.PHP.DeprecatedFunctions"/>
|
||||
|
||||
<!-- Forbid alias functions, i.e. `sizeof()`, `delete()` -->
|
||||
<rule ref="Generic.PHP.ForbiddenFunctions">
|
||||
<properties>
|
||||
<property name="forbiddenFunctions" type="array">
|
||||
<element key="chop" value="rtrim"/>
|
||||
<element key="close" value="closedir"/>
|
||||
<element key="compact" value="null"/>
|
||||
<element key="delete" value="unset"/>
|
||||
<element key="doubleval" value="floatval"/>
|
||||
<element key="extract" value="null"/>
|
||||
<element key="fputs" value="fwrite"/>
|
||||
<element key="ini_alter" value="ini_set"/>
|
||||
<element key="is_double" value="is_float"/>
|
||||
<element key="is_integer" value="is_int"/>
|
||||
<element key="is_long" value="is_int"/>
|
||||
<element key="is_null" value="null"/>
|
||||
<element key="is_real" value="is_float"/>
|
||||
<element key="is_writeable" value="is_writable"/>
|
||||
<element key="join" value="implode"/>
|
||||
<element key="key_exists" value="array_key_exists"/>
|
||||
<element key="pos" value="current"/>
|
||||
<element key="settype" value="null"/>
|
||||
<element key="show_source" value="highlight_file"/>
|
||||
<element key="sizeof" value="count"/>
|
||||
<element key="strchr" value="strstr"/>
|
||||
<element key="user_error" value="trigger_error"/>
|
||||
</property>
|
||||
</properties>
|
||||
</rule>
|
||||
|
||||
<!-- Forbid useless inline string concatenation -->
|
||||
<rule ref="Generic.Strings.UnnecessaryStringConcat">
|
||||
<!-- But multiline is useful for readability -->
|
||||
<properties>
|
||||
<property name="allowMultiline" value="true"/>
|
||||
</properties>
|
||||
</rule>
|
||||
|
||||
<!-- Forbid backtick operator -->
|
||||
<rule ref="Generic.PHP.BacktickOperator"/>
|
||||
|
||||
<!-- Force PHP 7 param and return types to be lowercased -->
|
||||
<rule ref="Generic.PHP.LowerCaseType"/>
|
||||
|
||||
<!-- Forbid `php_sapi_name()` function -->
|
||||
<rule ref="Generic.PHP.SAPIUsage"/>
|
||||
|
||||
<!-- Forbid comments starting with # -->
|
||||
<rule ref="PEAR.Commenting.InlineComment"/>
|
||||
|
||||
<!-- Disallow else if in favor of elseif -->
|
||||
<rule ref="PSR2.ControlStructures.ElseIfDeclaration.NotAllowed">
|
||||
<type>error</type>
|
||||
</rule>
|
||||
|
||||
<!-- Require that single line arrays have the correct spacing: no space around brackets and one space after comma -->
|
||||
<rule ref="SlevomatCodingStandard.Arrays.SingleLineArrayWhitespace"/>
|
||||
|
||||
<!-- Require comma after last element in multi-line array -->
|
||||
<rule ref="SlevomatCodingStandard.Arrays.TrailingArrayComma"/>
|
||||
|
||||
<!-- Require presence of constant visibility -->
|
||||
<!-- <rule ref="SlevomatCodingStandard.Classes.ClassConstantVisibility">
|
||||
<properties>
|
||||
<property name="fixable" value="true"/>
|
||||
</properties>
|
||||
</rule> -->
|
||||
|
||||
<!-- Forbid LSB for constants (static::FOO) -->
|
||||
<rule ref="SlevomatCodingStandard.Classes.DisallowLateStaticBindingForConstants"/>
|
||||
|
||||
<!-- Forbid more than one constant declared per statement -->
|
||||
<rule ref="SlevomatCodingStandard.Classes.DisallowMultiConstantDefinition"/>
|
||||
|
||||
<!-- Forbid empty lines around type declarations -->
|
||||
<rule ref="SlevomatCodingStandard.Classes.EmptyLinesAroundClassBraces">
|
||||
<properties>
|
||||
<property name="linesCountAfterOpeningBrace" value="0"/>
|
||||
<property name="linesCountBeforeClosingBrace" value="0"/>
|
||||
</properties>
|
||||
</rule>
|
||||
|
||||
<!-- Require usage of ::class instead of __CLASS__, get_class(), get_class($this), get_called_class() and get_parent_class() -->
|
||||
<!-- <rule ref="SlevomatCodingStandard.Classes.ModernClassNameReference"/> -->
|
||||
|
||||
<!-- Forbid uses of multiple traits separated by comma -->
|
||||
<rule ref="SlevomatCodingStandard.Classes.TraitUseDeclaration"/>
|
||||
|
||||
<!-- Require no spaces before trait use, between trait uses and one space after trait uses -->
|
||||
<rule ref="SlevomatCodingStandard.Classes.TraitUseSpacing">
|
||||
<properties>
|
||||
<property name="linesCountAfterLastUse" value="1"/>
|
||||
<property name="linesCountAfterLastUseWhenLastInClass" value="0"/>
|
||||
<property name="linesCountBeforeFirstUse" value="0"/>
|
||||
<property name="linesCountBetweenUses" value="0"/>
|
||||
</properties>
|
||||
</rule>
|
||||
|
||||
<!-- Forbid dead code -->
|
||||
<rule ref="SlevomatCodingStandard.Classes.UnusedPrivateElements"/>
|
||||
|
||||
<!-- Forbid useless annotations - Git and LICENCE file provide more accurate information -->
|
||||
<rule ref="SlevomatCodingStandard.Commenting.ForbiddenAnnotations">
|
||||
<properties>
|
||||
<property name="forbiddenAnnotations" type="array">
|
||||
<element value="@api"/>
|
||||
<element value="@author"/>
|
||||
<element value="@category"/>
|
||||
<element value="@copyright"/>
|
||||
<element value="@created"/>
|
||||
<element value="@license"/>
|
||||
<element value="@package"/>
|
||||
<element value="@since"/>
|
||||
<element value="@subpackage"/>
|
||||
<element value="@version"/>
|
||||
</property>
|
||||
</properties>
|
||||
</rule>
|
||||
|
||||
<!-- Forbid empty comments -->
|
||||
<rule ref="SlevomatCodingStandard.Commenting.EmptyComment"/>
|
||||
|
||||
<!-- Forbid useless comments -->
|
||||
<rule ref="SlevomatCodingStandard.Commenting.ForbiddenComments">
|
||||
<properties>
|
||||
<property name="forbiddenCommentPatterns" type="array">
|
||||
<element value="~^(?:(?!private|protected|static)\S+ )?(?:con|de)structor\.\z~i"/>
|
||||
<element value="~^Created by .+\.\z~i"/>
|
||||
<element value="~^(User|Date|Time): \S+\z~i"/>
|
||||
<element value="~^\S+ [gs]etter\.\z~i"/>
|
||||
<element value="~^(Class|Interface|Trait) \S+\z~i"/>
|
||||
</property>
|
||||
</properties>
|
||||
</rule>
|
||||
|
||||
<!-- Require specific order of phpDoc annotations with empty newline between specific groups -->
|
||||
<rule ref="SlevomatCodingStandard.Commenting.DocCommentSpacing">
|
||||
<properties>
|
||||
<property name="linesCountBeforeFirstContent" value="0"/>
|
||||
<property name="linesCountAfterLastContent" value="0"/>
|
||||
<property name="linesCountBetweenDescriptionAndAnnotations" value="1"/>
|
||||
<property name="linesCountBetweenAnnotationsGroups" value="1"/>
|
||||
<property name="annotationsGroups" type="array">
|
||||
<element value="
|
||||
@internal,
|
||||
@deprecated,
|
||||
"/>
|
||||
<element value="
|
||||
@link,
|
||||
@see,
|
||||
@uses,
|
||||
"/>
|
||||
<element value="@var"/>
|
||||
<element value="@ORM\"/>
|
||||
<element value="@param"/>
|
||||
<element value="@return"/>
|
||||
<element value="@throws"/>
|
||||
</property>
|
||||
</properties>
|
||||
</rule>
|
||||
|
||||
<!-- Report invalid format of inline phpDocs with @var -->
|
||||
<rule ref="SlevomatCodingStandard.Commenting.InlineDocCommentDeclaration"/>
|
||||
|
||||
<!-- Require comments with single line written as one-liners -->
|
||||
<!-- <rule ref="SlevomatCodingStandard.Commenting.RequireOneLinePropertyDocComment"/> -->
|
||||
|
||||
<!-- Forbid assignments in conditions -->
|
||||
<rule ref="SlevomatCodingStandard.ControlStructures.AssignmentInCondition"/>
|
||||
|
||||
<!-- Require consistent spacing for block structures -->
|
||||
<rule ref="SlevomatCodingStandard.ControlStructures.BlockControlStructureSpacing">
|
||||
<exclude name="SlevomatCodingStandard.ControlStructures.BlockControlStructureSpacing.IncorrectLinesCountBeforeControlStructure" />
|
||||
<exclude name="SlevomatCodingStandard.ControlStructures.BlockControlStructureSpacing.IncorrectLinesCountBeforeFirstControlStructure" />
|
||||
<properties>
|
||||
<property name="tokensToCheck" type="array">
|
||||
<element value="T_IF" />
|
||||
<element value="T_DO" />
|
||||
<element value="T_WHILE" />
|
||||
<element value="T_FOR" />
|
||||
<element value="T_FOREACH" />
|
||||
<element value="T_SWITCH" />
|
||||
<element value="T_TRY" />
|
||||
<element value="T_DEFAULT" />
|
||||
</property>
|
||||
</properties>
|
||||
</rule>
|
||||
|
||||
<!-- Forbid fancy yoda conditions -->
|
||||
<!-- <rule ref="SlevomatCodingStandard.ControlStructures.DisallowYodaComparison"/> -->
|
||||
|
||||
<!-- Require usage of early exit -->
|
||||
<rule ref="SlevomatCodingStandard.ControlStructures.EarlyExit"/>
|
||||
|
||||
<!-- Require consistent spacing for jump statements -->
|
||||
<rule ref="SlevomatCodingStandard.ControlStructures.JumpStatementsSpacing">
|
||||
<properties>
|
||||
<property name="linesCountBeforeWhenFirstInCaseOrDefault" value="0"/>
|
||||
<property name="linesCountAfterWhenLastInCaseOrDefault" value="1"/>
|
||||
<property name="linesCountAfterWhenLastInLastCaseOrDefault" value="0"/>
|
||||
<property name="tokensToCheck" type="array">
|
||||
<element value="T_RETURN" />
|
||||
<element value="T_THROW" />
|
||||
<element value="T_YIELD" />
|
||||
<element value="T_YIELD_FROM" />
|
||||
</property>
|
||||
</properties>
|
||||
</rule>
|
||||
|
||||
<!-- Require language constructs without parentheses -->
|
||||
<rule ref="SlevomatCodingStandard.ControlStructures.LanguageConstructWithParentheses"/>
|
||||
|
||||
<!-- Require usage of null coalesce operator equal operator when possible -->
|
||||
<!-- <rule ref="SlevomatCodingStandard.ControlStructures.RequireNullCoalesceEqualOperator"/> -->
|
||||
|
||||
<!-- Require usage of null coalesce operator when possible -->
|
||||
<!-- <rule ref="SlevomatCodingStandard.ControlStructures.RequireNullCoalesceOperator"/> -->
|
||||
|
||||
<!-- Forbid usage of conditions when a simple return can be used -->
|
||||
<rule ref="SlevomatCodingStandard.ControlStructures.UselessIfConditionWithReturn"/>
|
||||
|
||||
<!-- Forbid usage of boolean-only ternary operator usage (e.g. $foo ? true : false) -->
|
||||
<rule ref="SlevomatCodingStandard.ControlStructures.UselessTernaryOperator"/>
|
||||
|
||||
<!-- Forbid useless unreachable catch blocks -->
|
||||
<rule ref="SlevomatCodingStandard.Exceptions.DeadCatch"/>
|
||||
|
||||
<!-- Require using Throwable instead of Exception -->
|
||||
<rule ref="SlevomatCodingStandard.Exceptions.ReferenceThrowableOnly"/>
|
||||
|
||||
<!-- Ensure Arrow Functions declaration format -->
|
||||
<rule ref="SlevomatCodingStandard.Functions.ArrowFunctionDeclaration">
|
||||
<properties>
|
||||
<property name="spacesCountAfterKeyword" value="1"/>
|
||||
<property name="spacesCountBeforeArrow" value="1"/>
|
||||
<property name="spacesCountAfterArrow" value="1"/>
|
||||
</properties>
|
||||
</rule>
|
||||
|
||||
<!-- Require closures not referencing $this be static -->
|
||||
<rule ref="SlevomatCodingStandard.Functions.StaticClosure"/>
|
||||
|
||||
<!-- Forbid unused variables passed to closures via `use` -->
|
||||
<rule ref="SlevomatCodingStandard.Functions.UnusedInheritedVariablePassedToClosure"/>
|
||||
|
||||
<!-- Require presence of declare(strict_types=1) -->
|
||||
<!-- <rule ref="SlevomatCodingStandard.TypeHints.DeclareStrictTypes">
|
||||
<properties>
|
||||
<property name="newlinesCountBetweenOpenTagAndDeclare" value="2"/>
|
||||
<property name="spacesCountAroundEqualsSign" value="0"/>
|
||||
<property name="newlinesCountAfterDeclare" value="2"/>
|
||||
</properties>
|
||||
</rule> -->
|
||||
|
||||
<!-- Require consistent spacing for block structures -->
|
||||
<rule ref="SlevomatCodingStandard.ControlStructures.BlockControlStructureSpacing"/>
|
||||
|
||||
<!-- Forbid unused use statements -->
|
||||
<rule ref="SlevomatCodingStandard.Namespaces.UnusedUses">
|
||||
<properties>
|
||||
<property name="searchAnnotations" value="true"/>
|
||||
</properties>
|
||||
</rule>
|
||||
|
||||
<!-- Require use statements to be alphabetically sorted -->
|
||||
<rule ref="SlevomatCodingStandard.Namespaces.AlphabeticallySortedUses"/>
|
||||
|
||||
<!-- Forbid fancy group uses -->
|
||||
<rule ref="SlevomatCodingStandard.Namespaces.DisallowGroupUse"/>
|
||||
|
||||
<!-- Forbid multiple use statements on same line -->
|
||||
<rule ref="SlevomatCodingStandard.Namespaces.MultipleUsesPerLine"/>
|
||||
|
||||
<!-- Require newlines around namespace declaration -->
|
||||
<rule ref="SlevomatCodingStandard.Namespaces.NamespaceSpacing"/>
|
||||
|
||||
<!-- Forbid using absolute class name references -->
|
||||
<!-- <rule ref="SlevomatCodingStandard.Namespaces.ReferenceUsedNamesOnly"/> -->
|
||||
|
||||
<!-- Forbid superfluous leading backslash in use statements -->
|
||||
<rule ref="SlevomatCodingStandard.Namespaces.UseDoesNotStartWithBackslash"/>
|
||||
|
||||
<!-- Forbid useless uses of the same namespace -->
|
||||
<rule ref="SlevomatCodingStandard.Namespaces.UseFromSameNamespace"/>
|
||||
|
||||
<!-- Require empty newlines before and after uses -->
|
||||
<rule ref="SlevomatCodingStandard.Namespaces.UseSpacing">
|
||||
<properties>
|
||||
<property name="linesCountAfterLastUse" value="1"/>
|
||||
<property name="linesCountBeforeFirstUse" value="1"/>
|
||||
<property name="linesCountBetweenUseTypes" value="1"/>
|
||||
</properties>
|
||||
</rule>
|
||||
|
||||
<!-- Forbid useless alias for classes, constants and functions -->
|
||||
<rule ref="SlevomatCodingStandard.Namespaces.UselessAlias"/>
|
||||
|
||||
<!-- Forbid weak comparisons -->
|
||||
<rule ref="SlevomatCodingStandard.Operators.DisallowEqualOperators"/>
|
||||
|
||||
<!-- Forbid spacing before the negative operator `-` -->
|
||||
<rule ref="SlevomatCodingStandard.Operators.NegationOperatorSpacing"/>
|
||||
|
||||
<!-- Require the usage of assignment operators, eg `+=`, `.=` when possible -->
|
||||
<rule ref="SlevomatCodingStandard.Operators.RequireCombinedAssignmentOperator"/>
|
||||
|
||||
<!-- Require no spacing after spread operator -->
|
||||
<rule ref="SlevomatCodingStandard.Operators.SpreadOperatorSpacing"/>
|
||||
|
||||
<!-- Forbid `list(...)` syntax -->
|
||||
<!-- <rule ref="SlevomatCodingStandard.PHP.ShortList"/> -->
|
||||
|
||||
<!-- Forbid use of longhand cast operators -->
|
||||
<rule ref="SlevomatCodingStandard.PHP.TypeCast"/>
|
||||
|
||||
<!-- Forbid useless parentheses -->
|
||||
<rule ref="SlevomatCodingStandard.PHP.UselessParentheses"/>
|
||||
|
||||
<!-- Forbid useless semicolon `;` -->
|
||||
<rule ref="SlevomatCodingStandard.PHP.UselessSemicolon"/>
|
||||
|
||||
<!-- Require use of short versions of scalar types (i.e. int instead of integer) -->
|
||||
<rule ref="SlevomatCodingStandard.TypeHints.LongTypeHints"/>
|
||||
|
||||
<!-- Require the `null` type hint to be in the last position of annotations -->
|
||||
<rule ref="SlevomatCodingStandard.TypeHints.NullTypeHintOnLastPosition"/>
|
||||
|
||||
<!-- Require ? when default value is null -->
|
||||
<!-- <rule ref="SlevomatCodingStandard.TypeHints.NullableTypeForNullDefaultValue"/> -->
|
||||
|
||||
<!-- Require one space between typehint and variable, require no space between nullability sign and typehint -->
|
||||
<rule ref="SlevomatCodingStandard.TypeHints.ParameterTypeHintSpacing"/>
|
||||
|
||||
<!-- Require space around colon in return types -->
|
||||
<rule ref="SlevomatCodingStandard.TypeHints.ReturnTypeHintSpacing">
|
||||
<properties>
|
||||
<property name="spacesCountBeforeColon" value="0"/>
|
||||
</properties>
|
||||
</rule>
|
||||
|
||||
<!-- Forbid useless @var for constants -->
|
||||
<rule ref="SlevomatCodingStandard.TypeHints.UselessConstantTypeHint"/>
|
||||
|
||||
<!-- Forbid useless inherit doc comment -->
|
||||
<rule ref="SlevomatCodingStandard.Commenting.UselessInheritDocComment"/>
|
||||
|
||||
<!-- Forbid duplicated variables assignments -->
|
||||
<rule ref="SlevomatCodingStandard.Variables.DuplicateAssignmentToVariable"/>
|
||||
|
||||
<!-- Forbid useless variables -->
|
||||
<rule ref="SlevomatCodingStandard.Variables.UselessVariable"/>
|
||||
|
||||
<!-- Forbid spaces around square brackets -->
|
||||
<rule ref="Squiz.Arrays.ArrayBracketSpacing"/>
|
||||
|
||||
<!-- Forbid class being in a file with different name -->
|
||||
<rule ref="Squiz.Classes.ClassFileName"/>
|
||||
|
||||
<!-- Force `self::` for self-reference, force lower-case self, forbid spaces around `::` -->
|
||||
<rule ref="Squiz.Classes.SelfMemberReference"/>
|
||||
|
||||
<!-- Forbid global functions -->
|
||||
<rule ref="Squiz.Functions.GlobalFunction"/>
|
||||
|
||||
<!-- Force camelCase variables -->
|
||||
<rule ref="Squiz.NamingConventions.ValidVariableName">
|
||||
<exclude name="Squiz.NamingConventions.ValidVariableName.PrivateNoUnderscore" />
|
||||
</rule>
|
||||
|
||||
<!-- Force phpDoc alignment -->
|
||||
<rule ref="Squiz.Commenting.DocCommentAlignment">
|
||||
<!-- Allow extra spaces after star, i.e. for indented annotations -->
|
||||
<exclude name="Squiz.Commenting.DocCommentAlignment.SpaceAfterStar"/>
|
||||
</rule>
|
||||
|
||||
<!-- Force array declaration structure -->
|
||||
<rule ref="Squiz.Arrays.ArrayDeclaration">
|
||||
<!-- Disable arrow alignment -->
|
||||
<exclude name="Squiz.Arrays.ArrayDeclaration.DoubleArrowNotAligned"/>
|
||||
<!-- Uses indentation of only single space -->
|
||||
<exclude name="Squiz.Arrays.ArrayDeclaration.KeyNotAligned"/>
|
||||
<!-- Allow multiple values on a single line -->
|
||||
<exclude name="Squiz.Arrays.ArrayDeclaration.SingleLineNotAllowed"/>
|
||||
<!-- Disable alignment of braces -->
|
||||
<exclude name="Squiz.Arrays.ArrayDeclaration.CloseBraceNotAligned"/>
|
||||
<!-- Disable alignment of values with opening brace -->
|
||||
<exclude name="Squiz.Arrays.ArrayDeclaration.ValueNotAligned"/>
|
||||
<!-- Checked by SlevomatCodingStandard.Arrays.TrailingArrayComma.MissingTrailingComma -->
|
||||
<exclude name="Squiz.Arrays.ArrayDeclaration.NoCommaAfterLast"/>
|
||||
<exclude name="Squiz.Arrays.ArrayDeclaration.NoComma"/>
|
||||
</rule>
|
||||
|
||||
<!-- Force rules for function phpDoc -->
|
||||
<rule ref="Squiz.Commenting.FunctionComment">
|
||||
<!-- Allow `@throws` without description -->
|
||||
<exclude name="Squiz.Commenting.FunctionComment.EmptyThrows"/>
|
||||
<!-- Does not work properly with PHP 7 / short-named types -->
|
||||
<exclude name="Squiz.Commenting.FunctionComment.IncorrectParamVarName"/>
|
||||
<!-- Does not support collections, i.e. `string[]` -->
|
||||
<exclude name="Squiz.Commenting.FunctionComment.IncorrectTypeHint"/>
|
||||
<!-- Forces incorrect types -->
|
||||
<exclude name="Squiz.Commenting.FunctionComment.InvalidReturn"/>
|
||||
<!-- Breaks with compound return types, i.e. `string|null` -->
|
||||
<exclude name="Squiz.Commenting.FunctionComment.InvalidReturnNotVoid"/>
|
||||
<!-- Breaks when all params are not documented -->
|
||||
<exclude name="Squiz.Commenting.FunctionComment.InvalidTypeHint"/>
|
||||
<!-- Doc comment is not required for every method -->
|
||||
<exclude name="Squiz.Commenting.FunctionComment.Missing"/>
|
||||
<!-- Do not require comments for `@param` -->
|
||||
<exclude name="Squiz.Commenting.FunctionComment.MissingParamComment"/>
|
||||
<!-- Do not require `@param` for all parameters -->
|
||||
<exclude name="Squiz.Commenting.FunctionComment.MissingParamTag"/>
|
||||
<!-- Do not require `@return` for void methods -->
|
||||
<exclude name="Squiz.Commenting.FunctionComment.MissingReturn"/>
|
||||
<!-- Comments don't have to be sentences -->
|
||||
<exclude name="Squiz.Commenting.FunctionComment.ParamCommentFullFullStop"/>
|
||||
<!-- Comments don't have to be sentences -->
|
||||
<exclude name="Squiz.Commenting.FunctionComment.ParamCommentNotCapital"/>
|
||||
<!-- Breaks when all params are not documented -->
|
||||
<exclude name="Squiz.Commenting.FunctionComment.ParamNameNoMatch"/>
|
||||
<!-- Doesn't respect inheritance -->
|
||||
<exclude name="Squiz.Commenting.FunctionComment.ScalarTypeHintMissing"/>
|
||||
<!-- `@throws` lines can often be read as a sentence,
|
||||
i.e. `@throws RuntimeException if the file could not be written.` -->
|
||||
<exclude name="Squiz.Commenting.FunctionComment.ThrowsNotCapital"/>
|
||||
<!-- Doesn't work with self as typehint -->
|
||||
<exclude name="Squiz.Commenting.FunctionComment.TypeHintMissing"/>
|
||||
</rule>
|
||||
|
||||
<!-- Forbid `AND` and `OR`, require `&&` and `||` -->
|
||||
<rule ref="Squiz.Operators.ValidLogicalOperators"/>
|
||||
|
||||
<!-- Forbid `global` -->
|
||||
<rule ref="Squiz.PHP.GlobalKeyword"/>
|
||||
|
||||
<!-- Forbid functions inside functions -->
|
||||
<rule ref="Squiz.PHP.InnerFunctions"/>
|
||||
|
||||
<!-- Require PHP function calls in lowercase -->
|
||||
<rule ref="Squiz.PHP.LowercasePHPFunctions"/>
|
||||
|
||||
<!-- Forbid `$this` inside static function -->
|
||||
<rule ref="Squiz.Scope.StaticThisUsage"/>
|
||||
|
||||
<!-- Force whitespace before and after concatenation -->
|
||||
<!-- <rule ref="Squiz.Strings.ConcatenationSpacing">
|
||||
<properties>
|
||||
<property name="spacing" value="0"/>
|
||||
<property name="ignoreNewlines" value="true"/>
|
||||
</properties>
|
||||
</rule> -->
|
||||
|
||||
<!-- Forbid dead code -->
|
||||
<rule ref="Squiz.PHP.NonExecutableCode"/>
|
||||
|
||||
<!-- Forbid strings in `"` unless necessary -->
|
||||
<rule ref="Squiz.Strings.DoubleQuoteUsage"/>
|
||||
<rule ref="Squiz.Strings.DoubleQuoteUsage.ContainsVar">
|
||||
<message>Variable "%s" not allowed in double quoted string; use sprintf() or concatenation instead</message>
|
||||
</rule>
|
||||
|
||||
<!-- Forbid braces around string in `echo` -->
|
||||
<rule ref="Squiz.Strings.EchoedStrings"/>
|
||||
|
||||
<!-- Forbid spaces in type casts -->
|
||||
<rule ref="Squiz.WhiteSpace.CastSpacing"/>
|
||||
|
||||
<!-- Forbid blank line after function opening brace -->
|
||||
<rule ref="Squiz.WhiteSpace.FunctionOpeningBraceSpace"/>
|
||||
|
||||
<!-- Require 1 line before and after function, except at the top and bottom -->
|
||||
<rule ref="Squiz.WhiteSpace.FunctionSpacing">
|
||||
<properties>
|
||||
<property name="spacing" value="1" />
|
||||
<property name="spacingBeforeFirst" value="0"/>
|
||||
<property name="spacingAfterLast" value="0"/>
|
||||
</properties>
|
||||
</rule>
|
||||
|
||||
<!-- Require there be no space between increment/decrement operator and its operand -->
|
||||
<rule ref="Generic.WhiteSpace.IncrementDecrementSpacing"/>
|
||||
|
||||
<!-- Require space after language constructs -->
|
||||
<rule ref="Squiz.WhiteSpace.LanguageConstructSpacing"/>
|
||||
|
||||
<!-- Require space around logical operators -->
|
||||
<rule ref="Squiz.WhiteSpace.LogicalOperatorSpacing"/>
|
||||
|
||||
<!-- Forbid spaces around `->` operator -->
|
||||
<rule ref="Squiz.WhiteSpace.ObjectOperatorSpacing">
|
||||
<properties>
|
||||
<property name="ignoreNewlines" value="true"/>
|
||||
</properties>
|
||||
</rule>
|
||||
|
||||
<!-- Forbid spaces before semicolon `;` -->
|
||||
<rule ref="Squiz.WhiteSpace.SemicolonSpacing"/>
|
||||
|
||||
<!-- Forbid superfluous whitespaces -->
|
||||
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace">
|
||||
<properties>
|
||||
<!-- turned on by PSR2 -> turning back off -->
|
||||
<property name="ignoreBlankLines" value="false"/>
|
||||
</properties>
|
||||
</rule>
|
||||
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace.EmptyLines">
|
||||
<!-- turned off by PSR2 -> turning back on -->
|
||||
<severity>5</severity>
|
||||
</rule>
|
||||
|
||||
<!-- Checks that class/trait/interface members are in the correct order. -->
|
||||
<rule ref="SlevomatCodingStandard.Classes.ClassStructure"/>
|
||||
|
||||
<!-- Disallows use of continue without integer operand in switch because it emits a warning in PHP 7.3 and higher. -->
|
||||
<rule ref="SlevomatCodingStandard.ControlStructures.DisallowContinueWithoutIntegerOperandInSwitch"/>
|
||||
|
||||
<!-- Enforces reasonable end bracket placement for multiline arrays. -->
|
||||
<rule ref="SlevomatCodingStandard.Arrays.MultiLineArrayEndBracketPlacement"/>
|
||||
|
||||
<!-- Checks that there is a certain number of blank lines between properties. -->
|
||||
<rule ref="SlevomatCodingStandard.Classes.PropertySpacing"/>
|
||||
|
||||
<!-- Require consistent spacing for jump statements -->
|
||||
<rule ref="SlevomatCodingStandard.ControlStructures.JumpStatementsSpacing">
|
||||
<properties>
|
||||
<property name="tokensToCheck" type="array">
|
||||
<element value="T_RETURN" />
|
||||
<element value="T_THROW" />
|
||||
<element value="T_YIELD" />
|
||||
<element value="T_YIELD_FROM" />
|
||||
</property>
|
||||
</properties>
|
||||
</rule>
|
||||
|
||||
<!-- Require consistent spacing for block structures -->
|
||||
<rule ref="SlevomatCodingStandard.ControlStructures.BlockControlStructureSpacing">
|
||||
<exclude name="SlevomatCodingStandard.ControlStructures.BlockControlStructureSpacing.IncorrectLinesCountBeforeControlStructure" />
|
||||
<exclude name="SlevomatCodingStandard.ControlStructures.BlockControlStructureSpacing.IncorrectLinesCountBeforeFirstControlStructure" />
|
||||
<properties>
|
||||
<property name="tokensToCheck" type="array">
|
||||
<element value="T_IF" />
|
||||
<element value="T_DO" />
|
||||
<element value="T_WHILE" />
|
||||
<element value="T_FOR" />
|
||||
<element value="T_FOREACH" />
|
||||
<element value="T_SWITCH" />
|
||||
<element value="T_TRY" />
|
||||
<element value="T_DEFAULT" />
|
||||
</property>
|
||||
</properties>
|
||||
</rule>
|
||||
|
||||
<!-- Requires new with parentheses. -->
|
||||
<rule ref="SlevomatCodingStandard.ControlStructures.NewWithParentheses"/>
|
||||
|
||||
<!-- Disallows usage of array type hint syntax (eg. int[], bool[][]) in phpDocs in favour of generic type hint syntax (eg. array<int>, array<array<bool>>) -->
|
||||
<!-- <rule ref="SlevomatCodingStandard.TypeHints.DisallowArrayTypeHintSyntax" />-->
|
||||
</ruleset>
|
||||
@@ -0,0 +1,3 @@
|
||||
<?php
|
||||
|
||||
namespace PHPSTORM_META;
|
||||
@@ -0,0 +1,89 @@
|
||||
<?php
|
||||
|
||||
namespace Flasher\Toastr\Symfony\DependencyInjection;
|
||||
|
||||
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
|
||||
use Symfony\Component\Config\Definition\ConfigurationInterface;
|
||||
|
||||
final class Configuration implements ConfigurationInterface
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getConfigTreeBuilder()
|
||||
{
|
||||
$treeBuilder = new TreeBuilder('flasher_toastr');
|
||||
|
||||
if (\method_exists($treeBuilder, 'getRootNode')) {
|
||||
$rootNode = $treeBuilder->getRootNode();
|
||||
} else {
|
||||
// BC layer for symfony/config 4.1 and older
|
||||
$rootNode = $treeBuilder->root('flasher_toastr');
|
||||
}
|
||||
|
||||
$rootNode
|
||||
->children()
|
||||
->arrayNode('scripts')
|
||||
->prototype('scalar')->end()
|
||||
->defaultValue(array(
|
||||
'https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js',
|
||||
'https://cdnjs.cloudflare.com/ajax/libs/toastr.js/2.1.4/toastr.min.js',
|
||||
'/bundles/flashertoastr/flasher-toastr.js',
|
||||
))
|
||||
->end()
|
||||
->arrayNode('styles')
|
||||
->prototype('scalar')->end()
|
||||
->defaultValue(array(
|
||||
'https://cdnjs.cloudflare.com/ajax/libs/toastr.js/2.1.4/toastr.min.css',
|
||||
))
|
||||
->end()
|
||||
->arrayNode('options')
|
||||
->prototype('variable')->end()
|
||||
->ignoreExtraKeys(false)
|
||||
->defaultValue(array(
|
||||
'closeButton' => true,
|
||||
'closeClass' => 'toast-close-button',
|
||||
'closeDuration' => 300,
|
||||
'closeEasing' => 'swing',
|
||||
'closeHtml' => '<button><i class="icon-off"></i></button>',
|
||||
'closeMethod' => 'fadeOut',
|
||||
'closeOnHover' => true,
|
||||
'containerId' => 'toast-container',
|
||||
'debug' => false,
|
||||
'escapeHtml' => false,
|
||||
'extendedTimeOut' => 10000,
|
||||
'hideDuration' => 1000,
|
||||
'hideEasing' => 'linear',
|
||||
'hideMethod' => 'fadeOut',
|
||||
'iconClass' => 'toast-info',
|
||||
'iconClasses' => array(
|
||||
'error' => 'toast-error',
|
||||
'info' => 'toast-info',
|
||||
'success' => 'toast-success',
|
||||
'warning' => 'toast-warning',
|
||||
),
|
||||
'messageClass' => 'toast-message',
|
||||
'newestOnTop' => false,
|
||||
'onHidden' => null,
|
||||
'onShown' => null,
|
||||
'positionClass' => 'toast-top-right',
|
||||
'preventDuplicates' => false,
|
||||
'progressBar' => true,
|
||||
'progressClass' => 'toast-progress',
|
||||
'rtl' => false,
|
||||
'showDuration' => 300,
|
||||
'showEasing' => 'swing',
|
||||
'showMethod' => 'fadeIn',
|
||||
'tapToDismiss' => true,
|
||||
'target' => 'body',
|
||||
'timeOut' => 5000,
|
||||
'titleClass' => 'toast-title',
|
||||
'toastClass' => 'toast',
|
||||
))
|
||||
->end()
|
||||
->end()
|
||||
;
|
||||
|
||||
return $treeBuilder;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace Flasher\Toastr\Symfony\DependencyInjection;
|
||||
|
||||
use Symfony\Component\Config\FileLocator;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface;
|
||||
use Symfony\Component\DependencyInjection\Loader;
|
||||
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
|
||||
|
||||
final class FlasherToastrExtension extends Extension implements PrependExtensionInterface
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function load(array $configs, ContainerBuilder $container)
|
||||
{
|
||||
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
|
||||
$loader->load('config.yaml');
|
||||
|
||||
$configuration = new Configuration();
|
||||
$this->processConfiguration($configuration, $configs);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function prepend(ContainerBuilder $container)
|
||||
{
|
||||
if (!$container->hasExtension('flasher')) {
|
||||
throw new \RuntimeException('[Flasher\Symfony\FlasherBundle] is not registered');
|
||||
}
|
||||
|
||||
$configs = $container->getExtensionConfig($this->getAlias());
|
||||
$config = $this->processConfiguration(new Configuration(), $configs);
|
||||
|
||||
$container->prependExtensionConfig('flasher', array(
|
||||
'adapters' => array(
|
||||
'toastr' => $config,
|
||||
),
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace Flasher\Toastr\Symfony;
|
||||
|
||||
use Symfony\Component\HttpKernel\Bundle\Bundle;
|
||||
|
||||
class FlasherToastrBundle extends Bundle
|
||||
{
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
MIT License
|
||||
|
||||
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
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
@@ -1,26 +1,12 @@
|
||||
<p align="center">
|
||||
<picture>
|
||||
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/php-flasher/art/main/php-flasher-logo-dark.svg">
|
||||
<img width="600" src="https://raw.githubusercontent.com/php-flasher/art/main/php-flasher-logo.svg" alt="PHPFlasher Logo">
|
||||
</picture>
|
||||
</p>
|
||||
<p align="center"><img width="600" alt="notify" src="https://user-images.githubusercontent.com/10859693/100492861-fabfd800-3130-11eb-8c5e-242fff1706a9.png"></p>
|
||||
|
||||
<p align="center">Flexible flash notifications system for PHP</p>
|
||||
<h1 align="center">Easy flash notifications for PHP, Laravel, Symfony, Lumen</h1>
|
||||
|
||||
Flash messages are a great way to add some simple notifications to users of your website or application about important events that may have happened.
|
||||
|
||||
PHPFlasher gives a straightforward way to give feedback messages in the current or the next page to users with a flashing system.
|
||||
|
||||
The flashing system basically makes it possible to record a message and store it within the session so that it can be retrieved when needed.
|
||||
|
||||
|
||||
## Official Documentation
|
||||
|
||||
Documentation for PHPFlasher can be found on the [PHPFlasher website](https://php-flasher.io).
|
||||
<p align="center">:eyes: PHP Flasher library helps you to add flash notifications to your 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">
|
||||
<img src="https://img.shields.io/badge/source-php--notify/notify-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">
|
||||
@@ -36,41 +22,30 @@ Documentation for PHPFlasher can be found on the [PHPFlasher website](https://ph
|
||||
</a>
|
||||
</p>
|
||||
|
||||
# Why use PHPFlasher ?
|
||||
## Introduction
|
||||
|
||||
The PHPFlasher project supports many notification libraries : [__toastr.js__](https://php-flasher.io/docs/adapter/toastr/), [__sweetalert 2__](https://php-flasher.io/docs/adapter/sweetalert/), [__pnotify__](https://php-flasher.io/docs/adapter/pnotify/), [__noty__](https://php-flasher.io/docs/adapter/noty/) and [__notyf__](https://php-flasher.io/docs/adapter/notyf/)
|
||||
and its highly extendable so you can add your custom notifications.
|
||||
PHP Flasher library helps you to add flash notifications to your 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.
|
||||
|
||||
# Why use PHP Flasher ?
|
||||
|
||||
The PHP Flasher project supports a variety of notification libraries : __toastr.js__, __sweet alert 2__, __pnotify__ and __notyf__
|
||||
and its highly extendable so you can add custom adapters.
|
||||
|
||||
This library is designed, so you can take full control when creating you notifications :
|
||||
|
||||
> * Show various notifications simultaneously
|
||||
> * Render notification easily from javascript with small footprint
|
||||
> * LTR and Dark-mode support
|
||||
> * Limit the amount of displayed notifications
|
||||
> * Show Desktop notifications for Linux, macOS and Windows
|
||||
> * Framework-agnostic with implementations for: Symfony and Laravel
|
||||
> * Autocomplete for PHPSTORM
|
||||
> * You can always create an adapter yourself
|
||||
> * Display multiple notifications
|
||||
> * Sort and filter notifications
|
||||
> * Render notification from JSON response with Ajax or Websockets
|
||||
> * Limit the number of displayed notifications
|
||||
> * Show notifications from different adapters at the same time
|
||||
> * implementations for popular frameworks : Symfony and Laravel
|
||||
> * ...and more
|
||||
|
||||
|
||||
## Official Documentation
|
||||
|
||||
Documentation for PHPFlasher can be found on the [PHPFlasher website](https://php-flasher.io).
|
||||
|
||||
### 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/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)
|
||||
Documentation for Valet can be found on the [PHP Flasher website](https://php-flasher.github.io/).
|
||||
|
||||
## License
|
||||
|
||||
PHPFlasher is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).
|
||||
|
||||
<p align="center"> <b>Made with ❤️ by <a href="https://www.linkedin.com/in/younes-khoubza/">Younes KHOUBZA</a> <b> </p>
|
||||
PHP Flasher is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
services:
|
||||
flasher.toastr:
|
||||
parent: 'flasher.notification_factory'
|
||||
class: Flasher\Toastr\Prime\ToastrFactory
|
||||
tags:
|
||||
- { name: 'flasher.factory', alias: 'toastr' }
|
||||
|
||||
Flasher\Toastr\Prime\ToastrFactory: '@flasher.toastr'
|
||||
@@ -0,0 +1,16 @@
|
||||
PHPFlasher.addFactory('toastr', (function () {
|
||||
'use strict';
|
||||
|
||||
var exports = {};
|
||||
|
||||
exports.render = function (data) {
|
||||
var notification = data.notification;
|
||||
toastr[notification.type](notification.message, notification.title, notification.options);
|
||||
};
|
||||
|
||||
exports.renderOptions = function (options) {
|
||||
toastr.options = options;
|
||||
};
|
||||
|
||||
return exports;
|
||||
})());
|
||||
@@ -0,0 +1,82 @@
|
||||
<?php
|
||||
|
||||
namespace Flasher\Toastr\Symfony\Tests\DependencyInjection;
|
||||
|
||||
use Flasher\Prime\Tests\TestCase;
|
||||
use Flasher\Toastr\Symfony\DependencyInjection\Configuration;
|
||||
use Symfony\Component\Config\Definition\Processor;
|
||||
|
||||
class ConfigurationTest extends TestCase
|
||||
{
|
||||
public function testDefaultConfig()
|
||||
{
|
||||
$config = $this->process(array());
|
||||
|
||||
$expected = array(
|
||||
'scripts' => array(
|
||||
'https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js',
|
||||
'https://cdnjs.cloudflare.com/ajax/libs/toastr.js/2.1.4/toastr.min.js',
|
||||
'/bundles/flashertoastr/flasher-toastr.js',
|
||||
),
|
||||
'styles' => array(
|
||||
'https://cdnjs.cloudflare.com/ajax/libs/toastr.js/2.1.4/toastr.min.css',
|
||||
),
|
||||
'options' =>array(
|
||||
'closeButton' => true,
|
||||
'closeClass' => 'toast-close-button',
|
||||
'closeDuration' => 300,
|
||||
'closeEasing' => 'swing',
|
||||
'closeHtml' => '<button><i class="icon-off"></i></button>',
|
||||
'closeMethod' => 'fadeOut',
|
||||
'closeOnHover' => true,
|
||||
'containerId' => 'toast-container',
|
||||
'debug' => false,
|
||||
'escapeHtml' => false,
|
||||
'extendedTimeOut' => 10000,
|
||||
'hideDuration' => 1000,
|
||||
'hideEasing' => 'linear',
|
||||
'hideMethod' => 'fadeOut',
|
||||
'iconClass' => 'toast-info',
|
||||
'iconClasses' => array(
|
||||
'error' => 'toast-error',
|
||||
'info' => 'toast-info',
|
||||
'success' => 'toast-success',
|
||||
'warning' => 'toast-warning',
|
||||
),
|
||||
'messageClass' => 'toast-message',
|
||||
'newestOnTop' => false,
|
||||
'onHidden' => null,
|
||||
'onShown' => null,
|
||||
'positionClass' => 'toast-top-right',
|
||||
'preventDuplicates' => false,
|
||||
'progressBar' => true,
|
||||
'progressClass' => 'toast-progress',
|
||||
'rtl' => false,
|
||||
'showDuration' => 300,
|
||||
'showEasing' => 'swing',
|
||||
'showMethod' => 'fadeIn',
|
||||
'tapToDismiss' => true,
|
||||
'target' => 'body',
|
||||
'timeOut' => 5000,
|
||||
'titleClass' => 'toast-title',
|
||||
'toastClass' => 'toast',
|
||||
)
|
||||
);
|
||||
|
||||
$this->assertSame($expected, $config);
|
||||
}
|
||||
|
||||
/**
|
||||
* Processes an array of configurations and returns a compiled version.
|
||||
*
|
||||
* @param array $configs An array of raw configurations
|
||||
*
|
||||
* @return array A normalized array
|
||||
*/
|
||||
private function process($configs)
|
||||
{
|
||||
$processor = new Processor();
|
||||
|
||||
return $processor->processConfiguration(new Configuration(), $configs);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
<?php
|
||||
|
||||
namespace Flasher\Toastr\Symfony\Tests\DependencyInjection;
|
||||
|
||||
use Flasher\Prime\Tests\TestCase;
|
||||
use Flasher\Symfony\DependencyInjection\FlasherExtension;
|
||||
use Flasher\Symfony\FlasherBundle;
|
||||
use Flasher\Toastr\Symfony\DependencyInjection\FlasherToastrExtension;
|
||||
use Flasher\Toastr\Symfony\FlasherToastrBundle;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
|
||||
class FlasherToastrExtensionTest extends TestCase
|
||||
{
|
||||
public function testContainerContainFlasherServices()
|
||||
{
|
||||
$container = $this->getRawContainer();
|
||||
$container->loadFromExtension('flasher', array());
|
||||
$container->loadFromExtension('flasher_toastr', array());
|
||||
$container->compile();
|
||||
|
||||
$this->assertTrue($container->has('flasher.toastr'));
|
||||
}
|
||||
|
||||
public function testCreateInstanceOfToastrAdapter()
|
||||
{
|
||||
$container = $this->getRawContainer();
|
||||
$container->loadFromExtension('flasher');
|
||||
$container->loadFromExtension('flasher_toastr');
|
||||
$container->compile();
|
||||
|
||||
$flasher = $container->getDefinition('flasher');
|
||||
$calls = $flasher->getMethodCalls();
|
||||
|
||||
$this->assertCount(2, $calls);
|
||||
$this->assertSame('addFactory', $calls[0][0]);
|
||||
$this->assertSame('template', $calls[0][1][0]);
|
||||
$this->assertSame('flasher.notification_factory', (string) $calls[0][1][1]);
|
||||
|
||||
$this->assertSame('addFactory', $calls[1][0]);
|
||||
$this->assertSame('toastr', $calls[1][1][0]);
|
||||
$this->assertSame('flasher.toastr', (string) $calls[1][1][1]);
|
||||
}
|
||||
|
||||
public function testConfigurationInjectedIntoFlasherConfig()
|
||||
{
|
||||
$container = $this->getContainer();
|
||||
$config = $container->get('flasher.config');
|
||||
$this->assertNotEmpty($config->get('adapters.toastr'));
|
||||
}
|
||||
|
||||
private function getRawContainer()
|
||||
{
|
||||
$container = new ContainerBuilder();
|
||||
|
||||
$container->registerExtension(new FlasherExtension());
|
||||
$flasherBundle = new FlasherBundle();
|
||||
$flasherBundle->build($container);
|
||||
|
||||
$container->registerExtension(new FlasherToastrExtension());
|
||||
$adapterBundle = new FlasherToastrBundle();
|
||||
$adapterBundle->build($container);
|
||||
|
||||
$container->getCompilerPassConfig()->setOptimizationPasses(array());
|
||||
$container->getCompilerPassConfig()->setRemovingPasses(array());
|
||||
$container->getCompilerPassConfig()->setAfterRemovingPasses(array());
|
||||
|
||||
return $container;
|
||||
}
|
||||
|
||||
private function getContainer()
|
||||
{
|
||||
$container = $this->getRawContainer();
|
||||
$container->compile();
|
||||
|
||||
return $container;
|
||||
}
|
||||
}
|
||||
+47
-13
@@ -1,22 +1,56 @@
|
||||
{
|
||||
"name": "php-flasher/php-pack",
|
||||
"description": "A pack for PHP",
|
||||
"type": "flasher-pack",
|
||||
"license": "MIT",
|
||||
"name": "php-flasher/flasher-toastr-symfony",
|
||||
"type": "symfony-bundle",
|
||||
"description": "PHP Flasher Symfony adapter for Toastr",
|
||||
"keywords": [
|
||||
"yoeunes",
|
||||
"notify",
|
||||
"php",
|
||||
"laravel",
|
||||
"symfony",
|
||||
"Lumen",
|
||||
"notifications",
|
||||
"messages",
|
||||
"alerts",
|
||||
"pnotify",
|
||||
"toastr ",
|
||||
"bundle",
|
||||
"flex"
|
||||
],
|
||||
"homepage": "https://github.com/php-flasher/flasher-symfony-toastr",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Younes KHOUBZA",
|
||||
"name": "Younes Khoubza",
|
||||
"email": "younes.khoubza@gmail.com",
|
||||
"homepage": "https://www.linkedin.com/in/younes-khoubza",
|
||||
"homepage": "https://github.com/yoeunes",
|
||||
"role": "Developer"
|
||||
}
|
||||
],
|
||||
"license": "MIT",
|
||||
"require": {
|
||||
"php-flasher/flasher-cli": "*",
|
||||
"php-flasher/flasher-noty": "*",
|
||||
"php-flasher/flasher-notyf": "*",
|
||||
"php-flasher/flasher-pnotify": "*",
|
||||
"php-flasher/flasher-sweetalert": "*",
|
||||
"php-flasher/flasher-toastr": "*"
|
||||
}
|
||||
"php": ">=5.3",
|
||||
"php-flasher/flasher-symfony": "^0.1",
|
||||
"php-flasher/flasher-toastr": "^0.1"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^4.8|^5.0|^6.0|^7.0|^8.0|^9.0"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Flasher\\Toastr\\Symfony\\": ""
|
||||
},
|
||||
"exclude-from-classmap": [
|
||||
"/Tests/"
|
||||
]
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"Flasher\\Toastr\\Symfony\\Tests\\": "Tests/"
|
||||
}
|
||||
},
|
||||
"config": {
|
||||
"sort-packages": true
|
||||
},
|
||||
"minimum-stability": "dev",
|
||||
"prefer-stable": true
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
<?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>
|
||||
Reference in New Issue
Block a user