diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 62637af..1e9285a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -9,7 +9,7 @@ jobs: build: strategy: matrix: - php: [ "8.0", "8.1" ] + php: [ "8.0", "8.1", "8.2" ] runs-on: ubuntu-latest steps: diff --git a/.gitignore b/.gitignore index a364cbc..121a197 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ coverage.xml .php_cs.cache examples/lumen-app/vendor .phpunit.cache +.phpunit.result.cache diff --git a/README.md b/README.md index c419470..a6af5cf 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,12 @@ # Laravel (and Lumen) Prometheus Exporter +## Version Compatibility + +| Releases | PHP | +|:---------|:-------| +| 3.x | ^8.1; | +| 4.x | ^8.2; | + A prometheus exporter package for Laravel and Lumen. [![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE) @@ -23,6 +30,34 @@ library's functionality and the way it's intended to be used. ## Installation +### Laravel 10 + +#### Install via composer +Run the following command: +```bash +composer require arquivei/laravel-prometheus-exporter +``` + +#### Add service provider +Add the service provider to the `providers` array in the `config/app.php` config file as follows: +```bash +'providers' => [ + + ... + + Arquivei\LaravelPrometheusExporter\PrometheusServiceProvider::class, +] +``` + +#### Publish the config +Run the following command: +```bash + php artisan vendor:publish --provider="Arquivei\LaravelPrometheusExporter\PrometheusServiceProvider" +``` +You should now have a `config/prometheus.php`. + + +### Laravel 9 or below Add the repository to composer.json ```composer.json "repositories": [ diff --git a/composer.json b/composer.json index 9534b78..a763d4e 100644 --- a/composer.json +++ b/composer.json @@ -8,10 +8,10 @@ } ], "require": { - "php": "^8.0 || ^8.1", + "php": "^8.0 || ^8.1 || ^8.2", "guzzlehttp/guzzle": "^7.4.2", - "illuminate/routing": "^9.0", - "illuminate/support": "^9.0", + "illuminate/routing": "^9.0 || ^10.0", + "illuminate/support": "^9.0 || ^10.0", "promphp/prometheus_client_php": "^2.6.0" }, "require-dev": { diff --git a/phpunit.xml.dist b/phpunit.xml.dist index b82f2a6..373ad23 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,16 +1,15 @@ - - + tests diff --git a/src/PrometheusServiceProvider.php b/src/PrometheusServiceProvider.php index e3c6e9d..0a950a5 100644 --- a/src/PrometheusServiceProvider.php +++ b/src/PrometheusServiceProvider.php @@ -100,6 +100,7 @@ private function loadRoutes() private function configPath($path) : string { - return $this->app->basePath() . ($path ? DIRECTORY_SEPARATOR . $path : ''); + $basePath = sprintf('%s/%s', $this->app->basePath(), 'config'); + return $basePath . ($path ? DIRECTORY_SEPARATOR . $path : ''); } }