Skip to content

Commit 0b09086

Browse files
committed
first commit
0 parents  commit 0b09086

18 files changed

+569
-0
lines changed

.editorconfig

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
; This file is for unifying the coding style for different editors and IDEs.
2+
; More information at https://editorconfig.org
3+
4+
root = true
5+
6+
[*]
7+
charset = utf-8
8+
indent_size = 4
9+
indent_style = space
10+
end_of_line = lf
11+
insert_final_newline = true
12+
trim_trailing_whitespace = true
13+
14+
[*.md]
15+
trim_trailing_whitespace = false
16+
17+
[*.yml]
18+
indent_size = 2

.gitattributes

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Set the default behavior, in case people don't have core.autocrlf set.
2+
* text eol=lf
3+
4+
# Explicitly declare text files you want to always be normalized and converted
5+
# to native line endings on checkout.
6+
*.c text
7+
*.h text
8+
9+
# Declare files that will always have CRLF line endings on checkout.
10+
*.sln text eol=crlf
11+
12+
# Denote all files that are truly binary and should not be modified.
13+
*.png binary
14+
*.jpg binary
15+
*.otf binary
16+
*.eot binary
17+
*.svg binary
18+
*.ttf binary
19+
*.woff binary
20+
*.woff2 binary
21+
22+
*.css linguist-vendored
23+
*.scss linguist-vendored
24+
*.js linguist-vendored
25+
CHANGELOG.md export-ignore

.github/workflows/tests.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Tests
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
tests:
7+
8+
name: PHP ${{ matrix.php }}
9+
10+
runs-on: ubuntu-latest
11+
12+
strategy:
13+
matrix:
14+
php: ['8.0', '8.1']
15+
16+
steps:
17+
- name: Checkout code
18+
uses: actions/checkout@v2
19+
20+
- name: Cache composer
21+
uses: actions/cache@v1
22+
with:
23+
path: ~/.composer/cache/files
24+
key: php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}
25+
26+
- name: Setup PHP
27+
uses: shivammathur/setup-php@v2
28+
with:
29+
php-version: ${{ matrix.php }}
30+
extension-csv: bcmath, ctype, dom, fileinfo, intl, gd, json, mbstring, pdo, pdo_sqlite, openssl, sqlite, xml, zip
31+
coverage: none
32+
33+
- name: Install composer
34+
run: composer install --no-interaction --no-scripts --no-suggest --prefer-source
35+
36+
- name: Execute tests
37+
run: php artisan test --parallel

.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/.idea
2+
/.history
3+
/.vscode
4+
/tests/databases
5+
/vendor
6+
.DS_Store
7+
.phpunit.result.cache
8+
composer.phar
9+
composer.lock

.scrutinizer.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
filter:
2+
excluded_paths:
3+
- tests/*
4+
5+
checks:
6+
php:
7+
code_rating: true
8+
9+
tools:
10+
external_code_coverage: true
11+
php_analyzer: true
12+
php_changetracking: true
13+
php_code_sniffer:
14+
config:
15+
standard: "PSR2"
16+
php_cpd: true
17+
php_mess_detector: true
18+
php_pdepend: true
19+
sensiolabs_security_checker: true

.styleci.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
preset: psr2
2+
3+
enabled:
4+
- concat_with_spaces

LICENSE.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2021 Akaunting
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# Mutable observer package for Laravel
2+
3+
![Downloads](https://img.shields.io/packagist/dt/akaunting/laravel-mutable-observer)
4+
![Tests](https://img.shields.io/github/workflow/status/akaunting/laravel-mutable-observer/Tests?label=tests)
5+
[![StyleCI](https://github.styleci.io/repos/442271942/shield?style=flat&branch=master)](https://styleci.io/repos/442271942)
6+
[![Quality](https://img.shields.io/scrutinizer/quality/g/akaunting/laravel-mutable-observer?label=quality)](https://scrutinizer-ci.com/g/akaunting/laravel-mutable-observer)
7+
[![License](https://img.shields.io/github/license/akaunting/laravel-mutable-observer)](LICENSE.md)
8+
9+
This package allows you to `mute` and `unmute` a specific observer at will. It ships with a trait that adds mutable methods to your observer.
10+
11+
## Installation
12+
13+
Run the following command:
14+
15+
```bash
16+
composer require akaunting/laravel-mutable-observer
17+
```
18+
19+
## Usage
20+
21+
All you have to do is use the `Mutable` trait inside your observer.
22+
23+
```php
24+
namespace App\Observers;
25+
26+
use Akaunting\MutableObserver\Traits\Mutable;
27+
28+
class UserObserver
29+
{
30+
use Mutable;
31+
}
32+
```
33+
34+
Now you can `mute` and `unmute` the observer as needed:
35+
36+
```php
37+
UserObserver::mute();
38+
39+
// Some logic, i.e. test
40+
41+
UserObserver::unmute();
42+
```
43+
44+
## Changelog
45+
46+
Please see [Releases](../../releases) for more information what has changed recently.
47+
48+
## Contributing
49+
50+
Pull requests are more than welcome. You must follow the PSR coding standards.
51+
52+
## Security
53+
54+
Please review [our security policy](https://github.com/akaunting/laravel-sortable/security/policy) on how to report security vulnerabilities.
55+
56+
## Credits
57+
58+
- [Denis Duliçi](https://github.com/denisdulici)
59+
- [Stephen Lewis](https://github.com/monooso)
60+
- [All Contributors](../../contributors)
61+
62+
## License
63+
64+
The MIT License (MIT). Please see [LICENSE](LICENSE.md) for more information.

SECURITY.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Security Policy
2+
3+
**PLEASE DON'T DISCLOSE SECURITY-RELATED ISSUES PUBLICLY, [SEE BELOW](#reporting-a-vulnerability).**
4+
5+
## Reporting a Vulnerability
6+
7+
If you discover any security related issues, please email [email protected] instead of using the issue tracker.

composer.json

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
{
2+
"name": "akaunting/laravel-mutable-observer",
3+
"description": "Mutable observer package for Laravel",
4+
"keywords": [
5+
"laravel",
6+
"observer",
7+
"mutable",
8+
"mute",
9+
"unmute"
10+
],
11+
"license": "MIT",
12+
"authors": [
13+
{
14+
"name": "Denis Duliçi",
15+
"email": "[email protected]",
16+
"homepage": "https://akaunting.com",
17+
"role": "Developer"
18+
}
19+
],
20+
"require": {
21+
"php": ">=8.0",
22+
"laravel/framework": ">=8.0"
23+
},
24+
"require-dev": {
25+
"phpunit/phpunit": ">=9.0",
26+
"orchestra/testbench": ">=7.0"
27+
},
28+
"autoload": {
29+
"psr-4": {
30+
"Akaunting\\MutableObserver\\": "src"
31+
}
32+
},
33+
"autoload-dev": {
34+
"psr-4": {
35+
"Akaunting\\MutableObserver\\Tests\\": "tests"
36+
}
37+
},
38+
"extra": {
39+
"laravel": {
40+
"providers": [
41+
"Akaunting\\MutableObserver\\Provider"
42+
]
43+
}
44+
}
45+
}

0 commit comments

Comments
 (0)