Download the PHP package hamdallah90/laravel-typephp without Composer

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

laravel-typephp

Compile the hot paths of a Laravel application to native code with TypePHP, the AOT PHP-to-C++ compiler from the Swoole team, and load the result as a PHP extension. When the extension is not loaded, the very same files run in the interpreter through Composer's autoloader, so nothing breaks in development, CI, or on a host without the toolchain.

Measured on PHP 8.4, fib(32) inside a Laravel 13 app:

runtime time
interpreter 0.215 s
interpreter + opcache JIT 0.089 s
TypePHP -O3 + use native_types; 0.006 s

What this is not

TypePHP compiles a strict, statically typed subset of PHP. It does not support reflection tricks, Closure::bind, variable variables, top-level statements, or most of the dynamic behaviour Laravel's container, Eloquent and facades rely on. This package therefore does not compile the framework or your whole app/. It compiles the code you put in app/Native (or wherever config/typephp.php points): pure computation, parsers, encoders, pricing engines, matrix math, hashing and similar CPU-bound classes that take and return scalars, arrays and plain objects.

Requirements

Install

Build phpx (the C++ runtime the generated code links against). It must match the PHP that will load the extension:

On Linux also install it so the dynamic linker finds libphpx.so (the extension carries no rpath there):

On macOS with Homebrew: brew install php cmake gmp mpfr, pass -Dphp_dir=/opt/homebrew/opt/php to the first cmake call, and skip the install step (the extension gets an rpath to vendor/swoole/phpx/lib).

Use

Load the extension in every SAPI that should use it (CLI, FPM, Octane workers):

or ad hoc: php -d extension=$PWD/storage/typephp/app_native.so artisan typephp:status.

Then just call your classes. No wrapper, no FFI:

LaravelTypePHP\TypePHP::loaded() and TypePHP::isNative(Fib::class) tell you at runtime which path you are on.

Writing native classes

Configuration (config/typephp.php)

key default notes
name app_native artifact <name>.so, Zend module typephp_<name>
sources [app/Native] files or directories
ignore [] paths excluded from sources
output_dir storage/typephp where the .so and project.yml land
build_dir storage/typephp/build generated C++ and object cache
optimize 3 -O level, env TYPEPHP_OPTIMIZE
php_version 8.4 syntax level accepted by tpc
jobs 4 parallel C++ jobs
ext_deps [] PHP extensions the native code needs
link_libs [] extra -l libraries
tpc auto vendor/bin/tpc.php, then tpc on PATH, env TYPEPHP_TPC
php the PHP running artisan PHP 8.4+ used to run tpc.php, env TYPEPHP_PHP

typephp:compile accepts --optimize=N, --debug, --force, --dry.

Deploying

The .so is tied to the PHP version and platform it was compiled for and needs libphpx.so at runtime. Build on the target platform, or in Docker with the shipped builder image, then copy both libraries to the server (libphpx.so into /usr/local/lib followed by ldconfig):

The runtime host needs libgmp and libmpfr (apt-get install libgmp10 libmpfr6).

Do not put app/Native in an opcache preload script: preloading requires the files, which redeclares the classes the extension already registered.

Tests

License

MIT. TypePHP itself is GPL-3.0; it is a build-time tool here and is not bundled.


All versions of laravel-typephp with dependencies

PHP Build Version
Package Version
Requires php Version ^8.4
illuminate/console Version ^11.0 || ^12.0 || ^13.0
illuminate/support Version ^11.0 || ^12.0 || ^13.0
symfony/process Version ^7.0 || ^8.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 hamdallah90/laravel-typephp contains the following files

Loading the files please wait ...