Skip to content

Commit

Permalink
feat: initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
GeoSot committed Apr 12, 2024
0 parents commit f06f14a
Show file tree
Hide file tree
Showing 22 changed files with 966 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .editorconfig
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
23 changes: 23 additions & 0 deletions .github/dependabot.yml
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"
28 changes: 28 additions & 0 deletions .github/workflows/php-cs-fixer.yml
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
26 changes: 26 additions & 0 deletions .github/workflows/phpstan.yml
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
76 changes: 76 additions & 0 deletions .github/workflows/phpunit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: phpunit

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os: [ubuntu-latest]
php: [8.1, 8.2, 8.3]
laravel: [10.*, 11.*]
include:
- laravel: 10.*
testbench: 8.*
- laravel: 11.*
testbench: 9.*
exclude:
- laravel: 11.*
php: 8.1


name: PHP ${{ matrix.php }} - Laravel ${{ matrix.laravel }} - ${{ matrix.os }}

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo
coverage: pcov

- name: Setup problem matchers
run: |
echo "::add-matcher::${{ runner.tool_cache }}/php.json"
echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
- name: Get composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT

- name: Cache dependencies
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-



- name: Install composer dependencies
run: |
composer --version
composer require "laravel/framework:${{ matrix.laravel }}" --no-interaction --no-update
composer require "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update --dev
composer update --prefer-dist --no-interaction --no-suggest --dev
composer dump
- name: Execute tests
run: vendor/bin/phpunit

- name: Upload coverage results to Coveralls
env:
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
composer global require php-coveralls/php-coveralls
php-coveralls --coverage_clover=build/logs/clover.xml -v
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/vendor
**/*.cache
/build

.idea
21 changes: 21 additions & 0 deletions LICENSE.md
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.
100 changes: 100 additions & 0 deletions README.md
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/saade/filament-laravel-log.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.
70 changes: 70 additions & 0 deletions composer.json
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": "dev-main"
},
"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
}
Loading

0 comments on commit f06f14a

Please sign in to comment.