Giter VIP home page Giter VIP logo

php-ext-yazstd's Introduction

yazstd

Yet Another zstd is a small PHP extension to support zStandard chunks streaming compression/decompression it was created to give zStandard support for NSP Indexer but can be used also for other purposes

How To Install

% git clone --recursive --depth=1 https://github.com/proconsule/php-ext-yazstd
% phpize
% ./configure
% make
% make install

How To Use

Compression

$compressionLevel = 15;
$yazstd = new yazstd_compress(compressionLevel);
$compressedChunk = $yazstd->decompress($rawChunk); //with all chunks you have
$compressedChunk = $yazstd->endstream(); //at the end of streaming data (may be 0 if no data remain to flush)

Decompression

$yazstd = new yazstd_decompress();
$decompressedChunk = $yazstd->decompress($compressedChunk);

You can feed a streaming of data (tested on very very big files) with any chunksize, it returns zero len string if need more data for decompression.

This extension is in a very early stage so expect any kind of problems!

php-ext-yazstd's People

Contributors

proconsule avatar

Watchers

 avatar

Forkers

btc08gh izenn

php-ext-yazstd's Issues

unable to compile against php8

compile errors out when building against php8

nsp:/tmp/build/php-ext-yazstd$ make
/bin/sh /tmp/build/php-ext-yazstd/libtool --mode=compile cc -I. -I/tmp/build/php-ext-yazstd -I/tmp/build/php-ext-yazstd/include -I/tmp/build/php-ext-yazstd/main -I/tmp/build/php-ext-yazstd -I/usr/include/php8 -I/usr/include/php8/main -I/usr/include/php8/TSRM -I/usr/include/php8/Zend -I/usr/include/php8/ext -I/usr/include/php8/ext/date/lib -I/tmp/build/php-ext-yazstd/zstd/lib/common -I/tmp/build/php-ext-yazstd/zstd/lib  -DHAVE_CONFIG_H  -g -O2    -c /tmp/build/php-ext-yazstd/yazstd.c -o yazstd.lo 
mkdir .libs
 cc -I. -I/tmp/build/php-ext-yazstd -I/tmp/build/php-ext-yazstd/include -I/tmp/build/php-ext-yazstd/main -I/tmp/build/php-ext-yazstd -I/usr/include/php8 -I/usr/include/php8/main -I/usr/include/php8/TSRM -I/usr/include/php8/Zend -I/usr/include/php8/ext -I/usr/include/php8/ext/date/lib -I/tmp/build/php-ext-yazstd/zstd/lib/common -I/tmp/build/php-ext-yazstd/zstd/lib -DHAVE_CONFIG_H -g -O2 -c /tmp/build/php-ext-yazstd/yazstd.c  -fPIC -DPIC -o .libs/yazstd.o
/tmp/build/php-ext-yazstd/yazstd.c:69:64: error: expected ';', ',' or ')' before 'TSRMLS_DC'
   69 | static void yazstd_decompress_free_storage(zend_object *object TSRMLS_DC)
      |                                                                ^~~~~~~~~
/tmp/build/php-ext-yazstd/yazstd.c:76:62: error: expected ';', ',' or ')' before 'TSRMLS_DC'
   76 | static void yazstd_compress_free_storage(zend_object *object TSRMLS_DC)
      |                                                              ^~~~~~~~~
/tmp/build/php-ext-yazstd/yazstd.c: In function 'zim_yazstd_compress_compress':
/tmp/build/php-ext-yazstd/yazstd.c:172:44: error: expected ')' before 'TSRMLS_CC'
  172 |  if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC,
      |                                            ^~~~~~~~~
/tmp/build/php-ext-yazstd/yazstd.c:172:6: error: too few arguments to function 'zend_parse_parameters'
  172 |  if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC,
      |      ^~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/php8/main/php.h:35,
                 from /tmp/build/php-ext-yazstd/yazstd.c:7:
/usr/include/php8/Zend/zend_API.h:304:22: note: declared here
  304 | ZEND_API zend_result zend_parse_parameters(uint32_t num_args, const char *type_spec, ...);
      |                      ^~~~~~~~~~~~~~~~~~~~~
/tmp/build/php-ext-yazstd/yazstd.c: In function 'zim_yazstd_decompress_decompress':
/tmp/build/php-ext-yazstd/yazstd.c:219:44: error: expected ')' before 'TSRMLS_CC'
  219 |  if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC,
      |                                            ^~~~~~~~~
/tmp/build/php-ext-yazstd/yazstd.c:219:6: error: too few arguments to function 'zend_parse_parameters'
  219 |  if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC,
      |      ^~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/php8/main/php.h:35,
                 from /tmp/build/php-ext-yazstd/yazstd.c:7:
/usr/include/php8/Zend/zend_API.h:304:22: note: declared here
  304 | ZEND_API zend_result zend_parse_parameters(uint32_t num_args, const char *type_spec, ...);
      |                      ^~~~~~~~~~~~~~~~~~~~~
/tmp/build/php-ext-yazstd/yazstd.c: In function 'zm_startup_yazstd':
/tmp/build/php-ext-yazstd/yazstd.c:282:68: error: expected ')' before 'TSRMLS_CC'
  282 |  yazstd_decompress_ce = zend_register_internal_class(&decompress_ce TSRMLS_CC);
      |                                                                    ^~~~~~~~~~
      |                                                                    )
/tmp/build/php-ext-yazstd/yazstd.c:287:47: error: 'yazstd_decompress_free_storage' undeclared (first use in this function); did you mean 'yazstd_decompress_method'?
  287 |  yazstd_decompress_object_handlers.free_obj = yazstd_decompress_free_storage;
      |                                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                               yazstd_decompress_method
/tmp/build/php-ext-yazstd/yazstd.c:287:47: note: each undeclared identifier is reported only once for each function it appears in
/tmp/build/php-ext-yazstd/yazstd.c:291:64: error: expected ')' before 'TSRMLS_CC'
  291 |  yazstd_compress_ce = zend_register_internal_class(&compress_ce TSRMLS_CC);
      |                                                                ^~~~~~~~~~
      |                                                                )
/tmp/build/php-ext-yazstd/yazstd.c:296:45: error: 'yazstd_compress_free_storage' undeclared (first use in this function); did you mean 'yazstd_compress_method'?
  296 |  yazstd_compress_object_handlers.free_obj = yazstd_compress_free_storage;
      |                                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                             yazstd_compress_method
make: *** [Makefile:209: yazstd.lo] Error 1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.