-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
224 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
composer.lock | ||
|
||
.idea | ||
|
||
/vendor/ | ||
node_modules/ | ||
npm-debug.log | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,32 @@ | ||
# filament-phpinfo | ||
View phpinfo from your Filament admin panel. | ||
# PHPInfo for Filament | ||
This package adds a new page to the Filament admin panel that displays the output of `phpinfo()` in a nicely formatted way. | ||
|
||
## Installation | ||
```bash | ||
composer require stechstudio/filament-phpinfo | ||
``` | ||
|
||
In your `AdminPanelProvider` (or other `\Filament\PanelProvider`), add this package to your plugins: | ||
```php | ||
$panel | ||
->plugins([ | ||
\STS\FilamentPHPInfo\FilamentPHPInfoPlugin::make(), | ||
]) | ||
``` | ||
|
||
## Configuration | ||
The navigation group and icon are configurable. | ||
|
||
Publish the `filament-phpinfo` config file with: | ||
```bash | ||
php artisan vendor:publish --tag=filament-phpinfo-config | ||
``` | ||
|
||
| Option | Description | | ||
|--------------------|----------------------------------------------------------------------------------------------------------------------| | ||
| `navigation-group` | The PHPInfo page's [navigation group](https://filamentphp.com/docs/3.x/panels/navigation#grouping-navigation-items). | | ||
| `navigation-icon` | The PHPInfo page's icon. See Filament's [documentation](https://filamentphp.com/docs/3.x/support/icons) for values. | | ||
|
||
| Screenshot | | ||
|---| | ||
| ![PHPInfo Page](/screenshots/phpinfo.png) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
{ | ||
"name": "stechstudio/filament-phpinfo", | ||
"description": "View phpinfo from your Filament admin panel.", | ||
"type": "library", | ||
"license": "MIT", | ||
"autoload": { | ||
"psr-4": { | ||
"STS\\FilamentPHPInfo\\": "src/" | ||
} | ||
}, | ||
"authors": [ | ||
{ | ||
"name": "Elias Szobody", | ||
"email": "[email protected]" | ||
}, | ||
{ | ||
"name": "David Palmer", | ||
"email": "[email protected]" | ||
} | ||
], | ||
"require": { | ||
"filament/filament": "^3.0", | ||
"stechstudio/phpinfo": "^0.2.0" | ||
}, | ||
"extra": { | ||
"laravel": { | ||
"providers": [ | ||
"STS\\FilamentPHPInfo\\FilamentPHPInfoServiceProvider" | ||
] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?php | ||
|
||
return [ | ||
'navigation-group' => 'System Management', | ||
'navigation-icon' => 'heroicon-o-information-circle', | ||
'page-slug' => 'phpinfo', | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<x-filament-panels::page> | ||
@foreach ($info->modules() as $module) | ||
<x-filament::section :heading="$module->name()" collapsible> | ||
@foreach ($module->groups() as $group) | ||
<x-filament-tables::table> | ||
@if ($group->headings()->isNotEmpty()) | ||
<x-filament-tables::row> | ||
@foreach ($group->headings() as $heading) | ||
<x-filament-tables::header-cell> | ||
{{ $heading }} | ||
</x-filament-tables::header-cell> | ||
@endforeach | ||
</x-filament-tables::row> | ||
|
||
@foreach ($group->configs() as $config) | ||
<x-filament-tables::row> | ||
<x-filament-tables::cell :style="$loop->first ? 'max-width: 24rem; min-width: 24rem; width: 24rem; vertical-align: top' : 'vertical-align: top'"> | ||
<div class="filament-tables-column-wrapper px-4 py-3"> | ||
{{ $config->name() }} | ||
</div> | ||
</x-filament-tables::cell> | ||
|
||
<x-filament-tables::cell class="whitespace-normal" style="overflow-wrap: anywhere"> | ||
<div class="filament-tables-column-wrapper px-4 py-3"> | ||
{{ $config->localValue() }} | ||
</div> | ||
</x-filament-tables::cell> | ||
|
||
<x-filament-tables::cell class="whitespace-normal" style="overflow-wrap: anywhere"> | ||
<div class="filament-tables-column-wrapper px-4 py-3"> | ||
{{ $config->masterValue() }} | ||
</div> | ||
</x-filament-tables::cell> | ||
</x-filament-tables::row> | ||
@endforeach | ||
@else | ||
@foreach ($group->configs() as $config) | ||
<x-filament-tables::row> | ||
<x-filament-tables::header-cell :style="$loop->first ? 'max-width: 24rem; min-width: 24rem; width: 24rem; vertical-align: top' : 'vertical-align: top'"> | ||
{{ $config->name() }} | ||
</x-filament-tables::header-cell> | ||
|
||
<x-filament-tables::cell class="whitespace-normal" style="overflow-wrap: anywhere"> | ||
<div class="filament-tables-column-wrapper px-4 py-3"> | ||
{{ $config->localValue() }} | ||
</div> | ||
</x-filament-tables::cell> | ||
</x-filament-tables::row> | ||
@endforeach | ||
@endif | ||
</x-filament-tables::table> | ||
@endforeach | ||
</x-filament::section> | ||
@endforeach | ||
</x-filament-panels::page> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
namespace STS\FilamentPHPInfo; | ||
|
||
use Filament\Contracts\Plugin; | ||
use Filament\Panel; | ||
|
||
class FilamentPHPInfoPlugin implements Plugin | ||
{ | ||
public static function make(): static | ||
{ | ||
return app(static::class); | ||
} | ||
|
||
public function getId(): string | ||
{ | ||
return 'filament-phpinfo'; | ||
} | ||
|
||
public function register(Panel $panel): void | ||
{ | ||
$panel | ||
->pages([ | ||
Pages\PHPInfo::class, | ||
]); | ||
} | ||
|
||
public function boot(Panel $panel): void | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
|
||
namespace STS\FilamentPHPInfo; | ||
|
||
use Spatie\LaravelPackageTools\Package; | ||
use Spatie\LaravelPackageTools\PackageServiceProvider; | ||
|
||
class FilamentPHPInfoServiceProvider extends PackageServiceProvider | ||
{ | ||
public static string $name = 'filament-phpinfo'; | ||
|
||
public function configurePackage(Package $package): void | ||
{ | ||
$package | ||
->name(static::$name) | ||
->hasViews() | ||
->hasConfigFile(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php | ||
|
||
namespace STS\FilamentPHPInfo\Pages; | ||
|
||
use Filament\Pages\Page; | ||
use STS\Phpinfo as InfoWrapper; | ||
|
||
class PHPInfo extends Page | ||
{ | ||
protected static ?string $title = 'PHPInfo'; | ||
|
||
protected static string $view = 'filament-phpinfo::phpinfo'; | ||
|
||
protected static ?string $navigationLabel = 'PHPInfo'; | ||
|
||
protected InfoWrapper\Result $info; | ||
|
||
public function getViewData(): array | ||
{ | ||
return [ | ||
'info' => $this->getInfo(), | ||
]; | ||
} | ||
|
||
protected function getInfo(): InfoWrapper\Result | ||
{ | ||
return $this->info ??= InfoWrapper\Info::capture(); | ||
} | ||
|
||
public static function getSlug(): string | ||
{ | ||
return config('filament-phpinfo.page-slug', 'phpinfo'); | ||
} | ||
|
||
public static function getNavigationGroup(): ?string | ||
{ | ||
return config('filament-phpinfo.navigation-group'); | ||
} | ||
|
||
public static function getNavigationIcon(): ?string | ||
{ | ||
return config('filament-phpinfo.navigation-icon', 'heroicon-o-information-circle'); | ||
} | ||
} |