Download the PHP package klitsche/clang-ffi without Composer

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

clang-ffi

Build Build macOS

Test Coverage Maintainability Packagist

A library for PHP exposing libclang via FFI.

It allows easy traversing and analyzing of an abstract syntax tree of a c / c++ file.

Unfortunately PHP FFI does not currently support Struct By Value as parameter or return value in function calls. That is why a c based wrapper is provided for libclang itself, which can then be bound via FFI. This wrapper must be compiled before use.

The wrapper is taken from dart ffigen and has been slightly extended.

Expect breaking changes along all 0.* pre-releases.

Requirements

Quick Start

Install llvm with clang ...

... on macOS (see https://formulae.brew.sh/formula/llvm)

brew install llvm@11

... on Debian / Ubuntu (see https://apt.llvm.org/)

apt-get update; \
apt-get install wget lsb-release software-properties-common ca-certificates gnupg; \
wget -q https://apt.llvm.org/llvm.sh; \
chmod +x llvm.sh; \
sudo ./llvm.sh 11; \
apt-get install libclang-11-dev;

Install in your project

composer require klitsche/clang-ffi

Add to composer.json (this will trigger compilation of wrapped libclang library)

Dump autoload to trigger compilation

composer dump-autoload

Run examples

Checkout & prepare

git clone https://github.com/klitsche/clang-ffi.git; \
cd clang-ffi; \
docker-compose build;

Print parsed file

docker-compose run --rm php74 php examples/print.php

Collect and dump simplified AST nodes as json

docker-compose run --rm php74 php examples/json.php

Dump found issues during parsing

docker-compose run --rm php74 php examples/issues.php

Todos

License

See LICENSE.md for details.

LICENSE.wrapper.c.md covers file src/FFI/libclang/wrapper.c.


All versions of clang-ffi with dependencies

PHP Build Version
Package Version
Requires php Version ^7.4 || ^8.0
ext-ffi Version *
symfony/polyfill-php80 Version ^1.20
symfony/process Version ^4.4 || ^5.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 klitsche/clang-ffi contains the following files

Loading the files please wait ....