Download the PHP package jturbide/vhost without Composer

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

Vhost Generator CLI

A command-line tool built with Symfony Console that automatically generates Apache and Nginx virtual host configurations from YAML definitions, updates system hosts files, restarts web servers, and manages PHP caches (OPCache, APCu, sessions). Supports both Linux and Windows environments.


Features


Requirements


Installation

  1. Clone or download this repository.
  2. Run 'composer install'.
  3. Ensure 'bin/vhost.php' is executable (chmod +x if on Linux).
  4. Make sure 'config.yaml' and 'sites.yaml' exist in the root directory.

Configuration Files

config.yaml

Defines per-platform (Linux, Windows) settings, including main config files, vhost directories, service names, default SSL certs, optional global config snippets, and your templates.

Example minimal structure:


sites.yaml

Lists all the domains to configure, their document root paths, any aliases, custom SSL certs, and optional 'custom' snippet.

Example structure:


Usage

Run the command from your project root:

CLI Options

--force, -f
Overwrite any existing files (site vhosts, global snippets, main config blocks).

--no-backup
Disable creating .bak-YYYYmmddHHMMSS copies before overwriting.

--os=VALUE
Override OS detection with 'linux' or 'windows'. Defaults to PHP_OS_FAMILY.

--restart, -r
Restart Apache/Nginx after config generation.

--restart-php
Restart discovered PHP-FPM services on Linux.

--clear-opcache
Clear OPCache on all discovered PHP versions (Remi-based).

--clear-apcu
Clear APCu on all discovered PHP versions (Remi-based).

--clear-sessions
Remove session files based on each version’s session.save_path.

Examples

1) Basic generation (no backups, no restarts):

2) Force overwrite and restart services:

3) Clear all caches (OPCache, APCu, sessions):

4) Manually set OS:


How It Works

Global Snippet Injection

Reads your config.yaml for each server (apache or nginx). Places your globalSnippet text into a file named global-apache.conf or global-nginx.conf located in the same directory as confFile. Then injects an Include or include line into your main config, marked by # BEGIN AUTOGENERATED-apache or # BEGIN AUTOGENERATED-nginx.

Site Vhost Generation

For each site in sites.yaml:

Hosts File Updates

Appends domain entries to your system hosts file in a block marked # BEGIN WEB.LOCAL / # END WEB.LOCAL. Respects backups if needed. Uses the IP from servers.localhost in config.yaml by default, or a custom ip in sites.yaml if present.

Service Restarts

If --restart is specified:

If --restart-php is used, it restarts any discovered 'php.*fpm' services on Linux.

PHP Cache Clearing

If --clear-opcache or --clear-apcu, the script runs php -r ... in each discovered /opt/remi/phpXX version to reset OPCache or APCu. If --clear-sessions, removes session files in each version’s session.save_path (parsed from php.ini). This feature is Linux-specific by default.


Advanced Topics

Overwriting and Backups

Directory Checks

Customization


Installing Apache Lounge on Windows and Setting Up the Service

Step-by-Step Guide

  1. Download Apache from Apache Lounge

    • Visit Apache Lounge and download the appropriate version of Apache for your system (e.g., 64-bit or 32-bit).
  2. Extract Apache Files

    • Extract the downloaded .zip file to a desired location (e.g., C:\httpd\).
  3. Configure Apache

    • Open the httpd.conf file located in the conf directory of the extracted files (e.g., C:\httpd\conf\httpd.conf).
    • Modify the following lines to suit your environment:

      • Update the ServerRoot to the extracted path, e.g.:

      • Update the DocumentRoot to your desired root directory, e.g.:

      • Ensure you have configured your virtual host settings correctly (refer to the relevant sections in this document).
  4. Install the Service

    • Open a Command Prompt with Administrator privileges.
    • Navigate to the bin directory of the extracted Apache folder, e.g.:

    • Run the following command to install Apache as a Windows service:
  5. Verify Installation

    • After running the command, Apache is registered as a Windows service.
    • Open the Windows Services Manager (press Win + R, type services.msc, and hit Enter).
    • Look for the service named Apache2.4 (or the name defined in your Apache setup).
    • Confirm that the service appears as "Automatic" in the Startup Type column.
  6. Start the Service

    • You can start Apache in any of the following ways:

      • Run the command in the bin directory:

      • Or, start the service from the Windows Services Manager by right-clicking on Apache2.4 and selecting " Start."
  7. Test Your Setup
    • Open a web browser and navigate to http://localhost.
    • If everything is configured correctly, you should see the Apache default page or your defined DocumentRoot content.

Uninstalling the Apache Service

This should properly unregister Apache as a Windows service.


License

This sample project is provided as is, under no specific license unless you add one. Feel free to incorporate it into your private or commercial workflow.

For any questions or suggestions, please open an issue or contact the maintainer.


Enjoy automating your virtual host configurations across Linux and Windows!


All versions of vhost with dependencies

PHP Build Version
Package Version
Requires symfony/console Version ^7.0
symfony/yaml Version ^7.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 jturbide/vhost contains the following files

Loading the files please wait ....