-
-
Notifications
You must be signed in to change notification settings - Fork 4
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
0 parents
commit 2b1ebc5
Showing
20 changed files
with
861 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
insert_final_newline = true | ||
indent_style = space | ||
indent_size = 4 | ||
trim_trailing_whitespace = true | ||
|
||
[*.md] | ||
trim_trailing_whitespace = false | ||
|
||
[*.{yml,yaml}] | ||
indent_size = 2 |
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,23 @@ | ||
|
||
|
||
# Please see the documentation for all configuration options: | ||
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates | ||
|
||
version: 2 | ||
updates: | ||
- package-ecosystem: "composer" | ||
directory: "/" | ||
schedule: | ||
interval: "weekly" | ||
day: tuesday | ||
time: "12:00" | ||
labels: | ||
- "dependencies" | ||
open-pull-requests-limit: 10 | ||
|
||
- package-ecosystem: "github-actions" | ||
directory: "/" | ||
schedule: | ||
interval: weekly | ||
day: tuesday | ||
time: "12:00" |
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,28 @@ | ||
name: Check & fix styling | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
branches: [main] | ||
|
||
jobs: | ||
php-cs-fixer: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
# with: | ||
# ref: ${{ github.head_ref }} | ||
# token: ${{ secrets.PAT }} | ||
|
||
- name: Run PHP CS Fixer | ||
uses: docker://oskarstark/php-cs-fixer-ga | ||
with: | ||
args: --config=ruleset-php_cs.php --allow-risky=yes --show-progress=dots --diff --dry-run | ||
# | ||
# - name: Commit changes | ||
# uses: stefanzweifel/git-auto-commit-action@v4 | ||
# with: | ||
# commit_message: Apply php-cs-fixer changes |
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,26 @@ | ||
name: PHPStan | ||
|
||
on: | ||
push: | ||
paths: | ||
- '**.php' | ||
- 'ruleset-phpstan.neon' | ||
|
||
jobs: | ||
phpstan: | ||
name: phpstan | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: '8.1' | ||
coverage: none | ||
|
||
- name: Install composer dependencies | ||
uses: ramsey/composer-install@v3 | ||
|
||
- name: Run PHPStan | ||
run: ./vendor/bin/phpstan --error-format=github analyse -c ruleset-phpstan.neon -vvv |
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,5 @@ | ||
/vendor | ||
**/*.cache | ||
/build | ||
|
||
.idea |
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,21 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) GeoSot <geo.sotis@gmail.com> | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in | ||
all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
THE SOFTWARE. |
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,100 @@ | ||
# Filament Env Editor | ||
|
||
[![Latest Version on Packagist](https://img.shields.io/packagist/v/geo-sot/filament-env-editor.svg?style=flat-square)](https://packagist.org/packages/geo-sot/filament-env-editor) | ||
[![Total Downloads](https://img.shields.io/packagist/dt/geo-sot/filament-env-editor.svg?style=flat-square)](https://packagist.org/packages/geo-sot/filament-env-editor) | ||
|
||
<p align="center"> | ||
<img src="https://github.com/GeoSot/laravel-env-editor/assets/22406063/010b045c-842c-4e77-8426-36708bafde85" alt="Banner" style="width: 100%; max-width: 800px; border-radius: 10px" /> | ||
</p> | ||
|
||
# Features | ||
|
||
|
||
|
||
<br> | ||
|
||
## Installation | ||
|
||
You can install the package via composer: | ||
|
||
```bash | ||
composer require geo-sot/filament-env-editor | ||
``` | ||
|
||
## Usage | ||
|
||
Add the `GeoSot\FilamentEnvEditor\EnvEditorPlugin` to your panel config. | ||
|
||
```php | ||
use GeoSot\FilamentEnvEditor\EnvEditorPlugin; | ||
|
||
class AdminPanelProvider extends PanelProvider | ||
{ | ||
public function panel(Panel $panel): Panel | ||
{ | ||
return $panel | ||
// ... | ||
->plugin( | ||
EnvEditorPlugin::make() | ||
); | ||
} | ||
} | ||
``` | ||
|
||
## Configuration | ||
|
||
### Customizing the navigation item | ||
|
||
```php | ||
EnvEditorPlugin::make() | ||
->navigationGroup('System Tools') | ||
->navigationLabel('My Env') | ||
->navigationIcon('heroicon-o-cog-8-tooth') | ||
->navigationSort(1) | ||
->slug('env-editor') | ||
``` | ||
|
||
|
||
### Authorization | ||
If you would like to prevent certain users from accessing the logs page, you should add a `authorize` callback in the EnvEditorPlugin chain. | ||
|
||
```php | ||
EnvEditorPlugin::make() | ||
->authorize( | ||
fn () => auth()->user()->isAdmin() | ||
) | ||
``` | ||
|
||
### Customizing the log page | ||
|
||
To customize the "env-editor" page, you can extend the `GeoSot\FilamentEnvEditor\Pages\ViewEnv` page and override its methods. | ||
|
||
```php | ||
use GeoSot\FilamentEnvEditor\Pages\ViewEnv as BaseViewEnvEditor; | ||
|
||
class ViewEnv extends BaseViewEnvEditor | ||
{ | ||
// Your implementation | ||
} | ||
``` | ||
|
||
```php | ||
use App\Filament\Pages\ViewEnv; | ||
|
||
EnvEditorPlugin::make() | ||
->viewLog(ViewEnv::class) | ||
``` | ||
|
||
|
||
## Changelog | ||
|
||
Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently. | ||
|
||
## Contributing | ||
|
||
Please see [CONTRIBUTING](.github/CONTRIBUTING.md) for details. | ||
|
||
|
||
## License | ||
|
||
The MIT License (MIT). Please see [License File](LICENSE.md) for more information. |
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,70 @@ | ||
{ | ||
"name": "geo-sot/filament-env-editor", | ||
"description": "Access .env file though Filament admin panel", | ||
"keywords": [ | ||
"geo-sot", | ||
"laravel", | ||
"laravel-env-editor", | ||
"EnvEditor", | ||
"filament-env-editor" | ||
], | ||
"homepage": "https://github.com/GeoSot/filament-env-editor", | ||
"support": { | ||
"issues": "https://github.com/GeoSot/filament-env-editor/issues", | ||
"source": "https://github.com/GeoSot/filament-env-editor" | ||
}, | ||
"license": "MIT", | ||
"authors": [ | ||
{ | ||
"name": "Geo Sot", | ||
"email": "geo.sotis@gmail.com" | ||
} | ||
], | ||
"require": { | ||
"php": ">=8.1", | ||
"filament/filament": "^3.0", | ||
"illuminate/contracts": "^10.0|^11.0", | ||
"spatie/laravel-package-tools": "^1.15.0", | ||
"geo-sot/laravel-env-editor": "3.*" | ||
}, | ||
"require-dev": { | ||
"friendsofphp/php-cs-fixer": "^3", | ||
"larastan/larastan": "^2", | ||
"orchestra/testbench": ">=9", | ||
"phpstan/phpstan-deprecation-rules": "^1.0", | ||
"phpstan/phpstan-phpunit": "^1.0" | ||
|
||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"GeoSot\\FilamentEnvEditor\\": "src/" | ||
} | ||
}, | ||
"autoload-dev": { | ||
"psr-4": { | ||
"Saade\\FilamentLaravelLog\\Tests\\": "tests/" | ||
} | ||
}, | ||
"scripts": { | ||
"phpstan": "php --version && php vendor/bin/phpstan --version && php -d memory_limit=1G vendor/bin/phpstan analyse -c ruleset-phpstan.neon -vvv", | ||
"cs": "./vendor/bin/php-cs-fixer fix -vvv --show-progress=dots --config=ruleset-php_cs.php", | ||
"test": "./vendor/bin/phpunit", | ||
"test-all": [ | ||
"@test", | ||
"@phpstan", | ||
"@cs" | ||
] | ||
}, | ||
"config": { | ||
"sort-packages": true | ||
}, | ||
"extra": { | ||
"laravel": { | ||
"providers": [ | ||
"GeoSot\\FilamentEnvEditor\\ServiceProvider" | ||
] | ||
} | ||
}, | ||
"minimum-stability": "dev", | ||
"prefer-stable": true | ||
} |
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,50 @@ | ||
<?php | ||
|
||
return [ | ||
'navigation' => [ | ||
'group' => 'System', | ||
'label' => '.Env Editor', | ||
], | ||
|
||
'page' => [ | ||
'title' => '.Env Editor', | ||
|
||
'form' => [ | ||
], | ||
'actions' => [ | ||
'add' => [ | ||
'title' => 'Add new Entry', | ||
'modalHeading' => 'Add new Entry', | ||
'success' => [ | ||
'title' => 'Key ":Name", was successfully written', | ||
], | ||
'form' => [ | ||
'fields' => [ | ||
'key' => 'key', | ||
'value' => 'value', | ||
'index' => 'Insert After existing key (optional)', | ||
], | ||
'helpText' => [ | ||
'index' => 'In case you need to put this new entry, after an existing one, you may pick one of the existing key ', | ||
], | ||
], | ||
], | ||
'edit' => [ | ||
'tooltip' => 'Edit Entry ":name"', | ||
'modal' => [ | ||
'text' => 'Edit Entry', | ||
], | ||
], | ||
'delete' => [ | ||
'tooltip' => 'Remove the ":name" entry', | ||
'confirm' => [ | ||
'title' => 'You are going to permanently remove ":name". Are you sure of this removal?', | ||
], | ||
], | ||
'clear-cache' => [ | ||
'title' => 'Clear caches', | ||
'tooltip' => 'Sometimes laravel caches ENV variables, so you need to clear all caches ("artisan optimize:clear"), in order to rer-ead the .env change', | ||
], | ||
], | ||
], | ||
]; |
Empty file.
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,12 @@ | ||
<x-filament-panels::page> | ||
<x-filament-panels::form wire:submit="save"> | ||
{{ $this->form }} | ||
|
||
<x-filament-panels::form.actions | ||
:actions="$this->getCachedFormActions()" | ||
:full-width="$this->hasFullWidthFormActions()" | ||
/> | ||
</x-filament-panels::form> | ||
|
||
<x-filament-panels::page.unsaved-data-changes-alert /> | ||
</x-filament-panels::page> |
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 | ||
|
||
use PhpCsFixer\Config; | ||
use PhpCsFixer\Finder; | ||
|
||
$rules = [ | ||
'@Symfony' => true, | ||
'php_unit_method_casing' => ['case' => 'snake_case'], | ||
'elseif' => true, | ||
'phpdoc_align' => ['align' => 'left'], | ||
]; | ||
|
||
$dirsToCheck = [ | ||
__DIR__.'/src', | ||
__DIR__.'/resources', | ||
__DIR__.'/tests', | ||
]; | ||
|
||
$finder = Finder::create() | ||
->in(array_filter($dirsToCheck, 'file_exists')) | ||
->exclude(['vendor']) | ||
->name('*.php') | ||
->notName('*.blade.php') | ||
->ignoreDotFiles(true) | ||
->ignoreVCS(true); | ||
|
||
return (new Config()) | ||
->setFinder($finder) | ||
->setRules($rules) | ||
->setRiskyAllowed(true) | ||
->setUsingCache(true); |
Oops, something went wrong.