Download the PHP package chkt/ash without Composer

On this page you can find all versions of the php package chkt/ash. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package ash

ash

A basic expression solver

Ash is an expression solver using basic arithmetic expressions in a sandboxed environment. It is meant to offer a convenient way to programmatically access properties in hierarchical data.

Install

Composer

Ash is available through composer.

Command line
composer.json

Manual installation

Alternatively you can clone the github repository into a location of your liking. Afterwards you will have to register the PSR-4 namespace ash within php yourself.

Ash depends on chkt/eve. When cloning manually you will have to ensure that package is also available and it's PSR-4 namespace is registered yourself.

Creating a solver

The parserFactory requires an instance of \eve\common\factory\IBaseFactory. You can use the bundled factory or implement your own.

Parsing the expression a + b will return the solver object for this expression.

The solver will resolve this expression for any data provided to it's ->resolve() method.

Supported syntax

The expression syntax broadly follows c-style syntax conventions, with strong nods to the functional paradigm of javascript.

Ash is not meant to be comprehensive and is therefore deliberately limited to evaluating expressions. There are no statements, no assignments, no way to define functions or compose data, and no way to mutate any data within its scope through the syntax.

Everything accessible within the solver's scope needs to be provided by the host program, making it impossible to access any part of the host system within an expression when that access has not been deliberately provided.

Scalar values

Currently supported are floating point numbers in basic 1.0 and exponent notation 1.0e-1, integers in basic 1, binary 0b1 and hexadecimal 0x1 notation and basic strings 'foo',"foo".

Any number starting with 0x or 0b will be treated as an integer, any other number containing a dot 0.0 will be treated as a float. All remaining numbers will be treated as integers.

Strings can be delimited with the quotation " and apostrophe ' characters and the delimiter can be escaped with the backslash \ character.

Support for booleans, nan, +/-infinity and typecasting is planned.

Arithmetic operations

Currently ash supports arithmetic expressions for addition a + b, substraction a - b, multiplication a * b, division a / b and modulo a % b as well as bracketed expressions a * (b + c).

All arithmetic operations will convert boolean arguments to the integer values 0 and 1. Integers will be cast to float if at least one operand is a floating point number. Divisions by zero 1 / 0 will return INF and -INF respectively, modulo zero 1 % 0 will return NAN irrespective of input types.

Support for comparisons, prefix + and -, typeof, the exponentiation operator and logic operations is planned.

Property accesses

Property accesses are done using the . operator for static access foo.bar, and square brackets for computed access foo[bar].

Static and computed accesses can be freely mixed foo[bar].baz[qux][qux] and computed accesses can resolve to either integers foo[ 1 ] or strings foo[ 'bar' ].

Calls

Anything that resolves to a callable within php can be called through the solver using the round brackets foo().

Arguments are separated by commas foo(bar, baz).

Nested foo(bar(), baz()) and chained calls foo()() are allowed. The return values of calls can be freely used in any subsequent operation foo().bar + baz().


All versions of ash with dependencies

PHP Build Version
Package Version
Requires php Version ^7.0
chkt/eve Version 1.0.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package chkt/ash contains the following files

Loading the files please wait ....