2017 © Pedro Peláez
 

library phcompile

PHP server side precompiler for AngularJS apps.

image

krzksz/phcompile

PHP server side precompiler for AngularJS apps.

  • Thursday, March 12, 2015
  • by krzksz
  • Repository
  • 1 Watchers
  • 4 Stars
  • 14 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 10 Versions
  • 0 % Grown

The README.md

phCompile

Build Status, (*1)

Library for server-side precompiling AngularJS templates in PHP., (*2)

The goal of using phCompile is to let you compile your HTML templates using your existing JSON REST api., (*3)

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., (*4)

phCompile is still in alpha state, bugs and api changes may occur., (*5)

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

  • {{ }} 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

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

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('<span ng-bind="foo"></span>'); // Or just from string
echo $template->compile(); // "<span ng-bind="foo">bar</span>"

Documentation

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., (*6)

Contact

If you would like you can contact me or follow via Twitter @krzksz., (*7)

Thanks

I would like to thank @danchoi for creating his AngularJS template parser in Haskell which gave me inspiration and ideas for this project., (*8)

The Versions

12/03 2015

dev-master

9999999-dev

PHP server side precompiler for AngularJS apps.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

by Mateusz Krzeszowiak

server render angular compile

12/03 2015

v0.4.1

0.4.1.0

PHP server side precompiler for AngularJS apps.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

by Mateusz Krzeszowiak

server render angular compile

11/03 2015

v0.4.0

0.4.0.0

PHP server side precompiler for AngularJS apps.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

by Mateusz Krzeszowiak

server render angular compile

08/03 2015

v0.3.3

0.3.3.0

PHP server side precompiler for AngularJS apps.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

by Mateusz Krzeszowiak

server render angular compile

08/03 2015

v0.3.2

0.3.2.0

PHP server side precompiler for AngularJS apps.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

by Mateusz Krzeszowiak

server render angular compile

08/03 2015

v0.3.1

0.3.1.0

PHP server side precompiler for AngularJS apps.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

by Mateusz Krzeszowiak

server render angular compile

08/03 2015

v0.3.0

0.3.0.0

PHP server side precompiler for AngularJS apps.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

by Mateusz Krzeszowiak

server render angular compile

05/03 2015

v0.2.1

0.2.1.0

PHP server side precompiler for AngularJS apps.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

by Mateusz Krzeszowiak

server render angular compile

05/03 2015

v0.2.0

0.2.0.0

PHP server side pre-renderer for AngularJS apps.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

by Mateusz Krzeszowiak

server render angular

02/03 2015

v0.1.0

0.1.0.0

PHP server side pre-renderer for AngularJS apps.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

by Mateusz Krzeszowiak

server render angular