Skip to content

geezer-workshop/ephp

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ePHP

Copyright (c) 2013-2014 Altenwald Solutions, S.L.

Authors: "Manuel Rubio" (manuel@altenwald.com).

Build Status Coverage Status

PHP Interpreter pure 100% Erlang. This interpreter was made for enhance and give flexibility to projects that requires an interface for plugins or addons without new compilations.

In the same way, you can use for server PHP pages in an easy way.

The port is not 100% complete, please refer to compatibility table.

A simple way to use, is include in your project rebar.config the following dependency line:

    {ephp, ".*", {git, "git://github.com/altenwald/ephp.git", master}}

And use the following code in your project:

{ok, Ctx} = ephp:context_new(),
PHP = "<? $a = 5 * 23; ?>Result for $a = <?=$a?>",
{ok, Text} = ephp:eval(Ctx, PHP).

The result stored in Text should be:

Result for $a = 115

PHP has a lot of built-in libraries. This interpreter has a little implementation of them. You can see the functions in the compatibility table.

You can add your own functions specifying the PHP name, and the module and function, as follow:

ephp_context:register_func(Ctx, <<"time">>, ephp_func_date, time).

Modules

ephp
ephp_const
ephp_context
ephp_func
ephp_func_array
ephp_func_control
ephp_func_date
ephp_func_misc
ephp_func_ob
ephp_func_string
ephp_func_vars
ephp_include
ephp_interpr
ephp_output
ephp_parser
ephp_util
ephp_vars

About

PHP Interpreter in pure Erlang

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Erlang 93.4%
  • PHP 6.3%
  • Makefile 0.3%