PHP code example of softmax / installer

1. Go to this page and download the library: Download softmax/installer 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/ */

    

softmax / installer example snippets


return [
    /*
    |--------------------------------------------------------------------------
    | API Configuration
    |--------------------------------------------------------------------------
    */
    'api_base' => env('SOFTMAX_API_BASE', 'https://api.soft-max.app'),
    'api_timeout' => env('SOFTMAX_API_TIMEOUT', 30),
    'product_code' => '12345',

    /*
    |--------------------------------------------------------------------------
    | Installation Configuration
    |--------------------------------------------------------------------------
    */
    'installation' => [
        'lock_file' => 'installed/installer.lock',
        'encryption_key_file' => 'installed/encryption_key',
        'license_file' => 'installed/license.json',
    ],

    /*
    |--------------------------------------------------------------------------
    | Requirements Configuration
    |--------------------------------------------------------------------------
    */
    '

use Softmax\Installer\Facades\Installer;

// Check if application is installed
if (Installer::isInstalled()) {
    // Application is installed
}

// Verify encryption key
if (Installer::verifyEncryptionKey()) {
    // Key is valid
}

// Check system 

use Softmax\Installer\Services\InstallerService;

class CustomInstallerService extends InstallerService
{
    public function customInstallationStep(array $data): array
    {
        // Your custom installation logic
        
        return [
            'success' => true,
            'message' => 'Custom step completed successfully.'
        ];
    }
}

use Softmax\Installer\Exceptions\{
    InstallerException,
    RequirementException,
    LicenseException,
    DatabaseException,
    InstallationException
};

try {
    // Installation code
} catch (LicenseException $e) {
    // Handle license validation errors
} catch (DatabaseException $e) {
    // Handle database connection errors
}
bash
php artisan vendor:publish --tag=softmax-installer-config
bash
php artisan vendor:publish --tag=softmax-installer-views