Download the PHP package quasilyte/klua without Composer

On this page you can find all versions of the php package quasilyte/klua. 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 klua

KLua

KLua is a FFI-based Lua5 library that can be used in both PHP and KPHP.

Installation

Since this is a FFI library, it needs a dynamic library available during the run time.

Installation steps:

  1. Install liblua5 in your system (if you don't have it already)
  2. Locate the library file and place in under ./ffilibs/liblua5
  3. Install this composer package to use KLua classes inside your code

Depending on your system, you need to find liblua.so, liblua.dylib or liblua.dll file. Then you can copy it to the application root ffilibs folder under the liblua5 name (note: no extension suffixes).

If you're having difficulties locating the library file, use a helper script:

Then install the composer library itself:

Notes:

Examples

Running examples with PHP:

Running examples with KPHP:

Quick start

Running with PHP:

Running with KPHP:

Value conversion

PHP Type Lua Type Operation Cost
bool boolean free
int number free
float number free
string string string data is copied
map-like array table expensive conversion
list-like array sequence table expensive conversion

All conversions are symmetrical, except for the Lua->PHP case of sequence tables.

If KLuaConfig::pack_lua_tables is set to false, Lua tables will be returned "as is". If that option is set to true (the default), then KLua will try to return Lua sequence tables as list-like PHP arrays.

Not every PHP value can be converted to a Lua value and vice versa. Both languages should communicate to each other using the simpler protocols.

If some value can't be converted properly, a special error-like value is produced instead.

The light userdata is a special case. It can't be auto-converted from a PHP value, but there are KLua::setVarUserData and call builder API pushUserData functions to pass user data from PHP to Lua. When Lua->PHP conversion is performed, the user data address is stored as PHP int value. You can convert that int addr to the CData void* by using KLua::userDataPtr. See userdata.php for the complete example.

API reference

See api_reference.md for full documentation.

All KLua class methods are static.

KLua initialization methods:

KLua main methods:

KLua call builder methods:

KLua utility methods:


All versions of klua with dependencies

PHP Build Version
Package Version
Requires php Version >=7.4
vkcom/kphp-polyfills Version ^1.0
quasilyte/kfinalize Version ^1.0
vkcom/ktest-script Version ^0.7.4
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 quasilyte/klua contains the following files

Loading the files please wait ....