Download the PHP package hershel-theodore-layton/expr-dump without Composer

On this page you can find all versions of the php package hershel-theodore-layton/expr-dump. 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 expr-dump

expr-dump

Dump runtime values to typed Hack source code.

Why do you need this?

Run code during build-time, codegen the values you were interested in back to Hack code, write it to a Hack source file, and you have build-time compute.

The following snippet[^1] embodies the essence of this library perfectly.

All data that enters your program at runtime is typed as mixed, which is why you must cast it to a typed value in order to process it. If you do this safely, this incurs runtime costs. Doing it using an unsafe mechanism, such as HH\FIXME\UNSAFE_CAST or HH_FIXME[4110] is trading correctness for performance. But with burn_a_value_to_constant, the data doesn't enter the program at runtime. This data is already typed, so there is no need for casting.

Why the existing tools can not meet this need

In Hack, the same runtime value can represent two different types.

HHVM is unable to distinguish between these types, but Hack is, and will emit errors if you initialize a value with the wrong type, even if the runtime value would be exactly the same as the correct initializer.

const (int, int) A_TUPLE = vec[1, 2]; // type error

ExprDump\dump<reify T>(T $value): string takes a type and a value. This gives it enough information to represent shapes as shapes, tuples as tuples, enums as enums, whilst not confusing them for dicts, vecs, and arraykeys.

Usage

Note about the stability of this api

This library depends on HTL\TypeVisitor to provide its functionality. TypeVisitor depends on unstable Hack apis, TypeStructure<T> and \HH\ReifiedGenerics\get_type_structure<T>(). For more details, see stability. This api has been unstable since 2016, so take this with a grain of salt.

In order to minimize the potential impact of a removal of these apis, you should not use this library in places where the performance of bootstrapping the dumper is critical. A far less performant variant of TypeVisitor could be written, even without these api affordances.

[^1]: This snippet burn_a_value_to_constant is excempt from the MIT license of this library. It is licensed to you under MIT-0 (MIT No Attribution). This excemption does not apply to the code called by this snippet. The MIT license still covers all other parts of this program.


All versions of expr-dump with dependencies

PHP Build Version
Package Version
Requires hhvm Version ^4.102
hershel-theodore-layton/type-visitor Version ^1
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 hershel-theodore-layton/expr-dump contains the following files

Loading the files please wait ....