PHPackages                             redberry/spear - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. redberry/spear

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

redberry/spear
==============

Ran any language with Spear!

v0.0.1-beta(3y ago)22MITPHP

Since May 19Pushed 3y ago1 watchersCompare

[ Source](https://github.com/RedberryProducts/Spear)[ Packagist](https://packagist.org/packages/redberry/spear)[ RSS](/packages/redberry-spear/feed)WikiDiscussions master Synced 1w ago

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

### Spear

[](#spear)

- [Introduction](#introduction)
- [Getting Started](#getting-started)
- [How To Use](#how-to-use)
- [Available Languages](#available-languages)
- [How does Spear work?](#how-does-spear-work)

#### Introduction

[](#introduction)

Spear is a convinient PHP package that allows you to execute code in many different languages. It's simple to use and easy to install.

#### Getting Started

[](#getting-started)

To get started using `Spear` you need to install it as a dependency in your php project using composer:

```
  composer require redberry/spear
```

and you're good to go 🙏

#### How to Use

[](#how-to-use)

Using `Spear` is a piece of cake procedure. you just need to instantiate `Spear` class and execute any available language code you'd like. The key concepts of the `Spear` are:

- `Spear` class which does the coordination between different language handler and returning actual output.
- Handler - on `Spear` class you can choose desired handler. Choosing handler is same as choosing with which language you'd like the code to be executed
- Every handler returns the output which has three kinds of information: success output, error output, exit code

Let's see how would we implement handling node code without input:

```
