johntout / laravel-forge-panel
Add a panel to your app to manage various actions on Laravel Forge
Fund package maintenance!
johntout
paypal.me/johntout
Requires
- php: ^8.2
- illuminate/routing: ^10.0|^11.0
- illuminate/support: ^10.0|^11.0
- laravel/forge-sdk: ^3.14
- livewire/livewire: ^v3.5.20
Requires (Dev)
- laravel/pint: ^1.14
- laravel/prompts: ^0.1.6
- mockery/mockery: ^1.3.1
- orchestra/testbench: 8.20.0|^9.0
- pestphp/pest: ^2.34
- pestphp/pest-plugin-arch: ^2.7
- pestphp/pest-plugin-faker: ^2.0
- pestphp/pest-plugin-laravel: ^2.3
- pestphp/pest-plugin-livewire: ^2.1
- phpunit/phpunit: ^10.4
README
Add a panel to your app in order to manage various actions on Laravel Forge.
Currently supported actions are:
- Get server information
- Get site information
- Get and update .env file
- Execute commands
Installation
You can install the package via composer:
composer require johntout/laravel-forge-panel
Then run the install command to publish the assets.
php artisan laravel-forge-panel:install
In your .env
file you must save the following env variables in order to connect to your Laravel Forge account:
LARAVEL_FORGE_TOKEN= LARAVEL_FORGE_SERVER_ID= LARAVEL_FORGE_SITE_ID=
You can obtain your token through your Laravel Forge profile. The server id and the site id can be found on the top of your Laravel Forge site page.
You can access the Laravel Forge panel by visiting the page /forge-panel
. By default the panel is accessible in local environment. On production environment you must define the Gate below in the boot
method of your AppServiceProvider
, with your criteria, in order to access the panel.
use App\Models\User; use Illuminate\Support\Facades\Gate; Gate::define('viewLaravelForgePanel', function (User $user) { return $user->is_developer; });
Config file:
return [ 'middleware' => [ 'web', ], 'route' => 'forge-panel', 'token' => env('LARAVEL_FORGE_TOKEN'), 'server_id' => env('LARAVEL_FORGE_SERVER_ID'), 'site_id' => env('LARAVEL_FORGE_SITE_ID'), ];
All config options can be overwritten by publishing the configuration file using php artisan vendor:publish --tag=laravel-forge-panel-config
. If you add new configuration options they will be merged with the default ones from the package.
License
The package is open-sourced software licensed under the MIT license.