Skip to content

Commit e1c2424

Browse files
committed
first commit
0 parents  commit e1c2424

7 files changed

Lines changed: 908 additions & 0 deletions

File tree

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
var/
2+
vendor/
3+
composer.lock

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 Esteban De La Fuente Rubio / Derafu <https://www.derafu.org>
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: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Derafu: Enum - Yet Another List of Enumerations for PHP
2+
3+
A PHP repository for global enumerations.
4+
5+
## Note on Enumerations
6+
7+
While this package provides a basic set of enumerations for specific use cases, it is highly recommended to consider using [PrinsFrank/standards](https://github.com/PrinsFrank/standards) for more comprehensive enumeration needs. The PrinsFrank/standards package offers:
8+
9+
- A more extensive collection of standardized enumerations.
10+
- Regular updates based on international standards.
11+
- Better maintained and widely adopted in the PHP community.
12+
- More robust validation and type-safety features.
13+
14+
This package (derafu/enum) should be considered primarily for very specific use cases where the more comprehensive solution might be unnecessary or when you need custom enumerations not covered by standard libraries.
15+
16+
## Installation
17+
18+
You can install the package via composer:
19+
20+
```bash
21+
composer require derafu/enum
22+
```
23+
24+
## Contributing
25+
26+
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
27+
28+
## License
29+
30+
This package is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).

composer.json

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{
2+
"name": "derafu/enum",
3+
"description": "Derafu: Enum - Yet Another List of Enumerations for PHP",
4+
"type": "library",
5+
"homepage": "https://derafu.org/enum",
6+
"license": "MIT",
7+
"authors": [
8+
{
9+
"name": "Esteban De La Fuente Rubio / Derafu",
10+
"homepage": "https://www.derafu.org"
11+
}
12+
],
13+
"support": {
14+
"issues": "https://github.com/derafu/enum/issues",
15+
"source": "https://github.com/derafu/enum"
16+
},
17+
"autoload": {
18+
"psr-4": {
19+
"Derafu\\Enum\\": "src/"
20+
}
21+
},
22+
"require": {
23+
"php": "^8.3"
24+
},
25+
"require-dev": {
26+
"friendsofphp/php-cs-fixer": "^3.63",
27+
"phpstan/phpstan": "^1.12"
28+
},
29+
"scripts": {
30+
"phpcs-fix": "vendor/bin/php-cs-fixer fix -v --config=php-cs-fixer.php",
31+
"phpcs-fix-dry-run": "vendor/bin/php-cs-fixer fix -v --dry-run --diff --config=php-cs-fixer.php",
32+
"phpstan": "vendor/bin/phpstan analyse --configuration=phpstan.neon --memory-limit=1G",
33+
"phpstan-export": "vendor/bin/phpstan analyse --configuration=phpstan.neon --level 9 --generate-baseline"
34+
}
35+
}

php-cs-fixer.php

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
/**
6+
* Derafu: Foundation - Base for Derafu's Projects.
7+
*
8+
* Copyright (c) 2025 Esteban De La Fuente Rubio / Derafu <https://www.derafu.org>
9+
* Licensed under the MIT License.
10+
* See LICENSE file for more details.
11+
*/
12+
13+
/**
14+
* Configuration file for PHP CS Fixer.
15+
*/
16+
17+
use PhpCsFixer\Config;
18+
use PhpCsFixer\Finder;
19+
20+
$dir = __DIR__;
21+
22+
$finder = Finder::create()
23+
->in($dir)
24+
->exclude('var')
25+
;
26+
27+
return (new Config())
28+
// Allow risky rules that may change code logic.
29+
->setRiskyAllowed(true)
30+
// Based on PSR-12, the latest style recommendation.
31+
->setRules([
32+
'@PSR12' => true,
33+
// Add "declare(strict_types=1);" to files.
34+
// This adds it like <?php declare(strict_types=1); however, it is
35+
// recommended to edit or add it manually on separate lines.
36+
'declare_strict_types' => true,
37+
// Indent using spaces.
38+
'indentation_type' => true,
39+
// Sort "use" statements alphabetically.
40+
'ordered_imports' => [
41+
'sort_algorithm' => 'alpha',
42+
],
43+
// Remove unused imports.
44+
'no_unused_imports' => true,
45+
// One import per statement.
46+
'single_import_per_statement' => true,
47+
// Convert arrays to short syntax "[]".
48+
'array_syntax' => [
49+
'syntax' => 'short',
50+
],
51+
// Add trailing commas in multi-line arrays.
52+
'trailing_comma_in_multiline' => true,
53+
// Separate constants and properties.
54+
'class_attributes_separation' => [
55+
'elements' => [
56+
'const' => 'one',
57+
'property' => 'one',
58+
'method' => 'one',
59+
],
60+
],
61+
// Replace strpos with a boolean-returning function.
62+
// Example: use str_contains().
63+
'modernize_strpos' => true,
64+
// Convert anonymous functions to arrow functions.
65+
'use_arrow_functions' => true,
66+
// Use PHPUnit constructors instead of factory methods.
67+
'php_unit_construct' => true,
68+
// Use stricter assertions in PHPUnit.
69+
// Example: use assertSame() instead of assertEquals().
70+
'php_unit_strict' => true,
71+
])
72+
->setLineEnding("\n")
73+
->setCacheFile($dir . '/var/cache/php-cs-fixer.cache')
74+
->setFinder($finder)
75+
;

phpstan.neon

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
parameters:
2+
# Review level, from basic (1) to very thorough (9).
3+
level: 5
4+
# Source code directories to be reviewed.
5+
paths:
6+
- src

0 commit comments

Comments
 (0)