PHPackages                             samsonos/php\_coffeescript - 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. samsonos/php\_coffeescript

ActiveLibrary

samsonos/php\_coffeescript
==========================

A port of the CoffeeScript compiler to PHP for SamsonPHP

21161PHP

Since Nov 17Pushed 11y ago2 watchersCompare

[ Source](https://github.com/samsonos/php_coffeescript)[ Packagist](https://packagist.org/packages/samsonos/php_coffeescript)[ RSS](/packages/samsonos-php-coffeescript/feed)WikiDiscussions master Synced 1w ago

READMEChangelogDependenciesVersions (1)Used By (0)

CoffeeScript PHP
================

[](#coffeescript-php)

A port of the [CoffeeScript](http://jashkenas.github.com/coffee-script/)compiler to PHP.

Status
------

[](#status)

CoffeeScript version **1.3.1** has been fully ported over (see [tags](http://github.com/alxlit/coffeescript-php/tags)). There are a couple benign differences between the port's compiled code and the reference's (for example [\#11](https://github.com/alxlit/coffeescript-php/issues/11)), otherwise they match 100%.

Requirements
------------

[](#requirements)

PHP 5.3+ (uses namespaces, anonymous functions).

Install
-------

[](#install)

It's recommended that you use [Composer](http://getcomposer.org) to install and autoload CoffeeScript. Alternatively you can load it manually:

```

```

Usage
-----

[](#usage)

The API is really basic (single `compile($coffee, $options = NULL)` function). I don't plan on expanding it further (keeping it simple). Here are the available options:

- **filename** - The source filename, formatted into error messages
- **header** - Add a "Generated by..." header
- **bare** - If set to `true`, the generated Javascript won't be embedded in a [IIFE](http://benalman.com/news/2010/11/immediately-invoked-function-expression/)
- **rewrite** - Enable the rewriter (debugging)
- **tokens** - Reference to token stream (debugging)
- **trace** - File to write parser trace to (debugging)

```

```

Development
-----------

[](#development)

To rebuild the parser run `php make.php`. Tests are run in the browser; simply clone the repository somewhere Apache can see it and navigate to tests/.

FAQ
---

[](#faq)

#### What was the motivation for this project?

[](#what-was-the-motivation-for-this-project)

I was using PHP a lot at the time and wanted to use, learn more about, and potentially contribute to the CoffeeScript project. I thought it'd be nice to have a native version gave it a shot.

#### Why not modify the original compiler to emit PHP?

[](#why-not-modify-the-original-compiler-to-emit-php)

For a number of reasons... First, I don't know why you'd want something like that. If you find PHP intolerable, just don't use it... Second, the original compiler depends on Jison, which is written in JavaScript, so you'd have to do something about that. Third, I think it'd be much more work to try and sort out all the differences between JavaScript and PHP (object model, core classes and libraries, etc).

#### What parser generator are you using?

[](#what-parser-generator-are-you-using)

Since there's no PHP port of Bison (which the reference compiler uses), we're using a port of Lemon called [ParserGenerator](http://pear.php.net/package/PHP_ParserGenerator).

It's included locally since the PEAR package is unmaintained and seems to be broken. In addition, some minor changes have been made to the parser template (Lempar.php) and the actual generator.

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 90.6% 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/0be8756efdc8f599b8fe9261bed31570d0f140a3b921f0f891877a9133ad654c?d=identicon)[samsonos](/maintainers/samsonos)

---

Top Contributors

[![alxlit](https://avatars.githubusercontent.com/u/361093?v=4)](https://github.com/alxlit "alxlit (144 commits)")[![vitalyiegorov](https://avatars.githubusercontent.com/u/586558?v=4)](https://github.com/vitalyiegorov "vitalyiegorov (6 commits)")[![bfanger](https://avatars.githubusercontent.com/u/207248?v=4)](https://github.com/bfanger "bfanger (4 commits)")[![briannesbitt](https://avatars.githubusercontent.com/u/170745?v=4)](https://github.com/briannesbitt "briannesbitt (1 commits)")[![cschramm](https://avatars.githubusercontent.com/u/464848?v=4)](https://github.com/cschramm "cschramm (1 commits)")[![kochb](https://avatars.githubusercontent.com/u/1012892?v=4)](https://github.com/kochb "kochb (1 commits)")[![olivierphi](https://avatars.githubusercontent.com/u/722388?v=4)](https://github.com/olivierphi "olivierphi (1 commits)")[![onysko](https://avatars.githubusercontent.com/u/7703953?v=4)](https://github.com/onysko "onysko (1 commits)")

### Embed Badge

![Health badge](/badges/samsonos-php-coffeescript/health.svg)

```
[![Health](https://phpackages.com/badges/samsonos-php-coffeescript/health.svg)](https://phpackages.com/packages/samsonos-php-coffeescript)
```

PHPackages © 2026

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