Skip to content

Commit ea75148

Browse files
committed
Initial commit
1 parent 237d7ce commit ea75148

13 files changed

+489
-37
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+
end_of_line = lf
9+
insert_final_newline = true
10+
indent_style = space
11+
indent_size = 4
12+
trim_trailing_whitespace = true
13+
14+
[*.md]
15+
trim_trailing_whitespace = false
16+
17+
[*.{yml, yaml}]
18+
indent_size = 2

.github/workflows/tests.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Tests
2+
3+
on:
4+
- push
5+
- pull_request
6+
7+
jobs:
8+
tests:
9+
name: PHP ${{ matrix.php }}
10+
runs-on: ubuntu-latest
11+
timeout-minutes: 5
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
php:
16+
- 8.1
17+
- 8.2
18+
- 8.3
19+
- 8.4
20+
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v4
24+
25+
- name: Setup PHP
26+
uses: shivammathur/setup-php@v2
27+
with:
28+
php-version: ${{ matrix.php }}
29+
coverage: pcov
30+
31+
- name: Install PHP dependencies
32+
run: composer install --prefer-dist --no-interaction
33+
34+
- name: Unit Tests
35+
run: composer test

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/vendor
2+
.php_cs.cache
3+
.phpunit.cache
4+
composer.lock
5+
coverage

.php-cs-fixer.cache

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"php":"8.2.29","version":"3.85.1:v3.85.1#2fb6d7f6c3398dca5786a1635b27405d73a417ba","indent":" ","lineEnding":"\n","rules":{"align_multiline_comment":true,"array_indentation":true,"array_syntax":{"syntax":"short"},"blank_line_after_namespace":true,"blank_line_after_opening_tag":true,"braces":true,"cast_spaces":true,"concat_space":{"spacing":"one"},"curly_braces_position":{"control_structures_opening_brace":"same_line","functions_opening_brace":"next_line_unless_newline_at_signature_end","anonymous_functions_opening_brace":"same_line","classes_opening_brace":"next_line_unless_newline_at_signature_end","anonymous_classes_opening_brace":"next_line_unless_newline_at_signature_end","allow_single_line_empty_anonymous_classes":false,"allow_single_line_anonymous_functions":false},"declare_equal_normalize":true,"declare_strict_types":true,"elseif":true,"encoding":true,"full_opening_tag":true,"fully_qualified_strict_types":true,"function_declaration":true,"function_typehint_space":true,"heredoc_to_nowdoc":true,"include":true,"increment_style":{"style":"post"},"indentation_type":true,"linebreak_after_opening_tag":true,"line_ending":true,"lowercase_cast":true,"lowercase_keywords":true,"lowercase_static_reference":true,"magic_method_casing":true,"magic_constant_casing":true,"method_argument_space":true,"method_chaining_indentation":true,"native_constant_invocation":{"fix_built_in":true,"scope":"namespaced","strict":true},"native_function_casing":true,"native_function_invocation":{"include":["@compiler_optimized"],"scope":"namespaced","strict":true},"no_alias_functions":true,"no_extra_blank_lines":{"tokens":["extra","throw","use","use_trait"]},"no_blank_lines_after_class_opening":true,"no_blank_lines_after_phpdoc":true,"no_closing_tag":true,"no_empty_phpdoc":true,"no_empty_statement":true,"no_leading_import_slash":true,"no_leading_namespace_whitespace":true,"no_mixed_echo_print":{"use":"echo"},"no_multiline_whitespace_around_double_arrow":true,"multiline_whitespace_before_semicolons":{"strategy":"no_multi_line"},"no_short_bool_cast":true,"no_singleline_whitespace_before_semicolons":true,"no_spaces_after_function_name":true,"no_spaces_inside_parenthesis":true,"no_trailing_comma_in_singleline":true,"no_trailing_whitespace":true,"no_trailing_whitespace_in_comment":true,"no_unreachable_default_argument_value":true,"no_unused_imports":true,"no_useless_return":true,"no_whitespace_before_comma_in_array":true,"no_whitespace_in_blank_line":true,"normalize_index_brace":true,"not_operator_with_successor_space":true,"object_operator_without_whitespace":true,"phpdoc_align":true,"phpdoc_indent":true,"phpdoc_no_access":true,"phpdoc_no_package":true,"phpdoc_no_useless_inheritdoc":true,"phpdoc_scalar":true,"phpdoc_single_line_var_spacing":true,"phpdoc_summary":true,"phpdoc_to_comment":true,"phpdoc_trim":true,"phpdoc_types":true,"phpdoc_var_without_name":true,"return_type_declaration":true,"self_accessor":true,"short_scalar_cast":true,"single_blank_line_at_eof":true,"single_blank_line_before_namespace":true,"single_class_element_per_statement":true,"single_import_per_statement":true,"single_line_after_imports":true,"single_line_comment_style":{"comment_types":["hash"]},"single_quote":true,"single_trait_insert_per_statement":true,"space_after_semicolon":true,"standardize_not_equals":true,"switch_case_semicolon_to_colon":true,"switch_case_space":true,"ternary_operator_spaces":true,"trim_array_spaces":true,"unary_operator_spaces":true,"whitespace_after_comma_in_array":true,"constant_case":{"case":"lower"},"general_phpdoc_tag_rename":true,"phpdoc_inline_tag_normalizer":true,"phpdoc_tag_type":true,"psr_autoloading":true,"trailing_comma_in_multiline":{"elements":["arrays"]},"binary_operator_spaces":{"default":"single_space","operators":[]},"blank_line_before_statement":{"statements":["return"]},"class_attributes_separation":{"elements":{"const":"one","method":"one","property":"one"}},"class_definition":{"multi_line_extends_each_single_line":true,"single_item_single_line":true,"single_line":true},"ordered_imports":{"sort_algorithm":"alpha"},"no_unneeded_control_parentheses":{"statements":["break","clone","continue","echo_print","return","switch_case","yield"]},"no_spaces_around_offset":{"positions":["inside","outside"]},"visibility_required":{"elements":["property","method","const"]}},"hashes":{"src\/AppVersionServiceProvider.php":"4db6700e1405aa72dd93705ee6d5ab56","tests\/AppVersionTest.php":"3212dc240f927c583969a677f7b02ee3","tests\/TestCase.php":"80fb6d61dd9acaad9bb7011149f5b121"}}

