PHPackages                             suzunone/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. [API Development](/categories/api)
4. /
5. suzunone/code-runner

ActiveLibrary[API Development](/categories/api)

suzunone/code-runner
====================

code-runner from piza.io.(piza.io API unofficial wrapper.)

v1.0.1(4y ago)1541BSD-3-ClausePHPPHP ^7.4|^8.0

Since Jan 8Pushed 4y ago1 watchersCompare

[ Source](https://github.com/suzunone/CodeRunner)[ Packagist](https://packagist.org/packages/suzunone/code-runner)[ RSS](/packages/suzunone-code-runner/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (2)Dependencies (4)Versions (3)Used By (0)

CodeRunner
==========

[](#coderunner)

[![example workflow](https://github.com/suzunone/CodeRunner/actions/workflows/php.yml/badge.svg)](https://github.com/suzunone/CodeRunner/actions/workflows/php.yml/badge.svg)

Introduction
------------

[](#introduction)

[paiza.io](https://paiza.io/ja) API unofficial wrapper. Using the [Paiza API](http://api.paiza.io/docs/swagger/#!/runners/), compile and execute arbitrary code in a variety of programming languages.

Notice for using
----------------

[](#notice-for-using)

This package use [paiza.io](https://paiza.io/ja) API. So please read [term of use (Japanese only)](http://paiza.jp/guide/kiyaku).

Installation Instructions
=========================

[](#installation-instructions)

Composer
--------

[](#composer)

```
composer require suzunone/code-runner

```

Example
=======

[](#example)

Example1
--------

[](#example1)

### Source code

[](#source-code)

```
create($source_code, CodeRunner::LANG_JAVASCRIPT);
while ($entity->is_running) {
    $entity = $entity->status();
    sleep(1);
}

var_dump($entity->details()->toArray());
```

### Results

[](#results)

```
array(17) {
  ["id"]=>
  string(22) ""
  ["language"]=>
  string(10) "javascript"
  ["note"]=>
  NULL
  ["status"]=>
  string(9) "completed"
  ["build_stdout"]=>
  NULL
  ["build_stderr"]=>
  NULL
  ["build_exit_code"]=>
  int(0)
  ["build_time"]=>
  NULL
  ["build_memory"]=>
  NULL
  ["build_result"]=>
  NULL
  ["stdout"]=>
  string(16) "Hello, world...
"
  ["stderr"]=>
  string(0) ""
  ["exit_code"]=>
  int(0)
  ["time"]=>
  string(4) "0.07"
  ["memory"]=>
  int(32408000)
  ["connections"]=>
  int(0)
  ["result"]=>
  string(7) "success"

```

API Reference
=============

[](#api-reference)

Suzunone\\CodeRunner\\CodeRunner
--------------------------------

[](#suzunonecoderunnercoderunner)

### constants.

[](#constants)

#### CodeRunner::LANG\_C ***(string)***

[](#coderunnerlang_c-string)

**C** Language constant

#### CodeRunner::LANG\_CPP ***(string)***

[](#coderunnerlang_cpp-string)

**C++** Language constant

#### CodeRunner::LANG\_OBJECTIVE\_C ***(string)***

[](#coderunnerlang_objective_c-string)

**Objective-C** Language constant

#### CodeRunner::LANG\_JAVA ***(string)***

[](#coderunnerlang_java-string)

**Java** Language constant

#### CodeRunner::LANG\_KOTLIN ***(string)***

[](#coderunnerlang_kotlin-string)

**Kotlin** Language constant

#### CodeRunner::LANG\_SCALA ***(string)***

[](#coderunnerlang_scala-string)

**Scala** Language constant

#### CodeRunner::LANG\_SWIFT ***(string)***

[](#coderunnerlang_swift-string)

**Swift** Language constant

#### CodeRunner::LANG\_CSHARP ***(string)***

[](#coderunnerlang_csharp-string)

**C#** Language constant

#### CodeRunner::LANG\_GO ***(string)***

[](#coderunnerlang_go-string)

**GO** Language constant

#### CodeRunner::LANG\_HASKELL ***(string)***

[](#coderunnerlang_haskell-string)

**Haskell** Language constant

#### CodeRunner::LANG\_ERLANG ***(string)***

[](#coderunnerlang_erlang-string)

**Erlang** Language constant

#### CodeRunner::LANG\_PERL ***(string)***

[](#coderunnerlang_perl-string)

**Perl** Language constant

#### CodeRunner::LANG\_PYTHON ***(string)***

[](#coderunnerlang_python-string)

**Python2** Language constant ***(string)***

#### CodeRunner::LANG\_PYTHON3 ***(string)***

[](#coderunnerlang_python3-string)

**Python3** Language constant

#### CodeRunner::LANG\_RUBY ***(string)***

[](#coderunnerlang_ruby-string)

**Ruby** Language constant

#### CodeRunner::LANG\_PHP ***(string)***

[](#coderunnerlang_php-string)

**PHP** Language constant

#### CodeRunner::LANG\_BASH ***(string)***

[](#coderunnerlang_bash-string)

**Bash** Language constant

#### CodeRunner::LANG\_R ***(string)***

[](#coderunnerlang_r-string)

**R** Language constant

#### CodeRunner::LANG\_JAVASCRIPT ***(string)***

[](#coderunnerlang_javascript-string)

**JavaScript** Language constant

#### CodeRunner::LANG\_COFFEESCRIPT ***(string)***

[](#coderunnerlang_coffeescript-string)

**CoffeeScript** Language constant

#### CodeRunner::LANG\_VB ***(string)***

[](#coderunnerlang_vb-string)

**VB** Language constant

#### CodeRunner::LANG\_COBOL ***(string)***

[](#coderunnerlang_cobol-string)

**Cobol** Language constant

#### CodeRunner::LANG\_FSHARP ***(string)***

[](#coderunnerlang_fsharp-string)

**F#** Language constant

#### CodeRunner::LANG\_D ***(string)***

[](#coderunnerlang_d-string)

**D** Language constant

#### CodeRunner::LANG\_CLOJURE ***(string)***

[](#coderunnerlang_clojure-string)

**Clojure** Language constant

#### CodeRunner::LANG\_ELIXIR ***(string)***

[](#coderunnerlang_elixir-string)

**Elixir** Language constant

#### CodeRunner::LANG\_MYSQL ***(string)***

[](#coderunnerlang_mysql-string)

**MySQL** Language constant

#### CodeRunner::LANG\_RUST ***(string)***

[](#coderunnerlang_rust-string)

**Rust** Language constant

#### CodeRunner::LANG\_SCHEME ***(string)***

[](#coderunnerlang_scheme-string)

**Scheme** Language constant

#### CodeRunner::LANG\_COMMON\_LISP ***(string)***

[](#coderunnerlang_common_lisp-string)

**Common Lisp** Language constant

#### CodeRunner::LANG\_NADESIKO ***(string)***

[](#coderunnerlang_nadesiko-string)

**なでしこ** Language constant

#### CodeRunner::LANG\_TYPESCRIPT ***(string)***

[](#coderunnerlang_typescript-string)

**TypeScript** Language constant

#### CodeRunner::LANG\_PLAIN ***(string)***

[](#coderunnerlang_plain-string)

**PlainText** Language constant

#### CodeRunner::LANGS ***(array)***

[](#coderunnerlangs-array)

#### CodeRunner::EXTENSIONS ***(array)***

[](#coderunnerextensions-array)

#### CodeRunner::STATUS\_RUNNING ***(string)***

[](#coderunnerstatus_running-string)

is status already running.

#### CodeRunner::STATUS\_COMPLETED ***(string)***

[](#coderunnerstatus_completed-string)

is status already completed.

### CodeRunner::create()

[](#coderunnercreate)

Start compiling and executing the program code.

```
CodeRunner::create(string $source_code, string $language, string $input = '', bool $longpoll = false, int $longpoll_timeout = 10): Suzunone\CodeRunner\Entities\OutputEntityInterface
```

#### **Parameters:**

[](#parameters)

ParameterTypeDescription`$source_code`**string**program code`$language`**string**language constant`$input`**string**string passed in standard input`$longpoll`**bool**Wait for compilation and execution to complete.`$longpoll_timeout`**int**longpoll timeout time.#### **Return:**

[](#return)

```
\Suzunone\CodeRunner\Entities\OutputEntityInterface
```

### CodeRunner::getTemplate()

[](#coderunnergettemplate)

Returns a template of the program code according to the language constants.

```
CodeRunner::getTemplate(string $language): string
```

#### **Parameters:**

[](#parameters-1)

ParameterTypeDescription`$language`**string**language constant#### **Return:**

[](#return-1)

```
string
```

### CodeRunner::getLanguageName()

[](#coderunnergetlanguagename)

Get the program name according to the language constant.

```
CodeRunner::getLanguageName(string $language): string
```

#### **Parameters:**

[](#parameters-2)

ParameterTypeDescription`$language`**string**language constant#### **Return:**

[](#return-2)

```
string
```

### CodeRunner::getLangExtension()

[](#coderunnergetlangextension)

Get the program file extension according to the language constant.

```
CodeRunner::getLangExtension(string $language): string
```

#### **Parameters:**

[](#parameters-3)

ParameterTypeDescription`$language`**string**language constant#### **Return:**

[](#return-3)

```
string
```

### CodeRunner::getApiKey()

[](#coderunnergetapikey)

Get the API Key.

```
CodeRunner::getApiKey(): string
```

#### **Parameters:**

[](#parameters-4)

#### **Return:**

[](#return-4)

```
string
```

### CodeRunner::setApiKey()

[](#coderunnersetapikey)

Set the API Key.

```
CodeRunner::setApiKey(string $api_key): void
```

#### **Parameters:**

[](#parameters-5)

ParameterTypeDescription`$api_key`**string**API KEY#### **Return:**

[](#return-5)

```
string
```

\\Suzunone\\CodeRunner\\Entities\\OutputEntityInterface
-------------------------------------------------------

[](#suzunonecoderunnerentitiesoutputentityinterface)

Get the compilation and execution status of a program

### OutputEntityInterface::status()

[](#outputentityinterfacestatus)

```
OutputEntityInterface::status(): StatusEntity;
```

#### **Parameters:**

[](#parameters-6)

#### **Return:**

[](#return-6)

```
Suzunone\CodeRunner\Entities\Input|StatusEntity
```

### OutputEntityInterface::details()

[](#outputentityinterfacedetails)

Get the results of compiling and executing a program.

```
OutputEntityInterface::details(): StatusEntity;
```

#### **Parameters:**

[](#parameters-7)

#### **Return:**

[](#return-7)

```
Suzunone\CodeRunner\Entities\Input|StatusEntity
```

### OutputEntityInterface::getResponse()

[](#outputentityinterfacegetresponse)

Get Response data.

```
getResponse() : ResponseElementInterface
```

#### **Parameters:**

[](#parameters-8)

#### **Return:**

[](#return-8)

```
Suzunone\CodeRunner\Entities\Elements\Input|ResponseElementInterface
```

\\Suzunone\\CodeRunner\\Entities\\Output\\CreateEntity
------------------------------------------------------

[](#suzunonecoderunnerentitiesoutputcreateentity)

### properties

[](#properties)

PropertiesTypeDescription**$id****string** ***\[readonly\]***session id(This should be used in get\_status/get\_details API)**$status****string** ***\[readonly\]***running', 'completed'**$error****string** ***\[readonly\]***error message.**$is\_error****bool** ***\[readonly\]***if error is true**$is\_completed****bool** ***\[readonly\]***if completed is true**$is\_running****bool** ***\[readonly\]***if running is true\\Suzunone\\CodeRunner\\Entities\\Output\\StatusEntity
------------------------------------------------------

[](#suzunonecoderunnerentitiesoutputstatusentity)

### properties

[](#properties-1)

PropertiesTypeDescription**$id****string** ***\[readonly\]***session id(This should be used in get\_status/get\_details API)**$status****string** ***\[readonly\]***running', 'completed'**$is\_error****bool** ***\[readonly\]***if error is true**$is\_completed****bool** ***\[readonly\]***if completed is true**$is\_running****bool** ***\[readonly\]***if running is true\\Suzunone\\CodeRunner\\Entities\\Output\\DetailsEntity
-------------------------------------------------------

[](#suzunonecoderunnerentitiesoutputdetailsentity)

### properties

[](#properties-2)

PropertiesTypeDescription**id****string**Session id**language****string**language**note****string**note**status****string**status('running', 'completed')**build\_stdout****?string**build output to stdout**build\_stderr****?string**build output to stderr**build\_exit\_code****int**build exit code**build\_time****?int**build time(second)**build\_memory****?int**build memory usage(bytes)**build\_result****?int**build result('success', 'failure', 'error')**stdout****?string**code output to stdout**stderr****?string**code output to stderr**exit\_code****int**exit code**time****int**time to run(seconds)**memory****int**code memory usage(bytes)**result****string**code result('success', 'failure', 'error')**$is\_completed****bool** ***\[readonly\]***if completed is true**$is\_running****bool** ***\[readonly\]***if running is true

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~25 days

Total

2

Last Release

1566d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/630015fa1a1a301f4fdebfc315ac1e2b6ad90ae681972e0d067c6887a7ed292d?d=identicon)[suzunone](/maintainers/suzunone)

---

Top Contributors

[![suzunone](https://avatars.githubusercontent.com/u/7632752?v=4)](https://github.com/suzunone "suzunone (12 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3731.2M42](/packages/tencentcloud-tencentcloud-sdk-php)[convertkit/convertkitapi

Kit PHP SDK for the Kit API

2167.1k1](/packages/convertkit-convertkitapi)[mapado/rest-client-sdk

Rest Client SDK for hydra API

1125.9k2](/packages/mapado-rest-client-sdk)

PHPackages © 2026

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