1. Go to this page and download the library: Download luwes/wesc library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
luwes / wesc example snippets
// One-shot: returns an associative array with the HTML output plus the bundled
// assets. `html` is a binary-safe string; `css`/`js` are strings or null.
$result = wesc_build(['./index.html'], outcss: '', outjs: '', minify: true);
echo $result['html'];
file_put_contents('styles.css', $result['css'] ?? '');
file_put_contents('scripts.js', $result['js'] ?? '');
// `outcss`/`outjs` still write files: null skips the bundle, a non-empty path
// bundles *and* writes the file, and an empty string (above) returns the asset
// in memory only — without touching disk.
// Streaming: low memory, chunk by chunk. The callback receives each string
// chunk, then `null` once to signal end-of-stream.
wesc_build_stream(['./index.html'], function ($chunk) {
if ($chunk === null) {
// end of stream
} else {
echo $chunk;
flush();
}
});
sh
php -d extension=/abs/path/to/libwesc_php.dylib your-script.php
sh
cd crates/wesc-php
cargo php install --release # builds + installs into your PHP
cargo php stubs --stdout # prints PHP stub declarations for IDEs
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.