diff --git a/.circleci/config.yml b/.circleci/config.yml
index 8a6050f..7989e1d 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -1,48 +1,51 @@
version: 2.1
executors:
- php80:
- docker:
- - image: cimg/php:8.0
php81:
docker:
- image: cimg/php:8.1
+ php82:
+ docker:
+ - image: cimg/php:8.2
jobs:
+ lint:
+ executor: php82
+ steps:
+ - checkout
+ - run: composer update
+ - run: composer lint
test:
parameters:
- php-executor:
+ php_executor:
type: string
- executor: << parameters.php-executor >>
+ executor: << parameters.php_executor >>
steps:
- checkout
- run: printf "\n" | sudo pecl install apcu redis
- run: echo 'apc.enable_cli=1' | sudo tee -a /etc/php.d/circleci.ini
- - restore_cache:
- keys:
- - v1-<< parameters.php-executor >>-dependencies-lowest-{{ checksum "composer.json" }}
- - v1-<< parameters.php-executor >>-dependencies-lowest-
- run: composer update --prefer-lowest
- - save_cache:
- key: v1-<< parameters.php-executor >>-dependencies-lowest-{{ checksum "composer.json" }}
- paths:
- - ./vendor
- run: composer test
- - restore_cache:
- keys:
- - v1-<< parameters.php-executor >>-dependencies-highest-{{ checksum "composer.json" }}
- - v1-<< parameters.php-executor >>-dependencies-highest-
- run: composer update
- - save_cache:
- key: v1-<< parameters.php-executor >>-dependencies-highest-{{ checksum "composer.json" }}
- paths:
- - ./vendor
- run: composer test
+ coverage:
+ executor: php82
+ steps:
+ - run: printf "\n" | sudo pecl install apcu redis
+ - run: echo 'apc.enable_cli=1' | sudo tee -a /etc/php.d/circleci.ini
+ - run: sudo -E pecl install pcov && sudo -E docker-php-ext-enable pcov
+ - checkout
+ - run: composer update
+ - run: composer coverage
workflows:
- all-tests:
+ lint_test_coverage:
jobs:
+ - lint
- test:
matrix:
parameters:
- php-executor: [php80, php81]
+ php_executor: [php81, php82]
+ - coverage:
+ requires:
+ - test
diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 0000000..7aa2681
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,10 @@
+root = true
+
+[*]
+indent_size = 4
+indent_style = space
+insert_final_newline = true
+trim_trailing_whitespace = true
+
+[*.yml]
+indent_size = 2
diff --git a/.gitignore b/.gitignore
index bcec9e0..2d61de2 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,5 @@
.idea
+.php-cs-fixer.cache
.phpunit.cache
composer.lock
phpunit.xml
diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php
new file mode 100644
index 0000000..fa08236
--- /dev/null
+++ b/.php-cs-fixer.dist.php
@@ -0,0 +1,9 @@
+setRules(['@PSR12' => true])
+ ->setFinder(
+ PhpCsFixer\Finder::create()
+ ->in(__DIR__)
+ ->exclude('vendor')
+ );
diff --git a/.styleci.yml b/.styleci.yml
deleted file mode 100644
index 3d42cee..0000000
--- a/.styleci.yml
+++ /dev/null
@@ -1,76 +0,0 @@
-preset: psr2
-
-enabled:
- - alpha_ordered_imports
- - binary_operator_spaces
- - blank_line_after_opening_tag
- - cast_spaces
- - concat_with_spaces
- - const_visibility_required
- - declare_equal_normalize
- - function_typehint_space
- - hash_to_slash_comment
- - heredoc_to_nowdoc
- - include
- - lowercase_cast
- - method_separation
- - native_function_casing
- - new_with_braces
- - no_blank_lines_after_class_opening
- - no_blank_lines_after_phpdoc
- - no_blank_lines_after_return
- - no_blank_lines_after_throw
- - no_blank_lines_between_imports
- - no_blank_lines_between_traits
- - no_empty_statement
- - no_extra_consecutive_blank_lines
- - no_leading_import_slash
- - no_leading_namespace_whitespace
- - no_multiline_whitespace_around_double_arrow
- - no_short_bool_cast
- - no_short_echo_tag
- - no_singleline_whitespace_before_semicolons
- - no_spaces_inside_offset
- - no_spaces_outside_offset
- - no_trailing_comma_in_list_call
- - no_trailing_comma_in_singleline_array
- - no_unneeded_control_parentheses
- - no_unreachable_default_argument_value
- - no_unused_imports
- - no_useless_return
- - no_whitespace_before_comma_in_array
- - no_whitespace_in_blank_line
- - normalize_index_brace
- - object_operator_without_whitespace
- - phpdoc_add_missing_param_annotation
- - phpdoc_indent
- - phpdoc_inline_tag
- - phpdoc_link_to_see
- - phpdoc_no_access
- - phpdoc_no_empty_return
- - phpdoc_no_package
- - phpdoc_order
- - phpdoc_property
- - phpdoc_scalar
- - phpdoc_separation
- - phpdoc_single_line_var_spacing
- - phpdoc_to_comment
- - phpdoc_trim
- - phpdoc_type_to_var
- - phpdoc_types
- - phpdoc_var_without_name
- - print_to_echo
- - self_accessor
- - short_array_syntax
- - short_scalar_cast
- - single_blank_line_before_namespace
- - single_quote
- - space_after_semicolon
- - standardize_not_equals
- - ternary_operator_spaces
- - trailing_comma_in_multiline_array
- - trim_array_spaces
- - unalign_double_arrow
- - unalign_equals
- - unary_operator_spaces
- - whitespace_after_comma_in_array
diff --git a/CHANGELOG.md b/CHANGELOG.md
new file mode 100644
index 0000000..91d89a8
--- /dev/null
+++ b/CHANGELOG.md
@@ -0,0 +1,97 @@
+# Changelog
+
+All notable changes to this project will be documented in this file.
+
+The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
+and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
+
+## [v4.0.0] - 2023-09-11
+
+### Added
+
+- Added support for Laravel 10.
+- Added support for PHP 8.2.
+
+### Removed
+
+- Removed support for Laravel 8.
+- Removed support for Laravel 9.
+- Removed support for PHP 8.0.
+
+## [v3.0.0] - 2023-02-10
+
+### Added
+
+- Add support for Laravel 9.
+- Add support for PHP 8.1.
+
+### Changed
+
+- Swap build provider from Travis CI to Circle CI.
+
+### Removed
+
+- Drop support for PHP 7.4.
+- Drop support for Laravel 7.
+- Remove `orchestra/testbench` from development dependencies.
+
+## [v2.0.1] - 2022-02-10
+
+## [v2.0.0] - 2022-02-10
+
+## [v2.0.0-BETA1] - 2022-02-10
+
+## [v2.0] - 2022-02-10
+
+## [v1.0.6] - 2022-01-12
+
+## [v1.0.5] - 2020-03-16
+
+### Changed
+
+- Update call to array_get helper to use the Illuminate\Support\Arr class
+- Enable Laravel 7 compatability
+
+## [v1.0.4] - 2019-10-17
+
+### Changed
+
+- Enable Laravel 6.0 compatability
+
+## [v1.0.3] - 2019-02-11
+
+### Changed
+
+- Enable package discovery for laravel 5.5+
+
+## [v1.0.2] - 2019-01-16
+
+### Added
+
+- Add compatability with Laravel Lumen (make named route configurable)
+
+## [v1.0.1] - 2017-08-30
+
+### Fixed
+
+- Fix config retrieval of `prometheus.storage_adapters`
+
+## [v1.0.0] - 2017-07-27
+
+### Added
+
+- Initial release
+
+[v4.0.0]: https://github.com/HealthEngineAU/laravel-prometheus-exporter/compare/v3.0.0...v4.0.0
+[v3.0.0]: https://github.com/HealthEngineAU/laravel-prometheus-exporter/compare/v2.0.1...v3.0.0
+[v2.0.1]: https://github.com/HealthEngineAU/laravel-prometheus-exporter/compare/v2.0.0...v2.0.1
+[v2.0.0]: https://github.com/HealthEngineAU/laravel-prometheus-exporter/compare/v2.0.0-BETA1...v2.0.0
+[v2.0.0-BETA1]: https://github.com/HealthEngineAU/laravel-prometheus-exporter/compare/v2.0...v2.0.0-BETA1
+[v2.0]: https://github.com/HealthEngineAU/laravel-prometheus-exporter/compare/1.0.6...v2.0
+[v1.0.6]: https://github.com/HealthEngineAU/laravel-prometheus-exporter/compare/1.0.5...1.0.6
+[v1.0.5]: https://github.com/HealthEngineAU/laravel-prometheus-exporter/compare/1.0.4...1.0.5
+[v1.0.4]: https://github.com/HealthEngineAU/laravel-prometheus-exporter/compare/1.0.3...1.0.4
+[v1.0.3]: https://github.com/HealthEngineAU/laravel-prometheus-exporter/compare/1.0.2...1.0.3
+[v1.0.2]: https://github.com/HealthEngineAU/laravel-prometheus-exporter/compare/1.0.1...1.0.2
+[v1.0.1]: https://github.com/HealthEngineAU/laravel-prometheus-exporter/compare/1.0.0...1.0.1
+[v1.0.0]: https://github.com/HealthEngineAU/laravel-prometheus-exporter/releases/tag/1.0.0
diff --git a/changelog.md b/changelog.md
deleted file mode 100644
index c7b13cd..0000000
--- a/changelog.md
+++ /dev/null
@@ -1,37 +0,0 @@
-# Changelog
-
-## Unreleased
-
-## v3.0.0 - 2023-02-10
-
-* Add support for Laravel 9.
-* Add support for PHP 8.1.
-* Drop support for PHP 7.4.
-* Drop support for Laravel 7.
-* Remove `orchestra/testbench` from development dependencies.
-* Swap build provider from Travis CI to Circle CI.
-
-## 1.0.5 - 2020-03-16
-
-* Update call to array_get helper to use the Illuminate\Support\Arr class
-* Enable Laravel 7 compatability
-
-## 1.0.4 - 2019-10-17
-
-* Enable Laravel 6.0 compatability
-
-## 1.0.3 - 2019-02-11
-
-* Enable package discovery for laravel 5.5+
-
-## 1.0.2 - 2019-01-16
-
-* Add compatability with Laravel Lumen (make named route configurable)
-
-## 1.0.1 - 2017-08-30
-
-* Fix config retrieval of `prometheus.storage_adapters`
-
-## 1.0.0 - 2017-07-27
-
-* Initial release
diff --git a/composer.json b/composer.json
index 5767a89..144f44a 100644
--- a/composer.json
+++ b/composer.json
@@ -1,52 +1,56 @@
{
- "name": "healthengine/laravel-prometheus-exporter",
- "description": "A prometheus exporter for Laravel",
- "license": "MIT",
- "type": "library",
- "authors": [
- {
- "name": "Superbalist.com a division of Takealot Online (Pty) Ltd",
- "email": "info@superbalist.com"
+ "name": "healthengine/laravel-prometheus-exporter",
+ "description": "A prometheus exporter for Laravel",
+ "license": "MIT",
+ "type": "library",
+ "authors": [
+ {
+ "name": "Superbalist.com a division of Takealot Online (Pty) Ltd",
+ "email": "info@superbalist.com"
+ },
+ {
+ "name": "Thomas Spencer",
+ "email": "tomspencer244@gmail.com"
+ }
+ ],
+ "require": {
+ "php": "~8.1.0 || ~8.2.0",
+ "laravel/framework": "^10.0",
+ "promphp/prometheus_client_php": "^2.0"
},
- {
- "name": "Thomas Spencer",
- "email": "tomspencer244@gmail.com"
- }
- ],
- "require": {
- "php": "~8.0.0 || ~8.1.0",
- "illuminate/routing": "^8.74 || ^9.0",
- "illuminate/support": "^8.74 || ^9.0",
- "promphp/prometheus_client_php": "^2.0"
- },
- "autoload": {
- "psr-4": {
- "Healthengine\\LaravelPrometheusExporter\\": "src/",
- "Tests\\": "tests/"
- }
- },
- "extra": {
- "laravel": {
- "providers": [
- "Healthengine\\LaravelPrometheusExporter\\PrometheusServiceProvider"
- ],
- "aliases": {
- "Prometheus": "Healthengine\\LaravelPrometheusExporter\\PrometheusFacade"
- }
+ "autoload": {
+ "psr-4": {
+ "Healthengine\\LaravelPrometheusExporter\\": "src/",
+ "Tests\\": "tests/"
+ }
+ },
+ "extra": {
+ "laravel": {
+ "providers": [
+ "Healthengine\\LaravelPrometheusExporter\\PrometheusServiceProvider"
+ ],
+ "aliases": {
+ "Prometheus": "Healthengine\\LaravelPrometheusExporter\\PrometheusFacade"
+ }
+ }
+ },
+ "require-dev": {
+ "friendsofphp/php-cs-fixer": "^3.26",
+ "mockery/mockery": "^1.6",
+ "orchestra/testbench": "^8.0",
+ "phpunit/phpunit": "^10.3"
+ },
+ "config": {
+ "sort-packages": true
+ },
+ "suggest": {
+ "ext-apcu": "To use the APCu driver.",
+ "ext-redis": "To use the Redis driver."
+ },
+ "scripts": {
+ "coverage": "@php vendor/bin/phpunit --colors=always --coverage-text",
+ "fix": "@php vendor/bin/php-cs-fixer fix",
+ "lint": "@php vendor/bin/php-cs-fixer fix --diff --dry-run",
+ "test": "@php vendor/bin/phpunit --colors=always"
}
- },
- "require-dev": {
- "mockery/mockery": "^1.5",
- "phpunit/phpunit": "^9.6"
- },
- "config": {
- "sort-packages": true
- },
- "suggest": {
- "ext-apcu": "To use the APCu driver.",
- "ext-redis": "To use the Redis driver."
- },
- "scripts": {
- "test": "@php vendor/bin/phpunit"
- }
}
diff --git a/phpunit.dist.xml b/phpunit.dist.xml
new file mode 100644
index 0000000..7b04993
--- /dev/null
+++ b/phpunit.dist.xml
@@ -0,0 +1,23 @@
+
+
+
+
+ tests
+
+
+
+
+
diff --git a/phpunit.php b/phpunit.php
deleted file mode 100644
index 043183f..0000000
--- a/phpunit.php
+++ /dev/null
@@ -1,3 +0,0 @@
-
-
-
-
- src
-
-
-
-
- ./tests/
-
-
-
\ No newline at end of file
diff --git a/tests/StorageAdapterFactoryTest.php b/tests/StorageAdapterFactoryTest.php
index de51df3..6d211d3 100644
--- a/tests/StorageAdapterFactoryTest.php
+++ b/tests/StorageAdapterFactoryTest.php
@@ -38,6 +38,10 @@ public function testMakeApcAdapter()
public function testMakeRedisAdapter()
{
+ if (!extension_loaded('redis')) {
+ $this->markTestSkipped('Redis extension is not loaded');
+ }
+
$factory = new StorageAdapterFactory();
$adapter = $factory->make('redis');
$this->assertInstanceOf(Redis::class, $adapter);