PHPackages                             krzksz/phcompile - 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. [DevOps &amp; Deployment](/categories/devops)
4. /
5. krzksz/phcompile

ActiveLibrary[DevOps &amp; Deployment](/categories/devops)

krzksz/phcompile
================

PHP server side precompiler for AngularJS apps.

v0.4.1(11y ago)524MITPHPPHP &gt;=5.3.0

Since Mar 2Pushed 11y ago1 watchersCompare

[ Source](https://github.com/krzksz/phCompile)[ Packagist](https://packagist.org/packages/krzksz/phcompile)[ RSS](/packages/krzksz-phcompile/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (2)Versions (10)Used By (0)

phCompile
=========

[](#phcompile)

[![Build Status](https://camo.githubusercontent.com/65be26d2c57134669b6cf139fb983b25ed246b88699677431a5b4091edc4b997/68747470733a2f2f7472617669732d63692e6f72672f6b727a6b737a2f7068436f6d70696c652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/krzksz/phCompile)

Library for server-side precompiling AngularJS templates in PHP.

The goal of using phCompile is to let you compile your HTML templates using your existing JSON REST api.

Server side compiling works in a way that lets you easily revert back all of the changes made by phCompile on the client side by either adding speciall class or attribute to the element.

phCompile is still in alpha state, bugs and api changes may occur.

### Use cases

[](#use-cases)

- Serving complete website on first load for better SEO and social crawlers.
- Reusing AngualarJS templates outside client application.
- Static HTML page generation.
- Faster website rendering when using big data chunks.
- Making your website preserve minimal functionality without JavaScript enabled.

### Supported AngularJS features

[](#supported-angularjs-features)

- {{ }} expressions;
- ng-repeat(without "track by");
- ng-hide, ng-show;
- ng-class, ng-class-even, ng-class-odd;
- ng-bind, ng-bind-template;
- ng-href;
- ng-value;
- ng-src, ng-srcset.

### Roadmap

[](#roadmap)

- Remaining textual AngularJS directives,
- Filters(currently they are expected to break expression that uses them),
- Expressions cache,
- Suggestions?

### Quick Example

[](#quick-example)

```
$phCompile = new \PhCompile\PhCompile(); // Create PhCompile object
$template = new \PhCompile\Template\Template($phCompile); // Create template
$template->setScope(new Scope(array('foo'=>'bar'))); // Set scope data.

$template->loadHtml('template.html'); // Load from file
$template->setHtml(''); // Or just from string
echo $template->compile(); // "bar"
```

### [Documentation](https://github.com/krzksz/ngPhCompile/wiki)

[](#documentation)

### Contribute

[](#contribute)

You are welcome to contribute your own improvements and ideas. If you have any issues and feature ideas please post them at [project's issues page](https://github.com/krzksz/phCompile/issues).

### Contact

[](#contact)

If you would like you can contact me or follow via Twitter [@krzksz](https://twitter.com/krzksz).

### Thanks

[](#thanks)

I would like to thank [@danchoi](https://github.com/danchoi) for creating his [AngularJS template parser in Haskell](https://github.com/danchoi/ngrender) which gave me inspiration and ideas for this project.

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity54

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 ~1 days

Total

9

Last Release

4075d ago

### Community

Maintainers

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

---

Top Contributors

[![krzksz](https://avatars.githubusercontent.com/u/829189?v=4)](https://github.com/krzksz "krzksz (79 commits)")

---

Tags

serverrenderangularcompile

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/krzksz-phcompile/health.svg)

```
[![Health](https://phpackages.com/badges/krzksz-phcompile/health.svg)](https://phpackages.com/packages/krzksz-phcompile)
```

###  Alternatives

[spatie/laravel-webhook-server

Send webhooks in Laravel apps

1.1k8.8M22](/packages/spatie-laravel-webhook-server)[pragmarx/health

Laravel Server &amp; App Health Monitor and Notifier

2.0k1.0M2](/packages/pragmarx-health)[felixfbecker/language-server-protocol

PHP classes for the Language Server Protocol

22476.7M6](/packages/felixfbecker-language-server-protocol)[clue/socket-raw

Simple and lightweight OOP wrapper for PHP's low-level sockets extension (ext-sockets).

35111.1M48](/packages/clue-socket-raw)[voryx/thruway

Thruway WAMP router core

6771.0M17](/packages/voryx-thruway)[php-mcp/server

PHP SDK for building Model Context Protocol (MCP) servers - Create MCP tools, resources, and prompts

828280.5k25](/packages/php-mcp-server)

PHPackages © 2026

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