.php-cs-fixer.dist.php

Lines changed: 195 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,195 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
use PhpCsFixer\Config;
6+
use PhpCsFixer\Finder;
7+
use PhpCsFixer\Runner\Parallel\ParallelConfigFactory;
8+
9+
$rules = [
10+
'align_multiline_comment' => true,
11+
'array_indentation' => true,
12+
'array_syntax' => ['syntax' => 'short'],
13+
'blank_line_after_namespace' => true,
14+
'blank_line_after_opening_tag' => true,
15+
'braces' => true,
16+
'cast_spaces' => true,
17+
'concat_space' => [
18+
'spacing' => 'one',
19+
],
20+
'curly_braces_position' => [
21+
'control_structures_opening_brace' => 'same_line',
22+
'functions_opening_brace' => 'next_line_unless_newline_at_signature_end',
23+
'anonymous_functions_opening_brace' => 'same_line',
24+
'classes_opening_brace' => 'next_line_unless_newline_at_signature_end',
25+
'anonymous_classes_opening_brace' => 'next_line_unless_newline_at_signature_end',
26+
'allow_single_line_empty_anonymous_classes' => false,
27+
'allow_single_line_anonymous_functions' => false,
28+
],
29+
'declare_equal_normalize' => true,
30+
'declare_strict_types' => true,
31+
'elseif' => true,
32+
'encoding' => true,
33+
'full_opening_tag' => true,
34+
'fully_qualified_strict_types' => true, // added by Shift
35+
'function_declaration' => true,
36+
'function_typehint_space' => true,
37+
'heredoc_to_nowdoc' => true,
38+
'include' => true,
39+
'increment_style' => ['style' => 'post'],
40+
'indentation_type' => true,
41+
'linebreak_after_opening_tag' => true,
42+
'line_ending' => true,
43+
'lowercase_cast' => true,
44+
'lowercase_keywords' => true,
45+
'lowercase_static_reference' => true, // added from Symfony
46+
'magic_method_casing' => true, // added from Symfony
47+
'magic_constant_casing' => true,
48+
'method_argument_space' => true,
49+
'method_chaining_indentation' => true,
50+
'native_constant_invocation' => [
51+
'fix_built_in' => true,
52+
'scope' => 'namespaced',
53+
'strict' => true,
54+
],
55+
'native_function_casing' => true,
56+
'native_function_invocation' => [
57+
'include' => ['@compiler_optimized'],
58+
'scope' => 'namespaced',
59+
'strict' => true,
60+
],
61+
'no_alias_functions' => true,
62+
'no_extra_blank_lines' => [
63+
'tokens' => [
64+
'extra',
65+
'throw',
66+
'use',
67+
'use_trait',
68+
],
69+
],
70+
'no_blank_lines_after_class_opening' => true,
71+
'no_blank_lines_after_phpdoc' => true,
72+
'no_closing_tag' => true,
73+
'no_empty_phpdoc' => true,
74+
'no_empty_statement' => true,
75+
'no_leading_import_slash' => true,
76+
'no_leading_namespace_whitespace' => true,
77+
'no_mixed_echo_print' => [
78+
'use' => 'echo',
79+
],
80+
'no_multiline_whitespace_around_double_arrow' => true,
81+
'multiline_whitespace_before_semicolons' => [
82+
'strategy' => 'no_multi_line',
83+
],
84+
'no_short_bool_cast' => true,
85+
'no_singleline_whitespace_before_semicolons' => true,
86+
'no_spaces_after_function_name' => true,
87+
'no_spaces_inside_parenthesis' => true,
88+
'no_trailing_comma_in_singleline' => true,
89+
'no_trailing_whitespace' => true,
90+
'no_trailing_whitespace_in_comment' => true,
91+
'no_unreachable_default_argument_value' => true,
92+
'no_unused_imports' => true,
93+
'no_useless_return' => true,
94+
'no_whitespace_before_comma_in_array' => true,
95+
'no_whitespace_in_blank_line' => true,
96+
'normalize_index_brace' => true,
97+
'not_operator_with_successor_space' => true,
98+
'object_operator_without_whitespace' => true,
99+
'phpdoc_align' => true,
100+
'phpdoc_indent' => true,
101+
'phpdoc_no_access' => true,
102+
'phpdoc_no_package' => true,
103+
'phpdoc_no_useless_inheritdoc' => true,
104+
'phpdoc_scalar' => true,
105+
'phpdoc_single_line_var_spacing' => true,
106+
'phpdoc_summary' => true,
107+
'phpdoc_to_comment' => true,
108+
'phpdoc_trim' => true,
109+
'phpdoc_types' => true,
110+
'phpdoc_var_without_name' => true,
111+
'return_type_declaration' => true,
112+
'self_accessor' => true,
113+
'short_scalar_cast' => true,
114+
'simplified_null_return' => false, // disabled by Shift
115+
'single_blank_line_at_eof' => true,
116+
'single_blank_line_before_namespace' => true,
117+
'single_class_element_per_statement' => true,
118+
'single_import_per_statement' => true,
119+
'single_line_after_imports' => true,
120+
'single_line_comment_style' => [
121+
'comment_types' => ['hash'],
122+
],
123+
'single_quote' => true,
124+
'single_trait_insert_per_statement' => true,
125+
'space_after_semicolon' => true,
126+
'standardize_not_equals' => true,
127+
'switch_case_semicolon_to_colon' => true,
128+
'switch_case_space' => true,
129+
'ternary_operator_spaces' => true,
130+
131+
'trim_array_spaces' => true,
132+
'unary_operator_spaces' => true,
133+
'whitespace_after_comma_in_array' => true,
134+
135+
// php-cs-fixer 3: Renamed rules
136+
'constant_case' => ['case' => 'lower'],
137+
'general_phpdoc_tag_rename' => true,
138+
'phpdoc_inline_tag_normalizer' => true,
139+
'phpdoc_tag_type' => true,
140+
'psr_autoloading' => true,
141+
'trailing_comma_in_multiline' => ['elements' => ['arrays']],
142+
143+
// php-cs-fixer 3: Changed options
144+
'binary_operator_spaces' => [
145+
'default' => 'single_space',
146+
'operators' => [],
147+
],
148+
'blank_line_before_statement' => [
149+
'statements' => ['return'],
150+
],
151+
'class_attributes_separation' => [
152+
'elements' => [
153+
'const' => 'one',
154+
'method' => 'one',
155+
'property' => 'one',
156+
],
157+
],
158+
'class_definition' => [
159+
'multi_line_extends_each_single_line' => true,
160+
'single_item_single_line' => true,
161+
'single_line' => true,
162+
],
163+
'ordered_imports' => [
164+
'sort_algorithm' => 'alpha',
165+
],
166+
167+
// php-cs-fixer 3: Removed rootless options (*)
168+
'no_unneeded_control_parentheses' => [
169+
'statements' => ['break', 'clone', 'continue', 'echo_print', 'return', 'switch_case', 'yield'],
170+
],
171+
'no_spaces_around_offset' => [
172+
'positions' => ['inside', 'outside'],
173+
],
174+
'visibility_required' => [
175+
'elements' => ['property', 'method', 'const'],
176+
],
177+
178+
];
179+
180+
$finder = Finder::create()
181+
->in([
182+
__DIR__ . '/src',
183+
__DIR__ . '/tests',
184+
])
185+
->name('*.php')
186+
->notName('*.blade.php')
187+
->ignoreDotFiles(true)
188+
->ignoreVCS(true);
189+
190+
return (new Config())
191+
->setParallelConfig(ParallelConfigFactory::detect())
192+
->setFinder($finder)
193+
->setRules($rules)
194+
->setRiskyAllowed(true)
195+
->setUsingCache(true);

