You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Contributions are **welcome** and will be fully **credited**.
4
+
5
+
Please read and understand the contribution guide before creating an issue or pull request.
6
+
7
+
## Etiquette
8
+
9
+
This project is open source, and as such, the maintainers give their free time to build and maintain the source code
10
+
held within. They make the code freely available in the hope that it will be of use to other developers. It would be
11
+
extremely unfair for them to suffer abuse or anger for their hard work.
12
+
13
+
Please be considerate towards maintainers when raising issues or presenting pull requests. Let's show the
14
+
world that developers are civilized and selfless people.
15
+
16
+
It's the duty of the maintainer to ensure that all submissions to the project are of sufficient
17
+
quality to benefit the project. Many developers have different skillsets, strengths, and weaknesses. Respect the maintainer's decision, and do not be upset or abusive if your submission is not used.
18
+
19
+
## Viability
20
+
21
+
When requesting or submitting new features, first consider whether it might be useful to others. Open
22
+
source projects are used by many developers, who may have entirely different needs to your own. Think about
23
+
whether or not your feature is likely to be used by other users of the project.
24
+
25
+
## Procedure
26
+
27
+
Before filing an issue:
28
+
29
+
- Attempt to replicate the problem, to ensure that it wasn't a coincidental incident.
30
+
- Check to make sure your feature suggestion isn't already present within the project.
31
+
- Check the pull requests tab to ensure that the bug doesn't have a fix in progress.
32
+
- Check the pull requests tab to ensure that the feature isn't already in progress.
33
+
34
+
Before submitting a pull request:
35
+
36
+
- Check the codebase to ensure that your feature doesn't already exist.
37
+
- Check the pull requests to ensure that another person hasn't already submitted the feature or fix.
38
+
39
+
## Requirements
40
+
41
+
If the project maintainer has any additional requirements, you will find them listed here.
42
+
43
+
-**[PSR-2 Coding Standard](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md)** - The standard can be enforced by running the `composer lint` console command.
44
+
45
+
-**Add tests!** - Your patch won't be accepted if it doesn't have tests.
46
+
47
+
-**Document any change in behaviour** - Make sure the `README.md` and any other relevant documentation are kept up-to-date.
48
+
49
+
-**Consider our release cycle** - We try to follow [SemVer v2.0.0](https://semver.org/). Randomly breaking public APIs is not an option.
50
+
51
+
-**One pull request per feature** - If you want to do more than one thing, send multiple pull requests.
52
+
53
+
-**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](https://www.git-scm.com/book/en/v2/Git-Tools-Rewriting-History#Changing-Multiple-Commit-Messages) before submitting.
If you have found any issue regarding security, please send an email [report@defstudio.it](mailto:report@defstudio.it) instead of using the issue tracker and we will quickly work on it.
[](https://packagist.org/packages/:vendor_slug/:package_slug)
[](https://packagist.org/packages/defstudio/enum-features)
We invest a lot of resources into creating [best in class open source packages](https://spatie.be/open-source). You can support us by [buying one of our paid products](https://spatie.be/open-source/support-us).
10
+
A simple trait to enable a feature system using Enums:
24
11
25
-
We highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using. You'll find our address on [our contact page](https://spatie.be/about-us). We publish all received postcards on [our virtual postcard wall](https://spatie.be/open-source/postcards).
throw(new Exception("Impersonate feature is not enabled"));
72
+
}
66
73
```
67
74
75
+
or enforced
76
+
77
+
```php
78
+
79
+
AppFeature::impersonate->enforce(); //throws "Feature [impersonate] is not enabled"
80
+
81
+
```
82
+
83
+
### Customizing where and how to store enabled features
84
+
85
+
Enabled features are usually stored in config('app.features'), but this behaviour can be customized by
86
+
overriding the `enabledFeatures()` static method inside the enum class:
87
+
88
+
89
+
```php
90
+
use DefStudio\EnumFeatures\EnumFeatures;
91
+
92
+
enum AppFeature
93
+
{
94
+
use DefinesFeatures; // ← simply add this
95
+
96
+
case multi_language;
97
+
case impersonate;
98
+
case welcome_email;
99
+
100
+
public static function enabledFeatures(): array
101
+
{
102
+
return config('my_package.features', []); //or load from DB, or every other method
103
+
}
104
+
}
105
+
106
+
```
107
+
**note:** changing how enabled features are checked makes this package framework agnostic and it can be used in any php applicaiton
108
+
68
109
## Testing
69
110
70
111
```bash
@@ -73,21 +114,26 @@ composer test
73
114
74
115
## Changelog
75
116
76
-
Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.
117
+
Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.[Follow Us](https://twitter.com/FabioIvona) on Twitter for more updates about this package.
77
118
78
119
## Contributing
79
120
80
-
Please see [CONTRIBUTING](CONTRIBUTING.md) for details.
121
+
Please see [CONTRIBUTING](.github/CONTRIBUTING.md) for details.
81
122
82
123
## Security Vulnerabilities
83
124
84
125
Please review [our security policy](../../security/policy) on how to report security vulnerabilities.
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.
136
+
137
+
## Support us
138
+
139
+
We at [def:studio](https://github.com/defstudio) strongly believe that open source is the foundation of all our business and we try to contribute to it by helping other projects to grow along with developing and maintaining our packages. You can support our work by sponsoring us on [github](https://github.com/sponsors/defstudio)!
0 commit comments