Download the PHP package mahesh-kerai/update-generator without Composer
On this page you can find all versions of the php package mahesh-kerai/update-generator. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download mahesh-kerai/update-generator
More information about mahesh-kerai/update-generator
Files in mahesh-kerai/update-generator
Package update-generator
Short Description Laravel Update and New Installation ZIP Generator
License MIT
Informations about the package update-generator
Update Generator
A robust Laravel package for generating update ZIP files and new installation packages based on Git repository changes.
Features
- π Git Integration: Automatically detects files changed between specified dates or commit ranges
- π» Modern Interactive CLI: Stunning, boxed UI with radio-style selections for a premium developer experience
- π¦ Multiple Package Types: Generate update packages, new installation packages, or both
- π‘οΈ Security: Safe Git command execution with proper validation
- π Environment Sanitization: Automatically sanitizes sensitive data in .env files for new installations
- π§Ή Cache Management: Automatic cache clearing before package generation
- π Logging: Comprehensive logging for debugging and monitoring
- βοΈ Configurable: Easy configuration for excluded paths and settings
- π― Type Safety: Full PHP 8.1+ type safety with strict typing
- π Custom File Inclusion: Explicitly include custom packages and essential files in updates
- ποΈ Smart Exclusions: Wildcard patterns for excluding directory contents while preserving structure
- π Commit-Based Support: Generate updates based on specific Git SHAs (full/short)
Minimum Requirements
| Requirement | Version |
|---|---|
| PHP | 8.1+ |
| Laravel | 9.x+ |
| Git | 2.0+ |
Installation
1. Install the package
System Requirements
- PHP: 8.1 or higher
- Laravel: 9.0 or higher
- PHP Extensions:
zipextension (for creating ZIP archives)fileinfoextension (for file type detection)
- Operating Systems: Windows, Linux, macOS (cross-platform compatible)
Note: The package now uses PHP's built-in ZipArchive instead of external zip commands, making it fully compatible across all operating systems.
2. Publish configuration
This creates the configuration file at config/update-generator.php
3. Configure excluded paths and additional files
Edit config/update-generator.php to customize excluded paths and include additional files:
Usage
Modern Interactive CLI Workflow (Recommended)
The easiest way to generate packages is to use the interactive wizard, which features a modern, boxed UI inspired by Laravel's official tools. Simply run the command without any arguments:
The command will guide you through a structured, interactive process:
- Filtering Method: Select between
Date RangeorCommit Rangeusing arrow keys. - Instructional Notes: Contextual help will appear (e.g., format reminders).
- Conditional Inputs:
- Date Range Mode: Enter Start Date and End Date (
YYYY-MM-DD). - Commit Range Mode: Enter Starting Commit Reference and Ending Commit Reference (Strictly SHAs only).
- Date Range Mode: Enter Start Date and End Date (
- Current Version: Enter your system's current version (e.g.,
1.0.0). - Update Version: Enter the target update version (e.g.,
1.1.0). - Type Selection: Choose
both,update, ornewusing the interactive radio-style selection.
Once all inputs are provided, a Confirmation Summary will be displayed inside a structured box for your final approval.
Commit Range Mode Guidelines
When using Commit Range Mode, please note the following:
[!IMPORTANT] Supported References: Only Full Git SHAs and Short Git SHAs (e.g.,
a1b2c3d) are supported.Unsupported References: You cannot use full commit messages as references. Ensure the starting commit precedes the ending commit in the repository's history.
Inline Options (Backward Compatibility & Automation)
For automated systems or advanced users, you can pass parameters directly. Providing these options will automatically bypass the interactive prompts:
Date-Based Example:
Commit-Based Example:
Input Parameters Explanation
| Parameter | Format / Options | Description |
|---|---|---|
| Start Date | YYYY-MM-DD |
The beginning date to check Git history for modified or created files. |
| End Date | YYYY-MM-DD |
The ending date to check Git history. |
| Start Commit | Full/Short SHA | The starting commit SHA reference (Full or Short). Commit messages not allowed. |
| End Commit | Full/Short SHA | The ending commit SHA reference. Commit messages not allowed. |
| Current Version | e.g. 1.0.0 |
The current operational version of the project. Added to the generated version_info.php. |
| Update Version | e.g. 1.1.0 |
The target version after the update. |
| Type | both, update, new |
Defines the output. update extracts only changed files. new bundles the entire project. |
How It Works (Workflow)
- Git Diff Analysis: If generating an update package, the system runs local Git commands to identify exactly which files were modified, created, or deleted between the provided Date Range or Commit Range.
- File Filtering: Identified files are cross-referenced with your
exclude_updateandadd_update_fileconfiguration to ensure absolute correctness. - Packaging Update Files: All applicable files are replicated into a temporary environment and bundled into a
source_code.ziparchive. - Packaging New Installation: If requested, the system zips the entire project directory, cleanly bypassing paths marked in
exclude_new. Furthermore, sensitive values inside.envare automatically sanitized. - Versioning Details: A
version_info.phpis generated containing the input versions to assist the end-user upgrade systems.
Requirements & Prerequisites
Before running the command, ensure your environment is fully prepared:
- Git Context: Must be run from within an initialized Git repository.
- Project Setup: Ensure
composerdependencies are properly resolved and the application is structurally sound. - Correct File Permissions: Write permissions are required at the
output_directorypath (default:storage/app/update_files). - Dependencies: Standard PHP
zipextension (ext-zip) is required for compression, andgitCLI must be accessible in your system paths. - Valid Inputs: Dates must stringently match the
YYYY-MM-DDformat.
Output Structure
Depending on your selected Type, the following files and folders will be created inside the configured output directory (storage/app/update_files by default):
Update Package
Generates only changed and new files:
New Installation Package
Generates a full installation bundle with sanitized credentials:
Version Info File
Important Notes
- Seamless Backward Compatibility: Existing CI/CD scripts using inline parameters remain 100% operational. The new interactive wizard only activates for missing inputs.
- Intact Core Functionality: Only the command's input collection methodology was improved. File resolution, Git extraction, and ZIP compression logic remain fundamentally unchanged.
- Smart Validation: The interactive wizard validates date formats and version inputs iteratively, rejecting incorrect strings and asking again without crashing.
Configuration Options
| Option | Description | Default |
|---|---|---|
exclude_update |
Paths to exclude from update packages | See config |
add_update_file |
Files/folders to explicitly include in update packages | See config |
exclude_new |
Paths to exclude from new installation packages | See config |
output_directory |
Directory for generated packages | storage/app/update_files |
git_timeout |
Git command timeout in seconds | 300 |
enable_logging |
Enable logging for debugging | true |
clear_cache_before_generation |
Clear cache before generating packages | true |
sanitize_env_file |
Sanitize .env file for new installations | true |
env_sanitization_rules |
Rules for sanitizing environment variables | See config |
Additional Files Configuration
The add_update_file option allows you to explicitly include specific files or folders in your update packages, even if they're in excluded paths. This is particularly useful for:
- Custom vendor packages that need to be included in updates
- Essential configuration files like
vendor/autoload.php - Composer files required for proper package management
- Any specific files that should always be included
Example:
Environment File Sanitization
The package automatically sanitizes sensitive data in .env files when generating new installation packages. This ensures that:
- Sensitive credentials are removed or replaced with safe defaults
- API keys and passwords are cleared
- Database credentials are reset to default values
- A new APP_KEY is generated for each installation
- Mail settings are reset to safe defaults
Before Sanitization:
After Sanitization:
Wildcard Exclusion Patterns
Use wildcard patterns (*) to exclude directory contents while preserving the directory structure:
This ensures that:
- β Directory structure is preserved - Laravel can create files in these directories
- β Contents are excluded - No sensitive or temporary files are included
- β No runtime errors - Essential directories exist for the application to function
Cache Management
The package automatically clears various cache types before generating packages:
- Application cache (
storage/framework/cache) - View cache (
storage/framework/views) - Session files (
storage/framework/sessions) - Bootstrap cache (
bootstrap/cache) - Laravel Artisan caches (
cache:clear,view:clear,config:clear,route:clear)
This ensures that no cached data is included in your packages, keeping them clean and up-to-date.
Best Practices
- Version Naming: Use semantic versioning (e.g., 1.0.0, 1.1.0)
- Date Format: Always use YYYY-MM-DD format for dates
- Git Repository: Ensure you're in a Git repository before running commands
- Exclusions: Configure appropriate exclusions for your project
- Custom Files: Use
add_update_fileto include essential custom packages and dependencies - Testing: Test generated packages in a staging environment before production use
- Environment Security: Always enable
.envsanitization for production packages - Wildcard Patterns: Use wildcard patterns (
*) to exclude directory contents while preserving structure - Cache Clearing: Keep
clear_cache_before_generationenabled to ensure clean packages - Sanitization Rules: Customize
env_sanitization_rulesto match your application's needs
Recent Updates
π» Modern Interactive CLI UI
- Stunning Visuals: Completely redesigned interactive experience with boxed inputs and bordered containers.
- Radio-Style Selections: Select filtering methods and package types using keyboard arrow keys (β/β) for a seamless workflow.
- Instructional Hints: Built-in helper text and placeholders (e.g.,
e.g. 1.0.0) to guide users in real-time. - Inline Validation: Immediate, formatted error feedback without breaking the visual flow.
π Commit-Based Generation
- SHA Support: Ability to generate updates between two specific commit references.
- Support: Compatible with both Full SHAs and Short SHAs.
- Range Validation: Automatic validation to ensure the starting reference precedes the ending reference.
π Security Enhancements
- Environment File Sanitization: Automatically removes sensitive data from
.envfiles in new installation packages - Smart Exclusion Patterns: Wildcard patterns (
*) for excluding directory contents while preserving structure - Cache Management: Automatic cache clearing before package generation
π οΈ Technical Improvements
- ZIP Creation: Uses PHP's built-in ZipArchive for cross-platform compatibility (Windows, Linux, macOS)
- Infinite Loop Prevention: Fixed recursive copying issues in new installation generation
- File System Safety: Enhanced file copying with proper path validation and error handling
- Logging Enhancement: Improved logging with masked sensitive values for security
π¦ Package Generation
- Essential Files: Automatic inclusion of
vendor/autoload.php,vendor/composer, and custom packages - Directory Structure: Preserved essential Laravel directories (
storage/framework/sessions, etc.) - Clean Packages: No cached data or temporary files included in packages
βοΈ Configuration Options
sanitize_env_file: Enable/disable.envfile sanitizationenv_sanitization_rules: Customize which environment variables to sanitizeclear_cache_before_generation: Control automatic cache clearing- Wildcard Exclusions: Use
storage/logs/*patterns for smart exclusions
Troubleshooting
Common Issues
Q: Getting "Failed to create ZIP archive" error? A: This has been fixed by using PHP's built-in ZipArchive. Ensure the PHP zip extension is installed and enabled on your system.
Q: New installation packages missing essential directories?
A: Use wildcard patterns like storage/logs/* instead of storage/logs to preserve directory structure.
Q: Sensitive data in .env files?
A: Enable sanitize_env_file and configure env_sanitization_rules to automatically clean sensitive data.
Q: Package generation in infinite loop? A: This has been fixed by using system temp directory and proper path validation.
Q: Missing vendor files in new installations?
A: The package now automatically includes essential vendor files like vendor/autoload.php and vendor/composer.
License
This package is open-sourced software licensed under the MIT license.
π‘ Support
π¨βπ» Created by Mahesh Kerai β A passionate Laravel developer who loves building clean and scalable solutions.
π βHelping developers save time with automation and smarter workflows.β
π¬ For questions, feedback, or support:
- βοΈ Email: [email protected]
β¨ Made with β€οΈ, β, and a lot of Laravel magic by Mahesh Kerai.
Made with β€οΈ by Mahesh Kerai
All versions of update-generator with dependencies
illuminate/support Version ^9.0|^10.0|^11.0|^12.0|^13.0
illuminate/console Version ^9.0|^10.0|^11.0|^12.0|^13.0
illuminate/filesystem Version ^9.0|^10.0|^11.0|^12.0|^13.0
laravel/prompts Version ^0.1|^0.2|^0.3