guanguans / laravel-code-runner
在浏览器中运行 PHP 代码。 - 在浏览器中运行 PHP 代码。
0.7.0
2024-03-13 08:30 UTC
Requires
- php: >=7.4
- ext-json: *
- illuminate/contracts: ^7.0 || ^8.0 || ^9.0 || ^10.0 || ^11.0
- laravel-frontend-presets/tall: ^4.0 || ^5.0 || ^6.0 || ^7.0
- laravel/tinker: ^2.9
- livewire/livewire: ^2.12 || ^3.0
- spatie/laravel-package-tools: ^1.12
Requires (Dev)
- awssat/tailwindo: ^3.0
- brainmaestro/composer-git-hooks: ^2.8
- corveda/php-sandbox: ^3.0
- dms/phpunit-arraysubset-asserts: ^0.5
- ekino/phpstan-banned-code: ^1.0
- ergebnis/composer-normalize: ^2.42
- friendsofphp/php-cs-fixer: ^3.51
- guanguans/ai-commit: dev-main
- guanguans/monorepo-builder-worker: ^1.4
- infection/infection: ^0.26
- innocenzi/laravel-vite: ^0.1
- jetbrains/phpstorm-attributes: ^1.0
- johnkary/phpunit-speedtrap: ^4.0
- mockery/mockery: ^1.6
- nunomaduro/collision: ^5.11 || ^6.0 || ^7.0 || ^8.0
- nunomaduro/larastan: ^1.0 || ^2.0
- nyholm/nsa: ^1.3
- orchestra/testbench: ^6.0 || ^7.0
- pestphp/pest: ^1.23 || ^2.0
- pestphp/pest-plugin-faker: ^1.0 || ^2.0
- pestphp/pest-plugin-laravel: ^1.3
- pestphp/pest-plugin-livewire: ^1.0 || ^2.0
- phpstan/extension-installer: ^1.3
- phpstan/phpstan-deprecation-rules: ^1.1
- phpstan/phpstan-phpunit: ^1.3
- phpstan/phpstan-strict-rules: ^1.5
- psalm/plugin-laravel: ^1.6 || ^2.0
- rector/rector: ^1.0
- roave/security-advisories: dev-latest
- spatie/pest-plugin-snapshots: ^1.1 || ^2.0
- vimeo/psalm: ^4.30 || ^5.0
This package is auto-updated.
Last update: 2024-09-05 21:06:44 UTC
README
在浏览器中运行 PHP 代码。 - 在浏览器中运行 PHP 代码。
要求
- PHP >= 7.4
- Laravel >= 7.0
安装
您可以通过 composer 安装此包。
composer require guanguans/laravel-code-runner --prefer-dist -vvv
您必须运行此命令以发布此包中的资源。
php artisan code-runner:install
您可以发布包的配置文件(可选)。
php artisan vendor:publish --provider="Guanguans\LaravelCodeRunner\CodeRunnerServiceProvider" --tag="code-runner-config"
用法
默认情况下,此包仅会在本地环境中运行。
访问您的应用程序中的 /code-runner
以查看页面。
授权
如果您想在其他环境中运行此包(我们不推荐这样做),您必须执行以下两个步骤。
-
您必须在
code-runner
配置文件中将enabled
变量设置为true
。 -
您必须注册
view-code-runner
能力。一个好的地方是在 Laravel 附带的AuthServiceProvider
中进行此操作。
use Illuminate\Contracts\Auth\Authenticatable; public function boot() { $this->registerPolicies(); Gate::define('view-code-runner', function (?Authenticatable $user = null) { // Return true if access to web tinker is allowed. Here's an example: return $user && in_array($user->email, [ 'admin@example.com', ]); }); }
测试
composer test
变更日志
请参阅 变更日志 了解最近更改的详细信息。
贡献
请参阅 贡献指南 了解详细信息。
安全漏洞
请查看 我们的安全策略 了解如何报告安全漏洞。
致谢
许可证
MIT 许可证(MIT)。请参阅 许可证文件 了解更多信息。