Download the PHP package mfonte/hte-cli without Composer

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

Ubuntu/Debian compatible LAMP Test Environment Creator CLI Tool

Heads Up! This utility perfectly couples with the https://github.com/mauriziofonte/win11-wsl2-ubuntu22-setup WSL2 setup, for a complete LAMP stack on Windows 11.

However, this utility can be used in any LAMP stack on Debian or Ubuntu , with Multi PHP-FPM support.

Ah, one more thing: checking a perfect companion for HTE-Cli? Check out the Gash Bash, another creation of mine :)


Screenshot of hte-cli create Screenshot of hte-cli remove Screenshot of hte-cli details


What is this utility for?

HTE stands for Homelab Test Environment.

It eases the process of creating Test Environments on both Local or Staging environments, when using Apache on a multi PHP-FPM flavour.

Basically, this utility takes care of :

  1. Creating a new VirtualHost for your.local.domain.tld
  2. Configuring the VirtualHost to work via php-fpm on the PHP version of User's Choice
  3. Enabling http/2 protocol and brotli compression
  4. Configuring the PHP fpm pool by adding a new specific configuration file for your.local.domain.tld, with security profiles (dev/staging/hardened)
  5. Automatically managing /etc/hosts entries for your local domains
  6. Providing configurable PHP-FPM security profiles for different use cases

Security

This tool is not intended to be used on internet-facing LAMP environments. It's intended to be used on local devices, or any other Cloud VM that is properly firewalled.

This is because this tool configures Apache and PHP with presets that are good only for local developing, testing and benchmarking.

For more informations, refer to LAMP Stack Hardening and Linux Security Bookmarks.

Installation

The easiest way to get started with Hte-Cli is to download the Phar files for each of the commands:

Global Composer Package

If you use Composer, you can install Hte-Cli system-wide with the following command:

Make sure you have the composer bin dir in your PATH.

The default value should be ~/.composer/vendor/bin/, but you can check the value that you need to use by running composer global config bin-dir --absolute

The HTE-Cli Tool will then be available on $(composer config -g home)/vendor/bin/hte-cli

It is suggested to modify your bash profile to expand your $PATH so that it includes the composer/vendor/bin directory. To do so, you can modify your .bashrc file by executing:

Composer Dependency

Alternatively, include a dependency for mfonte/hte-cli in your composer.json file on a specific project. For example:

You will then be able to run Hte-Cli from the vendor bin directory:

You can then create some Bash Aliases for your convenience:

Git Clone

You can also download the Hte-Cli source, and run your own hte-cli build:

Build setup is made possible via humbug/box. See Laravel Zero Doc for the internals of building a Laravel Zero app.

Environment Pre-requisites

As said before, this utility is intended to be used on Debian or Ubuntu , with Multi PHP-FPM support.

This means that you must have a LAMP stack compatible with multiple PHP versions and configured to use PHP-FPM by default. You can achieve this by following the instructions below:

The important things are:

  1. disable mpm_prefork module
  2. disable all php** handler modules
  3. enable all php**-fpm handler modules
  4. enable fcgid, mpm_event, proxy_fcgi, alias modules (and, obviously, ssl and rewrite) - http2, brotli, headers, setenvif are optional, but suggested.

Usage

Create a new test LAMP Env

To create a new LAMP local testing/developing VirtualHost, run the HTE-Cli tool with option create.

In this example, the HTE-Cli create has been aliased with the hte-create command.

Command Line Options for Create

You can also run the create command non-interactively:

Modify an existing VirtualHost

To modify an existing VirtualHost configuration, use the modify command. This command provides an interactive menu to change any aspect of your VirtualHost.

Command Line Options for Modify

You can also run modify non-interactively:

Delete a Test Env created via HTE-Cli

To remove a LAMP local testing/developing VirtualHost previously created with HTE-Cli Tool, run the HTE-Cli tool with option remove.

The remove command now features an interactive selection menu and automatic index normalization.

Command Line Options for Remove

List all Test Envs created via HTE-Cli

To list all LAMP local environments previously created with HTE-Cli Tool, run the HTE-Cli tool with option details.

Fix old VirtualHost configurations

If you have VirtualHosts created with an older version of HTE-CLI, they may not have the localhost HTTPS bypass feature. The fix command updates these configurations.

Command Line Options for Fix

Manage /etc/hosts

The hosts command helps you manage /etc/hosts entries for domains created by HTE-CLI:

Example output for hosts list:

Example output for hosts sync:

PHP-FPM Security Profiles

HTE-CLI supports three security profiles for PHP-FPM pools, allowing you to balance between development convenience and security:

Profile Description Use Case
dev Minimal restrictions, high memory limits (1024M), basic disabled functions Local development
staging Moderate security with open_basedir, session hardening, pm.max_requests Staging/testing environments
hardened Maximum restrictions, many functions disabled Security testing only

Profile Details

Dev Profile (Default)

Staging Profile

Hardened Profile

Warning: The hardened profile disables exec, proc_open, and other functions used by Artisan, Composer, and PHPUnit. Use it only for security testing purposes.

Usage

Command Reference

Available Commands

Command Description
create Create a new VirtualHost with PHP-FPM
modify Modify an existing VirtualHost configuration
remove Delete a VirtualHost and all its configurations
details List all VirtualHosts with detailed information
hosts Manage /etc/hosts entries
fix Fix old VirtualHost configs to add localhost HTTPS bypass

Command Options

create

Option Description Default
--domain= Domain name for the VirtualHost (interactive)
--docroot= Document root path (interactive)
--phpver= PHP version (e.g., 8.4, 8.3, 7.4) Latest installed
--ssl= Enable SSL (yes/no) yes
--forcessl= Force HTTPS redirect (yes/no) yes
--hosts= Add to /etc/hosts (yes/no) yes
--profile= PHP-FPM profile (dev/staging/hardened) dev

modify

Option Description
--domain= Domain name to modify
--phpver= New PHP version
--ssl= Enable/disable SSL (yes/no)
--forcessl= Enable/disable force HTTPS (yes/no)
--profile= New PHP-FPM profile
--docroot= New document root
--interactive Force interactive mode

remove

Option Description
--domain= Domain name to remove
--force Skip confirmation prompt
--no-normalize Skip index normalization

hosts

Subcommand Description
list Show domains in /etc/hosts managed by hte-cli
sync Sync /etc/hosts with configured VirtualHosts
add --domain= Add a domain to /etc/hosts
remove --domain= Remove a domain from /etc/hosts

fix

Option Description
--domain= Fix a specific domain only
--force Skip confirmation prompt
--dry-run Preview changes without applying them

Localhost HTTPS Bypass

When Force HTTPS is enabled, HTE-CLI configures Apache to allow HTTP access from localhost (127.0.0.1 and ::1). This means:

This is useful for local development tools, scripts, and API testing that don't handle SSL certificates well.

.htaccess Override Warning

If your document root contains an .htaccess file with its own HTTPS redirect rules, those will override the VirtualHost configuration. The fix command automatically detects this situation and provides instructions to modify your .htaccess file.

Example .htaccess modification for localhost bypass:

Credits

A big thank you goes to Nuno Maduro and Owen Voke for their Laravel Zero micro-framework.

Contributing

See DEVELOPMENT.md for development setup, coding standards, and contribution guidelines.

License

MIT License - see LICENSE for details.


All versions of hte-cli with dependencies

PHP Build Version
Package Version
Requires php Version ^7.3|^8.0
php-school/cli-menu Version ^4.3.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 mfonte/hte-cli contains the following files

Loading the files please wait ...