Skip to content

Commit 5d97d31

Browse files
committed
Merge remote-tracking branch 'arquivei/feature/php8.2-support'
2 parents f46d05a + e2c4f91 commit 5d97d31

File tree

6 files changed

+53
-17
lines changed

6 files changed

+53
-17
lines changed

.github/workflows/main.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
build:
1010
strategy:
1111
matrix:
12-
php: [ "8.0", "8.1" ]
12+
php: [ "8.0", "8.1", "8.2" ]
1313
runs-on: ubuntu-latest
1414

1515
steps:

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ coverage.xml
66
.php_cs.cache
77
examples/lumen-app/vendor
88
.phpunit.cache
9+
.phpunit.result.cache

README.md

+35
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# Laravel (and Lumen) Prometheus Exporter
22

3+
## Version Compatibility
4+
5+
| Releases | PHP |
6+
|:---------|:-------|
7+
| 3.x | ^8.1; |
8+
| 4.x | ^8.2; |
9+
310
A prometheus exporter package for Laravel and Lumen.
411

512
[![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.
2330

2431
## Installation
2532

33+
### Laravel 10
34+
35+
#### Install via composer
36+
Run the following command:
37+
```bash
38+
composer require arquivei/laravel-prometheus-exporter
39+
```
40+
41+
#### Add service provider
42+
Add the service provider to the `providers` array in the `config/app.php` config file as follows:
43+
```bash
44+
'providers' => [
45+
46+
...
47+
48+
Arquivei\LaravelPrometheusExporter\PrometheusServiceProvider::class,
49+
]
50+
```
51+
52+
#### Publish the config
53+
Run the following command:
54+
```bash
55+
php artisan vendor:publish --provider="Arquivei\LaravelPrometheusExporter\PrometheusServiceProvider"
56+
```
57+
You should now have a `config/prometheus.php`.
58+
59+
60+
### Laravel 9 or below
2661
Add the repository to composer.json
2762
```composer.json
2863
"repositories": [

composer.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88
}
99
],
1010
"require": {
11-
"php": "^8.0 || ^8.1",
11+
"php": "^8.0 || ^8.1 || ^8.2",
1212
"guzzlehttp/guzzle": "^7.4.2",
13-
"illuminate/routing": "^9.0",
14-
"illuminate/support": "^9.0",
13+
"illuminate/routing": "^9.0 || ^10.0",
14+
"illuminate/support": "^9.0 || ^10.0",
1515
"promphp/prometheus_client_php": "^2.6.0"
1616
},
1717
"require-dev": {

phpunit.xml.dist

+11-12
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3-
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.5/phpunit.xsd"
4-
bootstrap="vendor/autoload.php"
5-
cacheResultFile=".phpunit.cache/test-results"
6-
executionOrder="depends,defects"
7-
beStrictAboutOutputDuringTests="true"
8-
beStrictAboutTodoAnnotatedTests="true"
9-
failOnRisky="true"
10-
failOnWarning="true"
11-
verbose="true"
12-
colors="true">
13-
2+
<phpunit
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.0/phpunit.xsd"
5+
bootstrap="vendor/autoload.php"
6+
executionOrder="depends,defects"
7+
beStrictAboutOutputDuringTests="true"
8+
failOnRisky="true"
9+
failOnWarning="true"
10+
displayDetailsOnTestsThatTriggerNotices="true"
11+
colors="true"
12+
cacheDirectory=".phpunit.cache">
1413
<testsuites>
1514
<testsuite name="default">
1615
<directory suffix="Test.php">tests</directory>

src/PrometheusServiceProvider.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ private function loadRoutes()
104104

105105
private function configPath($path) : string
106106
{
107-
return $this->app->basePath() . ($path ? DIRECTORY_SEPARATOR . $path : '');
107+
$basePath = sprintf('%s/%s', $this->app->basePath(), 'config');
108+
return $basePath . ($path ? DIRECTORY_SEPARATOR . $path : '');
108109
}
109110
}

0 commit comments

Comments
 (0)