Skip to content

Commit fa3bacf

Browse files
dp88claude
andauthored
Fix deps, Filament v3-v5, Laravel 13, CI (#2)
* Fix broken phpinfo dependency and add Laravel 13 support Update stechstudio/phpinfo constraint from ^0.4.0 (removed tags) to ^0.6|^1.0. Broaden filament/filament to ^3.0|^4.0|^5.0 for Laravel 13 support via Filament v4/v5. Add explicit PHP ^8.3 requirement and declare spatie/laravel-package-tools as a direct dependency. Remove typed property/return on $info and getInfo() since phpinfo v1.0 renames Result to PhpInfo — the duck-typed API is identical across both versions. Closes #1 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Update PHPInfo page for Filament v5 compatibility Change $view from static to non-static to match Filament v5's Page base class. Override getDefaultSlug() instead of getSlug() (which now takes a ?Panel parameter). Update getNavigationGroup() and getNavigationIcon() return types to match v5 signatures (UnitEnum, BackedEnum, Htmlable unions). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Add Pest test infrastructure with Orchestra Testbench Add test suite covering plugin registration, page configuration defaults and overrides, and service provider config/view registration. Uses Pest 3 with Orchestra Testbench for Laravel package testing. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Make PHPInfo page compatible with Filament v3, v4, and v5 Use getView() method override instead of $view property declaration to avoid the static vs non-static incompatibility between v3 and v4/v5. Move navigation group/icon config into service provider boot using the setter methods, avoiding return type signature differences across versions. Override getDefaultSlug() for config-driven slug (exists in all versions). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Add GitHub Actions CI workflow Test matrix covers PHP 8.3/8.4 against Filament v3 (Laravel 11), v4 (Laravel 12), and v5 (Laravel 12) using Orchestra Testbench. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Update README with CI badge and compatibility table Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Fix navigation config for Filament v3 compatibility Move navigation group/icon resolution from service provider setter methods (which don't exist in Filament v3) to getter overrides on the Page class. Uses covariant return types (?string) which are compatible with both v3's ?string and v5's string|UnitEnum|null parent signatures. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Add Laravel 13 to CI matrix and README Add Filament v5 + Laravel 13 (Testbench 11) test entries for both PHP 8.3 and 8.4. Update compatibility table to list Laravel 13. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Fix Laravel 13 CI by conditionally installing pest-plugin-laravel Remove pestphp/pest-plugin-laravel from require-dev since it doesn't support Laravel 13 yet. Install it conditionally in CI only for Laravel 11/12 lanes. Tests don't depend on its helpers. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Add phpinfo capture integration tests Verify that Info::capture() returns real phpinfo data: modules are present, PHP version is parseable, the Core module exists, and known configs like display_errors are found. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 30eace4 commit fa3bacf

13 files changed

Lines changed: 252 additions & 11 deletions

.github/workflows/tests.yml

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
name: Tests
2+
3+
on:
4+
push:
5+
paths:
6+
- '**.php'
7+
- 'composer.json'
8+
- 'phpunit.xml.dist'
9+
- '.github/workflows/tests.yml'
10+
pull_request:
11+
paths:
12+
- '**.php'
13+
- 'composer.json'
14+
- 'phpunit.xml.dist'
15+
- '.github/workflows/tests.yml'
16+
17+
jobs:
18+
test:
19+
runs-on: ubuntu-latest
20+
timeout-minutes: 5
21+
22+
strategy:
23+
fail-fast: true
24+
matrix:
25+
include:
26+
- php: '8.3'
27+
filament: '^3.0'
28+
laravel: '11.*'
29+
testbench: '9.*'
30+
- php: '8.4'
31+
filament: '^3.0'
32+
laravel: '11.*'
33+
testbench: '9.*'
34+
- php: '8.3'
35+
filament: '^4.0'
36+
laravel: '12.*'
37+
testbench: '10.*'
38+
- php: '8.4'
39+
filament: '^4.0'
40+
laravel: '12.*'
41+
testbench: '10.*'
42+
- php: '8.3'
43+
filament: '^5.0'
44+
laravel: '12.*'
45+
testbench: '10.*'
46+
- php: '8.4'
47+
filament: '^5.0'
48+
laravel: '12.*'
49+
testbench: '10.*'
50+
- php: '8.3'
51+
filament: '^5.0'
52+
laravel: '13.*'
53+
testbench: '11.*'
54+
- php: '8.4'
55+
filament: '^5.0'
56+
laravel: '13.*'
57+
testbench: '11.*'
58+
59+
name: PHP ${{ matrix.php }} - Filament ${{ matrix.filament }} - Laravel ${{ matrix.laravel }}
60+
61+
steps:
62+
- uses: actions/checkout@v4
63+
64+
- name: Setup PHP
65+
uses: shivammathur/setup-php@v2
66+
with:
67+
php-version: ${{ matrix.php }}
68+
extensions: dom
69+
coverage: none
70+
71+
- name: Install dependencies
72+
run: |
73+
composer require "filament/filament:${{ matrix.filament }}" "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update
74+
if [[ "${{ matrix.laravel }}" != "13.*" ]]; then
75+
composer require "pestphp/pest-plugin-laravel:^3.0" --no-interaction --no-update
76+
fi
77+
composer update --prefer-stable --prefer-dist --no-interaction
78+
79+
- name: Run tests
80+
run: vendor/bin/pest --ci

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,4 @@ Homestead.yaml
2525
Homestead.json
2626
/.vagrant
2727
.phpunit.result.cache
28+
.phpunit.cache/

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
# PHPInfo for Filament
2+
3+
![Tests](https://github.com/stechstudio/filament-phpinfo/actions/workflows/tests.yml/badge.svg)
4+
25
This package adds a new page to the Filament admin panel that displays the output of `phpinfo()` in a nicely formatted way.
36

7+
## Compatibility
8+
9+
| Version | PHP | Laravel | Filament |
10+
|---------|-----|---------|----------|
11+
| 1.2 | 8.3+ | 11, 12, 13 | 3, 4, 5 |
12+
413
## Installation
514
```bash
615
composer require stechstudio/filament-phpinfo

composer.json

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,27 @@
1919
}
2020
],
2121
"require": {
22-
"filament/filament": "^3.0",
23-
"stechstudio/phpinfo": "^0.4.0"
22+
"php": "^8.3",
23+
"filament/filament": "^3.0|^4.0|^5.0",
24+
"spatie/laravel-package-tools": "^1.9",
25+
"stechstudio/phpinfo": "^0.6|^1.0"
26+
},
27+
"autoload-dev": {
28+
"psr-4": {
29+
"STS\\FilamentPHPInfo\\Tests\\": "tests/"
30+
}
31+
},
32+
"require-dev": {
33+
"orchestra/testbench": "^8.0|^9.0|^10.0|^11.0",
34+
"pestphp/pest": "^2.0|^3.0"
35+
},
36+
"scripts": {
37+
"test": "vendor/bin/pest"
38+
},
39+
"config": {
40+
"allow-plugins": {
41+
"pestphp/pest-plugin": true
42+
}
2443
},
2544
"extra": {
2645
"laravel": {

phpunit.xml.dist

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phpunit
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
5+
bootstrap="vendor/autoload.php"
6+
colors="true"
7+
>
8+
<testsuites>
9+
<testsuite name="Tests">
10+
<directory>tests</directory>
11+
</testsuite>
12+
</testsuites>
13+
</phpunit>

src/FilamentPHPInfoServiceProvider.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,5 @@ public function configurePackage(Package $package): void
1616
->hasViews()
1717
->hasConfigFile();
1818
}
19+
1920
}

src/Pages/PHPInfo.php

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,14 @@ class PHPInfo extends Page
99
{
1010
protected static ?string $title = 'PHPInfo';
1111

12-
protected static string $view = 'filament-phpinfo::phpinfo';
13-
1412
protected static ?string $navigationLabel = 'PHPInfo';
1513

16-
protected InfoWrapper\Result $info;
14+
protected mixed $info;
15+
16+
public function getView(): string
17+
{
18+
return 'filament-phpinfo::phpinfo';
19+
}
1720

1821
public function getViewData(): array
1922
{
@@ -22,23 +25,23 @@ public function getViewData(): array
2225
];
2326
}
2427

25-
protected function getInfo(): InfoWrapper\Result
28+
protected function getInfo(): mixed
2629
{
2730
return $this->info ??= InfoWrapper\Info::capture();
2831
}
2932

30-
public static function getSlug(): string
33+
public static function getDefaultSlug(): string
3134
{
3235
return config('filament-phpinfo.page-slug', 'phpinfo');
3336
}
3437

35-
public static function getNavigationGroup(): ?string
38+
public static function getNavigationIcon(): ?string
3639
{
37-
return config('filament-phpinfo.navigation-group');
40+
return config('filament-phpinfo.navigation-icon', 'heroicon-o-information-circle');
3841
}
3942

40-
public static function getNavigationIcon(): ?string
43+
public static function getNavigationGroup(): ?string
4144
{
42-
return config('filament-phpinfo.navigation-icon', 'heroicon-o-information-circle');
45+
return config('filament-phpinfo.navigation-group');
4346
}
4447
}

tests/PageTest.php

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?php
2+
3+
use STS\FilamentPHPInfo\Pages\PHPInfo;
4+
5+
it('has the correct default slug', function () {
6+
expect(PHPInfo::getDefaultSlug())->toBe('phpinfo');
7+
});
8+
9+
it('has the correct default navigation icon', function () {
10+
expect(PHPInfo::getNavigationIcon())->toBe('heroicon-o-information-circle');
11+
});
12+
13+
it('has the correct default navigation group', function () {
14+
expect(PHPInfo::getNavigationGroup())->toBe('System Management');
15+
});
16+
17+
it('respects custom slug from config', function () {
18+
config()->set('filament-phpinfo.page-slug', 'custom-phpinfo');
19+
expect(PHPInfo::getDefaultSlug())->toBe('custom-phpinfo');
20+
});
21+
22+
it('respects custom navigation icon from config', function () {
23+
config()->set('filament-phpinfo.navigation-icon', 'heroicon-o-cog');
24+
expect(PHPInfo::getNavigationIcon())->toBe('heroicon-o-cog');
25+
});
26+
27+
it('respects custom navigation group from config', function () {
28+
config()->set('filament-phpinfo.navigation-group', 'Custom Group');
29+
expect(PHPInfo::getNavigationGroup())->toBe('Custom Group');
30+
});
31+
32+
it('returns the correct view', function () {
33+
$page = new class extends PHPInfo {
34+
public function exposeGetView(): string
35+
{
36+
return $this->getView();
37+
}
38+
};
39+
expect($page->exposeGetView())->toBe('filament-phpinfo::phpinfo');
40+
});

tests/Pest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?php
2+
3+
use STS\FilamentPHPInfo\Tests\TestCase;
4+
5+
uses(TestCase::class)->in(__DIR__);

tests/PhpInfoCaptureTest.php

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?php
2+
3+
use STS\Phpinfo\Info;
4+
5+
it('captures phpinfo and returns modules', function () {
6+
$info = Info::capture();
7+
8+
expect($info->modules())->not->toBeEmpty();
9+
});
10+
11+
it('contains a PHP version', function () {
12+
$info = Info::capture();
13+
14+
expect($info->version())->toMatch('/^\d+\.\d+/');
15+
});
16+
17+
it('includes the Core module', function () {
18+
$info = Info::capture();
19+
20+
expect($info->hasModule('Core'))->toBeTrue();
21+
expect($info->module('Core')->name())->toBe('Core');
22+
});
23+
24+
it('has configs with names and values', function () {
25+
$info = Info::capture();
26+
27+
expect($info->configs())->not->toBeEmpty();
28+
expect($info->hasConfig('display_errors'))->toBeTrue();
29+
});

0 commit comments

Comments
 (0)