PHP code example of zyos / install-bundle

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

    

zyos / install-bundle example snippets


// config/bundles.php
return [
	/** ... **/
	Zyos\InstallBundle\InstallBundle::class => ['all' => true],
];
text
config/packages/zyos_install.yaml
bash
php bin/console list zyos
bash
php bin/console zyos:install <environment> [options]
bash
php bin/console zyos:cli <environment> [options]
yaml
zyos_install:
    cli:
        -   command: ['mkdir', '-p', '/var/www/app/storage']
            environments: ['dev', 'prod']
            enable: true
            if_error: 'stop'
            priority: 1

        -   command: ['chmod', '775', '/var/www/app/storage']
            environments: ['prod']
            enable: true
            if_error: 'none'       # Ignore error if chmod fails
            priority: 2

        -   command: ['/usr/local/bin/composer', 'dump-autoload', '--optimize']
            environments: ['prod']
            enable: true
            if_error: 'stop'
            priority: 10
bash
php bin/console zyos:filesystem <environment> [options]
bash
php bin/console zyos:source

┌──────────────────────────────────────────────────────┐
│              ZYOS DEPLOYMENT FLOW                    │
└──────────────────────────────────────────────────────┘

  STEP 1 — Pre-deployment diagnostics (optional but recommended)
  ┌─────────────────────────────────────────────────┐
  │  php bin/console zyos:source                    │
  │  → Verify PHP, OPcache and disk are healthy     │
  └─────────────────────────────────────────────────┘

  STEP 2 — Main installation
  ┌─────────────────────────────────────────────────┐
  │  php bin/console zyos:install prod              │
  │  → Runs Symfony commands (assets, migrations)   │
  │  → Internally calls zyos:filesystem & zyos:cli  │
  │  → Creates the lock file if everything succeeds │
  └─────────────────────────────────────────────────┘

  STEP 3 — Post-installation validation
  ┌─────────────────────────────────────────────────┐
  │  php bin/console zyos:validate prod             │
  │  → Confirms directories and files exist         │
  │  → Verifies correct permissions                 │
  │  → Returns exit code 1 on failure (CI/CD)       │
  └─────────────────────────────────────────────────┘
bash
#!/bin/bash
set -e   # Stop the script if any command fails

echo "=== Starting deployment ==="

# Step 1: Check environment
php bin/console zyos:source

# Step 2: Run installation
php bin/console zyos:install prod

# Step 3: Validate result
php bin/console zyos:validate prod --only-errors

echo "=== Deployment completed successfully ==="
bash
php bin/console zyos:install prod --show-output
bash
php bin/console zyos:install prod
php bin/console zyos:validate prod