PHPackages                             guanguans/laravel-code-runner - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Debugging &amp; Profiling](/categories/debugging)
4. /
5. guanguans/laravel-code-runner

ActiveLibrary[Debugging &amp; Profiling](/categories/debugging)

guanguans/laravel-code-runner
=============================

Run the PHP code in the browser. - 在浏览器中运行 PHP 代码。

0.7.0(2y ago)116MITPHPPHP &gt;=7.4CI passing

Since Oct 27Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/guanguans/laravel-code-runner)[ Packagist](https://packagist.org/packages/guanguans/laravel-code-runner)[ Docs](https://github.com/guanguans/laravel-code-runner)[ Fund](https://www.guanguans.cn/images/wechat.jpeg)[ RSS](/packages/guanguans-laravel-code-runner/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (8)Dependencies (36)Versions (14)Used By (0)

laravel-code-runner
===================

[](#laravel-code-runner)

[![](docs/usage.png)](docs/usage.png)

[ENGLISH](README.md) | [简体中文](README-zh_CN.md)

> Run the PHP code in the browser. - 在浏览器中运行 PHP 代码。

[![tests](https://github.com/guanguans/laravel-code-runner/actions/workflows/tests.yml/badge.svg)](https://github.com/guanguans/laravel-code-runner/actions/workflows/tests.yml)[![check & fix styling](https://github.com/guanguans/laravel-code-runner/actions/workflows/php-cs-fixer.yml/badge.svg)](https://github.com/guanguans/laravel-code-runner/actions)[![codecov](https://camo.githubusercontent.com/7c96452bf8e8bdf2a2206a04c4cc7d3686ac3d76792620c2fb14472ca9f8e60d/68747470733a2f2f636f6465636f762e696f2f67682f6775616e6775616e732f6c61726176656c2d636f64652d72756e6e65722f6272616e63682f6d61696e2f67726170682f62616467652e7376673f746f6b656e3d55524746415753365334)](https://codecov.io/gh/guanguans/laravel-code-runner)[![Latest Stable Version](https://camo.githubusercontent.com/323d1f04ca53421ad0ee1585a70d198f96b932b37971df319585d17ab43c81bd/68747470733a2f2f706f7365722e707567782e6f72672f6775616e6775616e732f6c61726176656c2d636f64652d72756e6e65722f76)](//packagist.org/packages/guanguans/laravel-code-runner)[![GitHub release (latest by date)](https://camo.githubusercontent.com/f9205739abf0a70b7d7c1eed527b6855d642678ba43d923c2b5f7bfb15c50e43/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f6775616e6775616e732f6c61726176656c2d636f64652d72756e6e6572)](https://camo.githubusercontent.com/f9205739abf0a70b7d7c1eed527b6855d642678ba43d923c2b5f7bfb15c50e43/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f6775616e6775616e732f6c61726176656c2d636f64652d72756e6e6572)[![Total Downloads](https://camo.githubusercontent.com/f10179de916619351f87f4be4f5631d7f450076974cc84561037576e7f879de1/68747470733a2f2f706f7365722e707567782e6f72672f6775616e6775616e732f6c61726176656c2d636f64652d72756e6e65722f646f776e6c6f616473)](//packagist.org/packages/guanguans/laravel-code-runner)[![License](https://camo.githubusercontent.com/6d1cf75b0342bc211646b5aec9b511cf75c918707c87fbc79e5cfd3c6639cc01/68747470733a2f2f706f7365722e707567782e6f72672f6775616e6775616e732f6c61726176656c2d636f64652d72756e6e65722f6c6963656e7365)](//packagist.org/packages/guanguans/laravel-code-runner)

Requirement
-----------

[](#requirement)

- PHP &gt;= 7.4
- Laravel &gt;= 7.0

Installation
------------

[](#installation)

You can install the package via composer.

```
composer require guanguans/laravel-code-runner --prefer-dist -vvv
```

You must publish the assets from this package by running this command.

```
php artisan code-runner:install
```

You can publish the config file of the package(optional).

```
php artisan vendor:publish --provider="Guanguans\LaravelCodeRunner\CodeRunnerServiceProvider" --tag="code-runner-config"
```

Usage
-----

[](#usage)

By default this package will only run in a local environment.

Visit `/code-runner` in your app to view page.

### Authorization

[](#authorization)

Should you want to run this in another environment (we do not recommend this), there are two steps you must perform.

1. You must set the `enabled` variable in the `code-runner` config file to `true`.
2. You must register a `view-code-runner` ability. A good place to do this is in the `AuthServiceProvider` that ships with Laravel.

```
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',
        ]);
    });
}
```

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](.github/CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [guanguans](https://github.com/guanguans)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE) for more information.

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance60

Regular maintenance activity

Popularity11

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity43

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 54.7% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~71 days

Recently: every ~124 days

Total

8

Last Release

788d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/a49e4a0625bdf47c4e2924dcf07a053538d0c3a1e9287e8d6bfe68ed4017aa6f?d=identicon)[guanguans](/maintainers/guanguans)

---

Top Contributors

[![guanguans](https://avatars.githubusercontent.com/u/22309277?v=4)](https://github.com/guanguans "guanguans (93 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (58 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (19 commits)")

---

Tags

artisanbrowsercodecode-runnerdebugdebuggerdevelopmentlaravelparserphpphp-parserrunnertinkerwebweb-tinkerphpbrowserweblaraveldebugcodeTinkerparserartisandevelopmentrunnerphp-parserweb-tinkercode-runner

###  Code Quality

TestsPest

Static AnalysisPsalm, Rector

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/guanguans-laravel-code-runner/health.svg)

```
[![Health](https://phpackages.com/badges/guanguans-laravel-code-runner/health.svg)](https://phpackages.com/packages/guanguans-laravel-code-runner)
```

###  Alternatives

[spatie/laravel-web-tinker

Artisan Tinker in your browser

1.2k3.8M6](/packages/spatie-laravel-web-tinker)[stephenjude/filament-debugger

About

102125.4k2](/packages/stephenjude-filament-debugger)[spatie/laravel-error-solutions

Display solutions on the Laravel error page

9773.5k](/packages/spatie-laravel-error-solutions)[php-console/laravel-service-provider

Laravel service provider to handle PHP errors, dump variables, execute PHP code remotely in Google Chrome

7361.2k1](/packages/php-console-laravel-service-provider)[bavix/laravel-xhprof

Quick profiling of your code for Laravel

22156.6k](/packages/bavix-laravel-xhprof)[a2insights/filament-saas

Filament Saas for A2Insights

161.1k](/packages/a2insights-filament-saas)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
