bfinder / version-updater
A robust, 1-click version updater package for Laravel applications by BugFinder.
Requires
- php: ^8.1
- illuminate/console: ^9.0|^10.0|^11.0
- illuminate/filesystem: ^9.0|^10.0|^11.0
- illuminate/http: ^9.0|^10.0|^11.0
- illuminate/routing: ^9.0|^10.0|^11.0
- illuminate/support: ^9.0|^10.0|^11.0
Requires (Dev)
None
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
A robust, secure 1-click version updater package for Laravel products (developed by BugFinder). It provides a Web UI dashboard and CLI command to update Laravel CodeCanyon products effortlessly.
Features
- ⚙️ Pre-flight Environment Audit: Verifies PHP version, required extensions, folder write permissions, and disk space.
- 🔒 Envato License & Purchase Code Check: Integrates with BugFinder's central update server.
- 💾 Automated 1-Click Backups: Creates zip backup of application files and exports MySQL database tables (
.sql) before applying updates. - 🛡️ Zip Extraction with File Preservation: Safely extracts updated files while skipping protected configuration & upload folders (
.env,storage/,public/uploads/, etc.). - 🚀 Database & Cache Automation: Runs database migrations (
php artisan migrate --force), updates.envversion, and clears Laravel caches automatically. - 💻 Interactive Web UI & CLI Support: Features an AJAX-driven 1-click update dashboard (
/admin/updater) as well as an Artisan terminal command (php artisan bugfinder:update).
Installation Guide
Option 1: Via Composer (Local Repository or Packagist)
Add the package to your main product's composer.json or install via Packagist:
composer require bfinder/version-updater
Or for local development:
"repositories": [ { "type": "path", "url": "../bugfinder-version-updater" } ], "require": { "bfinder/version-updater": "*" }
Then run:
composer update bfinder/version-updater
Option 2: Publish Config & Views
php artisan vendor:publish --tag=bugfinder-updater-config php artisan vendor:publish --tag=bugfinder-updater-views
Configuration (config/updater.php)
Set your product details in .env:
BUGFINDER_PRODUCT_ID=BF-SCR-01 BUGFINDER_PRODUCT_NAME="BugFinder SaaS Application" APP_VERSION=1.0.0 BUGFINDER_UPDATE_SERVER_URL=https://update.bugfinder.net/api/v1 BUGFINDER_PURCHASE_CODE=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
Usage
1. Web Interface
Navigate to your application admin dashboard at:
https://yourdomain.com/admin/updater
Features:
- Check PHP & Extension Requirements
- Enter Envato Purchase Code to query available updates
- Trigger 1-Click Update with real-time AJAX progress status
2. Command Line (CLI)
Run the updater from the terminal:
php artisan bugfinder:update
Options:
--code=YOUR_PURCHASE_CODE: Pass purchase code explicitly--skip-backup: Skip file and database backup phase
Code Architecture
src/
├── BugFinderUpdaterServiceProvider.php # Main Service Provider
├── UpdaterManager.php # Central Manager class
├── Facades/
│ └── Updater.php # Facade accessor
├── Services/
│ ├── EnvironmentCheckService.php # Server requirements auditor
│ ├── ServerCheckService.php # Remote update server communicator
│ ├── BackupService.php # Zip file & SQL database backup engine
│ ├── ExtractorService.php # Zip extractor preserving user files
│ └── MigrationRunnerService.php # Artisan migrations & cache operations
├── Http/
│ └── Controllers/
│ └── UpdaterController.php # Web UI & AJAX controller
└── Console/
└── UpdateCommand.php # CLI command implementation
Handling File & Folder Deletions in Updates
Since the Zip Extractor performs incremental file overwrites (preserving untouched client files), deleting files from your development codebase and zipping the update package will not automatically delete those files on the client's server.
To safely remove deprecated files or folders in a new version release, include a Laravel Migration in your product's update package:
Migration Example (database/migrations/xxxx_xx_xx_xxxxxx_cleanup_deprecated_files.php)
<?php use Illuminate\Database\Migrations\Migration; use Illuminate\Support\Facades\File; return new class extends Migration { /** * Delete deprecated files and folders during product update. */ public function up(): void { // 1. Delete an entire directory (and all its contents) $folderPath = resource_path('views/old_components'); if (File::isDirectory($folderPath)) { File::deleteDirectory($folderPath); } // 2. Delete a single deprecated file $filePath = app_path('Http/Controllers/OldController.php'); if (File::exists($filePath)) { File::delete($filePath); } } public function down(): void { // Optional rollback logic } };
How it works: The updater automatically executes
php artisan migrate --forceimmediately after extracting the zip package. This migration will execute once on the client's server and clean up any specified files or directories cleanly.
Security Guidelines
- Zip Slip Prevention: The extractor rejects paths with
../or..\. - Protected File Blacklist: Configurable in
config/updater.phpunderprotected_files. - Maintenance Mode: Automatically enables maintenance mode (
php artisan down) during extraction and migration, restoring it afterwards (php artisan up).
License
Created by BugFinder. Free to use in BugFinder CodeCanyon products.