README.md

Lines changed: 13 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,12 @@
1-
# Project name
1+
# PHP App Version
22

33
[![GitHub contributors][ico-contributors]][link-contributors]
44
[![GitHub last commit][ico-last-commit]][link-last-commit]
55
[![License: MPL 2.0][ico-license]][link-license]
66

7-
Insert bullets description of the project if available.
7+
Lightweight package that enables easy display and management of your application's version information.
88

9-
[See the project live][link-production]
10-
11-
Give a short introduction of your project. Let this section explain the objectives or the motivation behind this project.
12-
13-
[Contributing](#contributing) | [Built with](#built-with) | [Repos and projects](#repos-and-projects) | [Deployment](#deployment) | [Feedback](#feedback) | [License](#license) | [About Code for Romania](#about-code-for-romania)
9+
[Contributing](#contributing) | [Install](#install) | [Usage](#usage) | [Feedback](#feedback) | [License](#license) | [About Code for Romania](#about-code-for-romania)
1410

1511
## Contributing
1612

@@ -20,31 +16,14 @@ Help us out by testing this project in the [staging environment][link-staging].
2016

2117
If you would like to suggest new functionality, open an Issue and mark it as a __[Feature request]__. Please be specific about why you think this functionality will be of use. If you can, please include some visual description of what you would like the UI to look like, if you are suggesting new UI elements.
2218

23-
## Built With
24-
25-
### Programming languages
26-
27-
### Platforms
28-
29-
### Frontend framework
30-
31-
### Package managers
19+
## Install
3220

33-
### Database technology & provider
21+
```console
22+
composer require commitglobal/app-version
23+
```
3424

35-
## Repos and projects
36-
37-
Mention all related repos and projects.
38-
39-
## Deployment
40-
41-
Guide users through getting your code up and running on their own system. In this section you can talk about:
42-
1. Installation process
43-
2. Software dependencies
44-
3. Latest releases
45-
4. API references
46-
47-
Describe and show how to build your code and run the tests.
25+
## Usage
26+
TODO:
4827

4928
## Feedback
5029

@@ -64,17 +43,14 @@ Started in 2016, Code for Romania is a civic tech NGO, official member of the Co
6443
Last, but not least, we rely on donations to ensure the infrastructure, logistics and management of our community that is widely spread across 11 timezones, coding for social change to make Romania and the world a better place. If you want to support us, [you can do it here][link-donate].
6544

6645

67-
[ico-contributors]: https://img.shields.io/github/contributors/code4romania/standard-repo-template.svg?style=for-the-badge
68-
[ico-last-commit]: https://img.shields.io/github/last-commit/code4romania/standard-repo-template.svg?style=for-the-badge
46+
[ico-contributors]: https://img.shields.io/github/contributors/commitglobal/php-app-version.svg?style=for-the-badge
47+
[ico-last-commit]: https://img.shields.io/github/last-commit/commitglobal/php-app-version.svg?style=for-the-badge
6948
[ico-license]: https://img.shields.io/badge/license-MPL%202.0-brightgreen.svg?style=for-the-badge
7049

71-
[link-contributors]: https://github.com/code4romania/standard-repo-template/graphs/contributors
72-
[link-last-commit]: https://github.com/code4romania/standard-repo-template/commits/main
50+
[link-contributors]: https://github.com/commitglobal/php-app-version/graphs/contributors
51+
[link-last-commit]: https://github.com/commitglobal/php-app-version/commits/main
7352
[link-license]: https://opensource.org/licenses/MPL-2.0
7453
[link-contributing]: https://github.com/code4romania/.github/blob/main/CONTRIBUTING.md
7554

76-
[link-production]: insert_link_here
77-
[link-staging]: insert_link_here
78-
7955
[link-code4]: https://www.code4.ro/en/
8056
[link-donate]: https://code4.ro/en/donate/

composer.json

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"name": "commitglobal/app-version",
3+
"type": "library",
4+
"description": "Lightweight package that enables easy display and management of your application's version information.",
5+
"license": "MPL-2.0",
6+
7+
"require": {
8+
"php": "^8.1",
9+
"illuminate/support": "^10.0|^11.0|^12.0"
10+
},
11+
"require-dev": {
12+
"friendsofphp/php-cs-fixer": "^3.84",
13+
"orchestra/testbench": "^8.0|^9.0|^10.0"
14+
},
15+
"autoload": {
16+
"psr-4": {
17+
"CommitGlobal\\AppVersion\\": "src"
18+
}
19+
},
20+
"autoload-dev": {
21+
"psr-4": {
22+
"CommitGlobal\\AppVersion\\Tests\\": "tests"
23+
}
24+
},
25+
"scripts": {
26+
"test": "phpunit"
27+
},
28+
"config": {
29+
"sort-packages": true
30+
},
31+
"minimum-stability": "stable",
32+
"prefer-stable": true
33+
}

config/app-version.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
return [
6+
7+
// The path to the file that contains the version of the application.
8+
// This file should contain a single line with the version string.
9+
'file' => base_path('.version'),
10+
11+
// The fallback version to use if the file does not exist.
12+
'fallback' => 'develop',
13+
14+
// The Filament hook where the version will be displayed.
15+
// This can be one of the Filament\View\PanelsRenderHook constants.
16+
// Defaults to Filament\View\PanelsRenderHook::FOOTER.
17+
'filament-hook' => null,
18+
19+
];

0 commit comments

Comments
 (0)